axemclion / react-native-cordova-plugin

Cordova Plugin Adapter for React Native
ISC License
440 stars 35 forks source link

React-Native 0.29 breaking changes #35

Open dotnetprofessional opened 8 years ago

dotnetprofessional commented 8 years ago

Plugins which pass activity reference in the constructor need to be updated to extend ReactContextBaseJavaModule use getCurrentActivity to get the activity reference. This change is backward compatible. https://github.com/facebook/react-native/releases/tag/v0.29.0

Currently this is preventing the use of the code with the latest bits.

axemclion commented 8 years ago

@dotnetprofessional Thanks for reporting this. I will look at updating this plugin for that usecase.

dotnetprofessional commented 8 years ago

Great! Not to put any pressure on you ;) But do you have any idea when you might get the chance to update it?

axemclion commented 8 years ago

@dotnetprofessional It will probably be a while. I am currently working on web workers for ReactNative, that I am speaking about at conferences. I need to get those done before I work on this.

Would appreciate pull request if you have the time.

axemclion commented 8 years ago

@dotnetprofessional I finally got a chance to look into this and looks like that is not the only breaking change. The bigger change is the introduction of MainApplication - this is where the native modules are initialized.

This is a problem since we would not really have an Activity when the native module is initialized. Cordova's interfaces require an activity, and are always based on that. Thus, we would need to find a way to access that package in the MainActivity, initialize it when that activity is created and then run the plugin, when the exec method is called.

This looks like a total re-write of the plugin, given that so many pieces have moved around.

avishayhajbi commented 8 years ago

+1

vthunder commented 8 years ago

In case this helps anyone–

It's possible to use an older version of react-native by using the 'rninit' command:

npm install -g rninit
rninit App --source react-native@0.28.0

Then you'll be able to use react-native-cordova-plugin as-is. You'll be stuck at that version of react-native until this issue is resolved, of course, with whatever quirks and bugs that entails.

Btw, downgrading react-native and running react-native upgrade (which prompts you to downgrade files in the android/ and ios/ dirs) did not work for me. I managed to get it to build, but the app would crash on startup—there's some additional state being bundled in from somewhere that I couldn't track down. YMMV.

sudharsan1988 commented 8 years ago

+1

mtwallet commented 7 years ago

@axemclion Have you had chance to look at a fix for this issue? Many thanks.

e-onux commented 7 years ago

@axemclion Have you had a chance to look?

nda2221 commented 7 years ago

@axemclion Any update, friend?

nicosefer commented 7 years ago

any news?

axemclion commented 7 years ago

@nicsefer I have not had the time to work on this, but would accept pull requests.

theBliz commented 7 years ago

@axemclion @mribbons it seems that the pull request has some issues. The readme it's missing the MainApplication.java example and the CordovaPluginPackage.java is missing "set_MainActivity". I don't know if something else is missing, I'll update this in case I find out more :) and thanks for the great work! :D

mribbons commented 7 years ago

@theBliz I haven't submitted a PR yet because the work is incomplete.

The changes are only in my repo: https://github.com/mribbons/react-native-cordova-plugin

theBliz commented 7 years ago

@mribbons got it :) so there are issues just in the ReadMe (broken links for the example)

XBLDev commented 7 years ago

Hi any news about the update? I've tried hacking my way to get it to work with the latest RN but no luck, it seems I have to wait until the branches merge :-)

mribbons commented 7 years ago

@XBLDev you might be better off contributing your efforts to converting whichever libs you need to RN, this one doesn't seem to be moving.

axemclion commented 7 years ago

I am glad to take contributions to this library - send in a pull request, or even better, please help by becoming a contributor.

XBLDev commented 7 years ago

Hi @axemclion How exactly do I send in a pull request? I've never done it before :-(

mribbons commented 7 years ago

HI @axemclion, care to have a look at my repo? I don't have the necessary knowledge to get it working.

https://github.com/axemclion/react-native-cordova-plugin/issues/42

mribbons commented 7 years ago

@XBLDev after cloning the repo and committing changes, use the New Pull Request button. There should be plenty of information online and on github itself.

XBLDev commented 7 years ago

Hi @mribbons I don't think I'm knowledgeable enough to make it working with the current RN either, I mean you seem to be pro at this and you can't even make it work, and i'm just a RN app developer, and unfortunately not a very good one :-)