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

App no longer works after installing react-native-navigation

Open Nisthar opened this issue 8 years ago • 14 comments

I followed the installation instructions correctly. I checked twice.

I am getting a blank screen after installing react-native-navigation.

I entered some invalid characters to check. But react-native doesn't give any errors. Its still building successfully.

my index.js

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {Navigation} from 'react-native-navigation';
import {registerScreens, registerScreenVisibilityListener} from './screens';

registerScreens();
registerScreenVisibilityListener();

const tabs = [
  {
    label: "Others Eating",
    screen: "example.Main",
    icon: require("./assets/food1.svg"),
    title: "Others Eating"
  },
  {
    label: "Top Eaters",
    screen: "example.TopEaters",
    icon: require("./assets/food1.svg"),
    title: "Top Eaters"
  }
];

sdgfdsgdsfg //this error is not showing on build. Its building successfully.

// this will start our app
Navigation.startTabBasedApp({
  tabs,
  animationType: Platform.OS === "ios" ? "slide-down" : "fade",
  tabsStyle: {
    tabBarBackgroundColor: "#003a66",
    tabBarButtonColor: "#ffffff",
    tabBarSelectedButtonColor: "#ff505c",
    tabFontFamily: "BioRhyme-Bold"
  },
  appStyle: {
    tabBarBackgroundColor: "#003a66",
    navBarButtonColor: "#ffffff",
    tabBarButtonColor: "#ffffff",
    navBarTextColor: "#ffffff",
    tabBarSelectedButtonColor: "#ff505c",
    navigationBarColor: "#003a66",
    navBarBackgroundColor: "#003a66",
    statusBarColor: "#002b4c",
    tabFontFamily: "BioRhyme-Bold"
  }
});

./screens/index.js

import { Navigation, ScreenVisibilityListener } from "react-native-navigation";
import Main from "./Main";
import TopEaters from "./TopEaters";

export function registerScreens() {
  Navigation.registerScreen("example.Main", () => Main);
  Navigation.registerScreen("example.TopEaters", () => TopEaters);
}

./screens/Main.js

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';


export default class Main extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Main</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

./screens/TopEaters.js

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';


export default class TopEaters extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Top Eaters</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

[FILL THIS OUT - It will be extremely helpful]


Environment

  • React Native Navigation version: ^1.1.378
  • React Native version: 0.53.0
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Device

Nisthar avatar Feb 16 '18 08:02 Nisthar

The example code is working without any error. So, its not an error in the installation.

I still can't understand why its giving me a blank screen if there is error in the code.

Nisthar avatar Feb 16 '18 09:02 Nisthar

Have you tried to reset your packager instance? If the error is not thrown then it seems like he´s getting a old version of your js files

mkuczera avatar Feb 16 '18 09:02 mkuczera

@Nisthar Are you experiencing a white screen in Android or iOS?

perrosnk avatar Feb 16 '18 10:02 perrosnk

Try to downgrade react-native to 0.51.0

pipinov avatar Feb 16 '18 17:02 pipinov

I have the same issue.

Followed all the instructions but I now have an app that's stuck on the React Native white screen (I'm not even using this package yet): image

Seems to time out on something?

TheDutchCoder avatar Feb 16 '18 21:02 TheDutchCoder

Same issue here a2 But see what I found xxx Any idea?

jpacol avatar Feb 17 '18 13:02 jpacol

@jpacol Its hard to find the real issue here. In my case it was bad configuration in my js code. Try running the example from this repo and see if it works.

Nisthar avatar Feb 18 '18 07:02 Nisthar

I have the same issue, redux-example app worked though. What was the bad configuration? I have installed basic react-native app with init command and then went through this guide https://wix.github.io/react-native-navigation/#/usage

ghost avatar Feb 22 '18 20:02 ghost

Hey guys, I'm closing as this is not a bug. As @Nisthar poinsted out, usually white screens are caused by some error in Js side.

guyca avatar Feb 22 '18 20:02 guyca

downgrade to react 51 and it should works fine

devjaw avatar Feb 28 '18 12:02 devjaw

I am in 0.54.2 - android - was anyone able to get this to work? It loaded once for me after i kept doing a react-native start --reset-cache react-native run-android. when it loaded that one time i enabled remote debugging and live reload. I see console logging just fine.

Noitidart avatar Mar 21 '18 20:03 Noitidart

I got it working. I am on Android, the blank screen issue for me was this - https://github.com/wix/react-native-navigation/issues/2180

Noitidart avatar Mar 21 '18 21:03 Noitidart

my app was working great i installed npm install @react-navigation/core@next @react-navigation/native@next

This broke the app, and i tried to uninstall, broke the app more. re-installed react-native

now my app cuts off after load screen

i assume i have to start over now

utb2017 avatar Nov 30 '19 17:11 utb2017

@utb2017 Make sure you are following the steps correctly. https://reactnavigation.org/docs/getting-started/. React Native documentaion didn't mention the need to change the build.gradle file, and I had ignored the "import 'react-native-gesture-handler';" part. One of the two was the cause for white screen crashing.

chrycon avatar Feb 25 '20 22:02 chrycon