材质顶部选项卡不适用于nativeWind

问题描述 投票:0回答:1

我将

@react-navigation/material-top-tabs
expo-router
nativeWind
一起使用,但选项卡样式无法正常工作。当我从 babel.config.js 中删除 Presents 键时,顶部选项卡可以工作。

我的 babel.config.js 文件

module.exports = function (api) {
  api.cache(true);
  return {
    presets: [
      'nativewind/babel',
      ['babel-preset-expo', { jsxImportSource: 'nativewind' }]
    ],
    plugins: ['react-native-reanimated/plugin']
  };
};

react-native expo expo-router nativewind
1个回答
0
投票

尝试使用

@react-navigation/material-top-tabs

const Tab = createMaterialTopTabNavigator()
 <Tab.Navigator
        screenOptions={{
          tabBarActiveTintColor: 'black',
          tabBarIndicatorStyle: {
            backgroundColor: 'black',
            height: 2
          },
          tabBarScrollEnabled: true,
          tabBarLabelStyle: { fontSize: 14 },
          tabBarItemStyle: { width: 100, },
          tabBarStyle: {
            height: 46,
          },
        }}

      >
        <Tab.Screen name="HOME" component={Screen1} />
        <Tab.Screen name="SETTING" component={Screen2} />
      </Tab.Navigator>

它对我有用,希望有帮助

© www.soinside.com 2019 - 2024. All rights reserved.