-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
java.lang.AssertionError: TurboModules are enabled, but mTurboModuleRegistry hasn't been set. #48622
Comments
Warning Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:
|
@HeLiHuang, can you please share a repro to validate the issue? |
[email protected]:HeLiHuang/react-native.git |
我想用ReactInstanceManager动态加载jsbundle文件,这要可以灵活的加载多个完全不同的jsbundle文件 |
@HeLiHuang the reproducer you provided is not valid. It's hard to help you without a reproducer. Anyway by looking at your code, I'd say you should make those changes: public class RNBaseActivity extends Activity implements DefaultHardwareBackBtnHandler {
private static final String TAG = "RNBaseActivity";
- private ReactInstanceManager mReactInstanceManager;
private ReactRootView mReactRootView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mReactInstanceManager = ReactInstanceManager.builder()
- .setApplication(getApplication())
- .setCurrentActivity(this)
- .setBundleAssetName("index.android.bundle")
- .setJSMainModulePath("index")
- .addPackage(new MainReactPackage())
- .addPackage(new MyPackage())
- .setUseDeveloperSupport(BuildConfig.DEBUG)
- .setInitialLifecycleState(LifecycleState.RESUMED)
- .build();
- mReactRootView = new ReactRootView(this);
- mReactRootView.startReactApplication(mReactInstanceManager, "IotReactNativeApp", null);
- setContentView(mReactRootView);
}
@Override
protected void onPause() {
super.onPause();
- mReactInstanceManager.onHostPause(this);
}
@Override
protected void onResume() {
super.onResume();
- mReactInstanceManager.onHostResume(this, this);
}
@Override
protected void onDestroy() {
super.onDestroy();
- mReactInstanceManager.onHostDestroy(this);
- mReactRootView.unmountReactApplication();
}
@Override
public void onBackPressed() {
super.onBackPressed();
- mReactInstanceManager.onBackPressed();
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_MENU){
- mReactInstanceManager.showDevOptionsDialog();
return true;
}
return super.onKeyUp(keyCode, event);
}
@Override
public void invokeDefaultOnBackPressed() {
super.onBackPressed();
}
} The problem here is that you're invoking methods on the This is how the default activity looks like: You should not be manipulating it further unless you have a specific reason |
Description
MainApplication.kotlin:
RNViewHostActivity.Java:
Steps to reproduce
It just throws the error once i enabled the architecture support from gradle.properties file.
React Native Version
0.76.6
Affected Platforms
Runtime - Android
Areas
TurboModule - The New Native Module System
Output of
npx react-native info
Stacktrace or Logs
Reproducer
none
Screenshots and Videos
The text was updated successfully, but these errors were encountered: