-
Notifications
You must be signed in to change notification settings - Fork 35
[QUESTION] cordova.js imports, RN 4.6 #42
Comments
I have done a bit more investigation and playing with the platform/assets/www/cordova.js file. It seems as though it expects cordova.define() to work with the global require(), but that isn't the case. Something I don't understand is that inside cordova.define("cordova/utils") there is a call to require("cordova/utils"). This seems like a circular reference. Were the modules require()'d in cordova.js previously defined somewhere else that is no longer being included, I wonder? eg in another module. |
@mribbons thanks for the patch for RN 4.6 :) did you manage to understand this issue also? |
Hi @theBliz, I couldn't get it to work. I have walked away from it for now. |
I've been able to import cordova-plugin-camera and now I'm having an issue with importing https://github.com/mattrayner/cordova-plugin-vuforia and some error related with cordova pops out Execution failed for task ':cordovaplugin:mergeReleaseResources'. By any chance did you have something similar? |
@theBliz nope, I couldn't get any plugins to work. I added cordova-plugin-cipherlab-rs30 then removed it, then I got the issues with cordova.js, as above. Is cordova-plugin-camera functional after importing? |
I still have to try it on the device, but it's building. This is the default class in my index.android.js `export default class test001 extends Component { var Cordova = require('react-native-cordova-plugin'); Cordova.navigator.camera.getPicture(onSuccess, onFail, {sourceType: Cordova.Camera.PictureSourceType.SAVEDPHOTOALBUM)}); // Listen to cordova-plugin-network-information plugin's events render() { what you think? |
@theBliz Looks promising. Let me know how it goes on device, make sure you wire up the camera function and test it out. Full disclaimer, I don't have time to work on this now but I may come back to it. I was going to use this plugin for cordova sql, but someone has already ported it to RN anyway. I think that will happen with other plugins as RN users need them. I'm not sure of the usage stats on RN vs cordova but it wins out in terms of development speed and performance, so I think cordova might not survive. @axemclion - Can you comment? |
For me to work I had to replace all the require("xxx") by cordova.require("...") |
Hi,
I have started work to get this module working with RN 4.6, see here:
mribbons@2eebb79
The Java side seems to initialise OK, I have got around null reference exceptions, the commit is self explanatory.
I am now having an issue with the cordova.js file:
I have checked the github link and it is unrelated.
It seems that cordova/utils is defined later in the file. If I remove
It seems to work, but then has similar issues with all of the other requires, all of which are defined in the file apart from cordova/plugin_list.
It seems as though the cordova.define() calls are failing for some reason,
I'm wondering if this is to do with RN changes, or the cordova.js file itself.
I have tried rebuilding the file to no avail.
At first I was using this plugin:
cordova-plugin-cipherlab-rs30
but I have since removed it and I still get the same issues.
The text was updated successfully, but these errors were encountered: