React Native 如果fiveElements中没有更改,为什么我的选项卡屏幕会重新呈现?

bxfogqkk  于 2023-03-19  发布在  React
关注(0)|答案(1)|浏览(87)
<Tab.Screen 
        name="Sheet" 
        children={()=><SheetScreen fiveElements={fiveElements}/>}
        options={{
          tabBarLabel: 'Sheet',
          tabBarIcon: ({ color, size }) => (
            <MaterialCommunityIcons name="information-outline" color={color} size={size} />
          ),
        }}
/>

如果fiveElements状态没有变化,为什么我的选项卡屏幕会重新呈现?

dzjeubhm

dzjeubhm1#

最好是这样使用屏幕:

<Tab.Screen 
        name="Sheet" 
        options={{
          tabBarLabel: 'Sheet',
          tabBarIcon: ({ color, size }) => (
            <MaterialCommunityIcons name="information-outline" color={color} size={size} />
          ),
        }}
> 
props => <SheetScreen {...props} fiveElements={fiveElements}/>
</Tab.Screen>

相关问题