question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Screen goes blank in react native app with react-navigation library

See original GitHub issue

Describe the bug The screen goes blank in react native app with react-navigation library

Code snippet

const Stack = createStackNavigator();

function App() {
    return (
        <NavigationContainer>
            <Stack.Navigator initialRouteName="Home">
                <Stack.Screen name="Home" component={HomeScreen} />
                <Stack.Screen name="Details" component={register({ require: () => require('./DetailsScreen') })} />
            </Stack.Navigator>
        </NavigationContainer>
    );
}

Contents of Details screen: import { Button, Text, View } from ‘react-native’; import React from ‘react’;

export  function DetailsScreen({ navigation }) {
    return (
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
            <Text>Gpo Screen</Text>
            <Button
                title="Go to Details... again"
                onPress={() => navigation.push('Details')}
            />
        </View>
    );
}

Repo for reproducing https://snack.expo.io/?platform=android&name=Hello React Navigation | React Navigation&dependencies=%40expo%2Fvector-icons%40*%2C%40react-native-community%2Fmasked-view%40*%2C%40react-navigation%2Fbottom-tabs%40^5.8.0%2C%40react-navigation%2Fdrawer%40^5.9.0%2C%40react-navigation%2Fmaterial-bottom-tabs%40^5.2.16%2C%40react-navigation%2Fmaterial-top-tabs%40^5.2.16%2C%40react-navigation%2Fnative%40^5.7.3%2C%40react-navigation%2Fstack%40^5.9.0%2Creact-native-paper%40^4.0.1%2Creact-native-reanimated%40*%2Creact-native-safe-area-context%40*%2Creact-native-gesture-handler%40*%2Creact-native-screens%40*%2Creact-native-tab-view%40^2.15.1&sourceUrl=https%3A%2F%2Freactnavigation.org%2Fexamples%2F5.x%2Fmultiple-push.js

I have used the code shared above to try the bundle splitting and it did not work

Environment:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
kirillzyuskocommented, Dec 10, 2020

@radhakrishnant2s I created an example on snack: https://snack.expo.io/frQvTTGIP Everything works fine.

I think the problem was in this line:

export function DetailsScreen({ navigation }) {

It should be:

export default function DetailsScreen({ navigation }) {

or if you don’t like the usage of default export - you can pass an extractor to register function

component={register({ require: () => require('./DetailsScreen'), extract: 'DetailsScreen' })}

Let me know, whether it works for you or not 😉

0reactions
kirillzyuskocommented, Oct 1, 2021

Hi @sammiepls

Are you using extract property?

The syntax should be the same:

register({ loader: () => import('./DetailsScreen'), extract: 'DetailsScreen' })
Read more comments on GitHub >

github_iconTop Results From Across the Web

Empty screen in react native app after adding react navigation
after adding react navigation to my app , my app was just giving plane white screen. so anyone knows how I can fix...
Read more >
Common mistakes - React Navigation
Common mistakes. This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Navigation and serves ...
Read more >
Getting Started with React Navigation v6 and TypeScript in ...
When you have a complex mobile application structure or many screens in your ... React Navigation library is one of the most used...
Read more >
Expo React native new EAS build blank white screen ... - Reddit
So my app.js is literrally copied and pasted from the react-navigation website version 6. I get a blank white screen after the splash...
Read more >
Navigating Between Screens - React Native
Mobile apps are rarely made up of a single screen. ... an alternative to React Navigation, the following library provides native navigation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found