Created
August 17, 2016 20:11
-
-
Save kageurufu/79e4aaa1c41cbdb147e936d7e473029d to your computer and use it in GitHub Desktop.
Fix for react-native#9319
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add the following imports and methods in their respective places | |
import com.facebook.infer.annotation.Assertions; | |
import com.facebook.react.LifecycleState; | |
public class MainApplication extends Application implements ReactApplication { | |
protected Application getApplication() { return this; } | |
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { | |
@Override | |
protected ReactInstanceManager createReactInstanceManager() { | |
ReactInstanceManager.Builder builder = ReactInstanceManager.builder() | |
.setUseOldBridge(true) | |
.setApplication(getApplication()) | |
.setJSMainModuleName(getJSMainModuleName()) | |
.setUseDeveloperSupport(getUseDeveloperSupport()) | |
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE); | |
for (ReactPackage reactPackage : getPackages()) { | |
builder.addPackage(reactPackage); | |
} | |
String jsBundleFile = getJSBundleFile(); | |
if (jsBundleFile != null) { | |
builder.setJSBundleFile(jsBundleFile); | |
} else { | |
builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); | |
} | |
return builder.build(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment