Fix Application Context

This commit is contained in:
DevHossamHassan 2016-10-18 14:10:19 +02:00
parent 3728f018dd
commit 40781fe813
2 changed files with 11 additions and 5 deletions

View File

@ -22,11 +22,11 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
private Instabug mInstabug;
private String mAndroidApplicationToken;
private Instabug.Builder mBuilder;
private Application mApplication;
private Application androidApplication;
public RNInstabugReactnativeModule(ReactApplicationContext reactContext) {
public RNInstabugReactnativeModule(ReactApplicationContext reactContext, Application androidApplication) {
super(reactContext);
this.mApplication = reactContext.getApplicationContext();
this.androidApplication = androidApplication
}
@Override
@ -44,7 +44,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
{
this.mAndroidApplicationToken = androidApplicationToken;
mInstagbug = new Instabug.Builder(mApplication, mAndroidApplicationToken)
mInstagbug = new Instabug.Builder(androidApplication, mAndroidApplicationToken)
.setDebugEnabled(true)
.setEmailFieldRequired(false)
.setFloatingButtonOffsetFromTop(400)

View File

@ -16,10 +16,16 @@ import com.facebook.react.bridge.JavaScriptModule;
public class RNInstabugReactnativePackage implements ReactPackage {
Application androidApplication;
public RNInstabugReactnativePackage(Application application) {
this.androidApplication = application;
}
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new RNInstabugReactnativeModule(reactContext));
modules.add(new RNInstabugReactnativeModule(reactContext,androidApplication));
return modules;
}