小编Tom*_*d3z的帖子

React-Native:底部选项卡导航器:“tabBarOptions”已弃用。将选项迁移到“screenOptions”

我正在使用 React Native 开发一个移动应用程序,并在其中使用 Tab.Navigator - Tab.Screen 组件。在导航器中,我使用initialRouteNametabBarOptionsscreenOptions属性。在 javaScript 找到screenOptions之前,其他属性一切正常。然后它给我警报:

// Place the following in 'screenOptions' in your code to keep current behavior:

{
   "tabBarStyle": [
    {
      "display": "flex"
    },
    null
   ]
}
Run Code Online (Sandbox Code Playgroud)

有关更多详细信息,请参阅https://reactnavigation.org/docs/bottom-tab-navigator#options

我已经在我的代码中做到了:

const App = () => {
     return (
       <>
      <NavigationContainer>
        <Tab.Navigator
          initialRouteName='ExerciseScreensStack'
          tabBarOptions={{
            tabBarActiveTintColor: '#efb810',
            tabBarInactiveTintColor: 'black'
          }}
          screenOptions = {({ route }) =>({
            tabBarStyle: [
              {
                display: "flex"
              },
              null
            ],
        tabBarIcon: ({ color …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-tabnavigator

7
推荐指数
1
解决办法
8531
查看次数