facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.46k stars 24.25k forks source link

componentWillUnmount did not call when we use react-native 0.30.0 #9182

Closed xujinyang closed 8 years ago

xujinyang commented 8 years ago

componentWillUnmount did not call when we use react-native 0.30.0 and react 15.3.0,and render will call too many times when l restart rn page

image

 private static class Holder {
        private static ReactInstanceManager sInstance = ReactInstanceManager.builder()
                .setApplication((Application) ElemeApplicationContext.getContext())
                .setJSMainModuleName("index.android")
                .addPackage(new MainReactPackage())
                .addPackage(new CrowdReactPackage())
                .setUseDeveloperSupport(getUseDeveloperSupport())
                .setInitialLifecycleState(mLifecycleState)
                .setJSBundleFile(ReactJsBundleInstanceManager.getInstance().getJSBundleFile())
                .setUseOldBridge(true)
                .build();

but when we use ReactActivity , it is ok.

pvllnspk commented 8 years ago
@Override
protected void onDestroy() {
    LViS.getInstance().close();
    if (reactRootView != null) {
        reactRootView.unmountReactApplication();
        reactRootView = null;
    }
    super.onDestroy();
}