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
NullPointerException - Register native module in React Native #4530
Comments
Hey ilansas, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
You need to return public class RCTModulesPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new AppInit(reactContext));
return modules;
}
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
} BTW, there's an awesome place to ask question like this one: StackOverflow. It's the best system for Q&A. Many people from the community hang out there and will be able to see your question, you can vote on answers and mark question as answered etc. This lets us keep a list of bug reports and feature requests on github and especially Product Pains (again, with voting which is really nice). If you think StackOverflow works for you please consider posting there instead and closing this issue. I'm posting this here because github issues haven't been working very well for us and because StackOverflow is so much better. Thanks for reading! :) |
Thanks, for the trick. I'm sorry for using Issues, I can delete my post if you'd like |
Hi,
I'm currently porting my react native app to Android and I'm getting this error when I try to register my module in the MainActivity class :
Here is my code : MainActivity.java
My package :
And finally my module:
Is this caused internally or did I make a mistake ? Thanks
The text was updated successfully, but these errors were encountered: