【问题标题】:How to prevent re rendering in react-native material-top-tabs-navigatior?如何防止在 react-native material-top-tabs-navigator 中重新渲染?
【发布时间】:2022-06-15 21:36:56
【问题描述】:

我正在使用材质顶部标签导航器 https://reactnavigation.org/docs/material-top-tab-navigator

当我切换标签时,组件总是被重新渲染。 如何防止重新渲染?

这是我的代码 请帮帮我!!!!

const Menu = () => {
   return (...)
}

const Info = () => {
   return (...)
}

const Review = () => {
   return (...)
}


       <Tab.Navigator 
           screenOptions={{
               tabBarScrollEnabled: false,
               tabBarStyle: { backgroundColor: '#FFFFFF' },
               tabBarPressOpacity: true
           }}
           style={styles.tabBar}
       >
            <Tab.Screen
               name="Menu"
               component={Menu}
               options={{
                   tabBarShowLabel: false,
                   tabBarIcon: ({ forcused, color }) => {
                   return <Text style={styles.tabBarText}>메뉴</Text>;
                   },
               }}
           />
           <Tab.Screen
               name="Info"
               component={Info}
               options={{
                   tabBarShowLabel: false,
                   tabBarIcon: ({ forcused, color }) => {
                   return  <Text style={styles.tabBarText}>정보</Text>;
                   },
               }}
           />
           <Tab.Screen
               name="Review"
               component={Review}
               options={{
                   tabBarShowLabel: false,
                   tabBarIcon: ({ forcused, color }) => {
                   return  <Text style={styles.tabBarText}>리뷰</Text>;
                   },
               }}
           />
       </Tab.Navigator>

【问题讨论】:

    标签: reactjs react-native


    【解决方案1】:

    你解决了吗?我也遇到了同样的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-03
      • 2020-11-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-04
      • 2016-06-01
      • 1970-01-01
      相关资源
      最近更新 更多