【发布时间】:2020-02-22 12:03:25
【问题描述】:
如果我使用类组件来链接我的导航,它将花费大约 40 秒才能切换到屏幕。 为什么?
class NotificationScreen extends Component {
render() {
return (
<ApplicationProvider mapping={mapping} theme={theme}>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button onPress={() => this.props.navigation.goBack()} title="Go back home">Go back</Button>
</View>
</ApplicationProvider>
);
}
}
export default NotificationScreen;
这是下面的导航
const Drawer = createDrawerNavigator();
class App extends Component {
render(){
return (
<>
{!AsyncStorage.getItem('@MySuperStore:key')?
<ApplicationProvider mapping={mapping} theme={theme}>
<NavigationContainer>
<Drawer.Navigator drawerType="slide" initialRouteName="Home">
<Drawer.Screen name="Home" component={Dashboard} />
<Drawer.Screen name="Notifications" component=
{NotificationScreen} />
</Drawer.Navigator>
</NavigationContainer>
</ApplicationProvider>
:
<AppNavigatorLanding />
}
谁有过这种经历?
【问题讨论】:
标签: react-native react-native-android react-navigation react-native-navigation react-navigation-drawer