1

我已经将我的 MainNavigator 与所有导入的屏幕集成在一起,而当我在我的 ios 模拟器上运行它时,它只显示白屏,没有其他任何内容。这意味着运行应用程序没有任何错误。我不知道为什么导航不可见。这是代码。

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { TabNavigator, DrawerNavigator, StackNavigator } from 'react-navigation';

import WelcomeScreen from './screens/WelcomeScreen';
import SigninScreen from './screens/SigninScreen';
import SignupScreen from './screens/SignupScreen';
import HomeScreen from './screens/HomeScreen';
import BusinessScreen from './screens/BusinessScreen';
import TechScreen from './screens/TechScreen';
import EducationScreen from './screens/EducationScreen';
import LifestyleScreen from './screens/LifestyleScreen';
import ProfileScreen from './screens/ProfileScreen';
import FavoritesScreen from './screens/FavoritesScreen';
import SettingsScreen from './screens/SettingsScreen';

export default class App extends React.Component {
  render() {
    const MainNavigator = TabNavigator({
      welcome: { screen: WelcomeScreen },
      signin: { screen: SigninScreen },
      signup: { screen: SignupScreen },
      main: {
        screen: DrawerNavigator({
          home: { screen: HomeScreen },
          business: { screen: BusinessScreen },
          tech: { screen: TechScreen },
          education: { screen: EducationScreen },
          lifestyle: { screen: LifestyleScreen },
          profile: {
            screen: StackNavigator({
              profile: { screen: ProfileScreen },
              settings: { screen: SettingsScreen },
            }),
          },
        }),
      },
    })
    return (
      <View style={styles.container}>
        <MainNavigator />
      </View>
    );
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

以下是我在我的应用程序中使用的版本:

4

0 回答 0