I want to call a method in MyCustomModuleClass extends ReactContextBaseJavaModule from another Class
MyCustomModule.java
public class MyCustomModule extends ReactContextBaseJavaModule {
private ReactContext mReactContext;
public MyCustomModule(ReactApplicationContext reactContext) {
super(reactContext);
mReactContext = reactContext;
}
@Override
public String getName() {
return "CustomModule";
}
private void sendEvent(String eventName, Object params) {
mReactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
}
I'm trying this..
OtherClass.java
public class OtherClass extends AnotherClass {
@Override
protected void eventOccurred(Context context) {
MyCustomModule RNC = new MyCustomModule(?);//-> Can't call without ReactContext
RNC.sendEvent("CustomEvent", ObjectData);
}
}
Sorry, I know nothing about java, could any one please help me out?
Is there any way I can get ReactContext in OtherClass?