我已经将我的 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',
},
});
以下是我在我的应用程序中使用的版本:
世博会 18.0.4
反应 16.0.0-alpha.12
react-native 目前似乎是最新版本。在 package.json 中显示了 Expo https://github.com/expo/react-native/archive/sdk-18.0.1.tar.gz生成的这个链接
反应导航 1.0.0-beta.11