React Navigation 5.x стека навигации показывает пустой экран - PullRequest
0 голосов
/ 18 февраля 2020

// app. js "реагировать": "16.9.0", "реагировать-нативный": "0.61.5", следовать официальному документу, но показывать пустой экран реагировать как родной

import React from 'react';
import { SafeAreaView, StatusBar, View, Text } from 'react-native';
import { Provider } from 'react-redux';
import configureStore from './App/redux/store/store'
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import AppSplashScreen from './App/screens/splashScreen/SplashScreen';
const Stack = createStackNavigator();


function MyStack() {
 return (
        <Stack.Navigator>
          <Stack.Screen name="Home" component={AppSplashScreen} />
        </Stack.Navigator>
 );
}

export default class App extends React.Component {
   constructor(props) {
     super(props)
     this.state = {}
   }

   render() {
        return (
                <>
                <StatusBar barStyle="dark-content" />
                  <SafeAreaView  >
                    <Provider store={configureStore()} >
                      <NavigationContainer>
                        <MyStack />
                      </NavigationContainer>
                    </Provider>
                 </SafeAreaView>
                </>
               );
             }

           };

, но замените MyStack на AppSplashScreen, затем отобразите SplashScreen

1 Ответ

0 голосов
/ 19 февраля 2020

Это должно работать нормально, старайтесь не отделять Stack.Navigator от контейнера навигации

это работает для меня

function App() {
  return (
    <Provider store={store}>
      <NavigationContainer>
        <Stack.Navigator initialRouteName="Home">
          <Stack.Screen name="Home" component={Homepage} />
          <Stack.Screen name="Notes" component={Notes} />
        </Stack.Navigator>
     </NavigationContainer>
   </Provider>
 );
}

Экспорт по умолчанию Приложение;

...