React-native-navigation: Navigation.registerComponent does not register component with a componentId

Created on 21 Mar 2019  ·  3Comments  ·  Source: wix/react-native-navigation

Issue Description

Navigation.registerComponent() does not register the JS component with a componentId. Issue found when attempting to displaying a react-native view inside of a native Android module (using ReactRootView).

Steps to Reproduce / Code Snippets / Screenshots

Issue found with component registration:

Navigation.registerComponent(
    "OtherView",
    () => require("./OtherView").default
  );

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
      component: {
        name: "init"
      }
    }
  });
});

Then call in Android (java) to display component using ReactRootView:

mReactRootView.startReactApplication(mReactInstanceManager, "OtherView", getLaunchOptions());

Screenshot:

Screenshot_20190321-165353

The issue is resolved by registering component with AppRegistry (before calling setRoot):

Navigation.registerComponent(
    "OtherView",
    () => require("./OtherView").default
  );

AppRegistry.registerComponent("OtherView", () => OtherView);

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
      component: {
        name: "init"
      }
    }
  });
});


Environment

  • React Native Navigation version: 2.13.1
  • React Native version: 0.58.6
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Seen on both simulator and actual device. Issue seen with various Android versions. Issue was seen in debug buils.
🏚 stale

All 3 comments

seeing the same issue here

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

charlesluo2014 picture charlesluo2014  ·  3Comments

viper4595 picture viper4595  ·  3Comments

bdrobinson picture bdrobinson  ·  3Comments

nbolender picture nbolender  ·  3Comments

switchtrue picture switchtrue  ·  3Comments