【问题标题】:Why is react native navigation very slow in a class component very very slow为什么在类组件中反应本机导航非常慢非常非常慢
【发布时间】: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


    【解决方案1】:

    如果你能提供一个零食项目,看到问题会更有帮助。请看:https://snack.expo.io/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-17
      • 2015-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-12
      • 2015-06-14
      相关资源
      最近更新 更多