react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Start white screen

Open knowledges opened this issue 8 years ago • 10 comments

Code Startup success,but android (Commd + M) invalid; I think it's a MainApplication.java problem, but I don't know where it is.

package com.selfrnapp;

import android.support.annotation.Nullable;

import com.facebook.react.ReactPackage;
import com.reactnativenavigation.NavigationApplication;

import java.util.List;

public class MainApplication extends NavigationApplication {
    @Override
    public boolean isDebug() {
        return BuildConfig.DEBUG;
    }

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

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

package.json

{
  "name": "SelfRNApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.2.0",
    "react-native": "0.52.3",
    "react-native-navigation": "^1.1.484"
  },
  "devDependencies": {
    "babel-jest": "23.4.2",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.5.0",
    "react-test-renderer": "16.2.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

wx20180831-232736 2x

knowledges avatar Aug 31 '18 15:08 knowledges

Could be related to this

Try the steps mentioned there, and probably switch off Remote debug and Hot reload

perrosnk avatar Aug 31 '18 18:08 perrosnk

Make sure you do not use AppRegistry.registercomponent('appName', () => App);

Just import App from './src/App'; and then in App.js, register the components and then use

Navigation.events().registerAppLaunchedListener(() => {
		Navigation.setRoot(yourStackTree);
});

Anarcho-X avatar Sep 01 '18 12:09 Anarcho-X

@spiraltrip Does this apply for the v.2 of RNN? Or is it applicable for the v.1 as well?

perrosnk avatar Sep 01 '18 22:09 perrosnk

@perrosnk It applies to RNN2 because of registerAppLaunchedListener(). It needs to handle the native app launch event which must precede before React-Native's AppRegister.registerComponent() method. Well at least that's the experience and assumption I have.

Anarcho-X avatar Sep 02 '18 03:09 Anarcho-X

There is no solution yet.

knowledges avatar Sep 02 '18 07:09 knowledges

If react-native link react-native-navigation@latest can be executed directly, it will be perfect.

knowledges avatar Sep 02 '18 08:09 knowledges

This can block many problems.

knowledges avatar Sep 02 '18 08:09 knowledges

我已经降级到0.47.1 办吧了 I have been downgraded to 0.47.1. run success

knowledges avatar Sep 02 '18 08:09 knowledges

I'm having problems with RN 0.56, as do many many people reporting. We can only wait for a bug fix 0.57. But, Im using 0.55.4 and RNN 2.0.2514 with no problems at all. Not necessary to downgrade to 0.47.1

You would really need to know how to configure libraries in Android project files - settings.gradle, build.gradle & app/build.gradle, MainActivity and MainApplication java files. If you learn a bit more and understand what these files do, you will get it and make things works. These configurations are needed from time to time for many other libraries too, like splash screens, vector-icons, firebase, etc.

Simply using and relying on react-native link will just mess up your config files with duplicates and unwanted insertions especially in the MainActivity and MainApplication java files.

The white screen problem could largely be due to problems in MainApplication file - as its the main file that creates a bridge between Android and React Native, and also loads any other javascript packages when the application starts. Also, since we are using React Native Navigation, we are extending the Application/Activity classes the provide. So check these files properly. You will solve the problem.

Anarcho-X avatar Sep 03 '18 03:09 Anarcho-X

I'm trying to try.

knowledges avatar Sep 03 '18 07:09 knowledges