Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RN 0.29+: use getCurrentActivity instead of passing a reference to the activity #58

Open
kmjennison opened this issue Jul 22, 2016 · 3 comments

Comments

@kmjennison
Copy link

React Native 0.29 moves getPackages() into MainApplication.java. To support 0.29, we should extend ReactContextBaseJavaModule and use getCurrentActivity() to get a reference when needed rather than requiring one at construction time.

See:
facebook/react-native@49f20f4#commitcomment-17965418

@andy9775
Copy link
Contributor

andy9775 commented Aug 2, 2016

Did you even manage to get it working?

I tried running this package on RN 0.30.0 and it tells me that getPackages cannot be overriden because the method does not exist in the parent class. Further, if I add new NotificationPackage(this) to my MainApplication.java file it throws a wrong number of arguments error (NotificationPackage constructor is not expecting an argument).

@kmjennison
Copy link
Author

@andy9775 No, I haven't had time to work on this yet. We're still running an older version of RN until our dependencies work with RN >0.28.

Note that you won't be able to reference the activity in MainApplication.java with this, because MainApplication is not an activity like ReactActivity.java was. This library has to change, not just the way you're integrating it into your app.

Here's an example of a PR from another React Native library that fixed this problem:
https://github.com/yamill/react-native-orientation/pull/85/files

To use this library now, you can run an older version of RN, or if you have the time, submit a PR for this library.

@andy9775
Copy link
Contributor

andy9775 commented Aug 2, 2016

Ok thanks for the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants