React-native-navigation: React context not initialized on first load and app doesn't pass splash screen

Created on 13 Dec 2017  路  6Comments  路  Source: wix/react-native-navigation

Issue Description

I'm running on Android device, and when I start the app it won't pass the splash screen. If I switch to another app and come back, it runs correctly.

By putting some logs in the SplashActivity onResume, I found out it doesn't pass this condition on startup:

if (NavigationApplication.instance.isReactContextInitialized()) {
    NavigationApplication.instance.getEventEmitter().sendAppLaunchedEvent();
    return;
}

Steps to Reproduce / Code Snippets / Screenshots

Here's my MainActivity:

public class MainActivity extends SplashActivity {

    @Override
    public View createSplashLayout() {
        View view = new View(this);
        view.setBackgroundColor(Color.CYAN);
        return view;
    }
}

And my MainApplication:

public class MainApplication extends NavigationApplication {

  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
      new VectorIconsPackage(),
      new RCTCameraPackage(),
      new ReactNativeDialogsPackage()
    );
  }

  @Override
  public String getJSMainModuleName() {
    return "artifacts/index";
  }

  @Override
  public boolean isDebug() {
    return BuildConfig.DEBUG;
  }

  @Override
  public List<ReactPackage> createAdditionalReactPackages() {
    return getPackages();
  }
}

Environment

  • React Native Navigation version: 1.1.284
  • React Native version: 0.50.3
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Device / 6.0.1 / Debug
馃彋 stale

Most helpful comment

Same issue having here on Android only

"react": "^16.3.0-alpha.1",
"react-native": "0.54.0",
"react-native-navigation": "^1.1.398"

All 6 comments

Just found out it's the same as #963. The bug only occurs with remote js debug enabled and hot reload turned off.

I'm getting this bug regardless of dev settings

iOS
version 0.48.4 as recommended by someone in another issue

Same here, exact the same issue

[email protected]
[email protected]
[email protected]
[email protected]

Easy to reproduce.

Download and prepare (npm install) https://github.com/wix/react-native-navigation-bootstrap

It works when execute from cmd with "react-native run-android" but fails when "remote debug js" (open chrome tab) is active or use visual studio code and react native tool.

This don't happend without react native navigation, so it seems to be related to a vs code and react native navigation conflict.

Same issue having here on Android only

"react": "^16.3.0-alpha.1",
"react-native": "0.54.0",
"react-native-navigation": "^1.1.398"

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 version and report back. Thank you for your contributions.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings