我在开发React-Native遇到了一个与导航栏相关的问题。
问题:我在两个选项卡来回切换的时候,按下的瞬间选项背景会变成灰色,然后渐变消失,我开发使用的是安卓真机,版本为安卓15,我想去除掉或者修改掉这个点击切换的涟漪效果
库版本如下:
"@react-navigation/bottom-tabs": "^7.0.3",
"@react-navigation/native": "^7.0.2",
"@react-navigation/stack": "^7.0.2",
"@types/react-native-vector-icons": "^6.4.18",
"buffer": "^6.0.3",
"react": "18.3.1",
"react-native": "0.76.1",
"react-native-gesture-handler": "^2.21.0",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^4.1.0",
"react-native-tcp-socket": "^6.2.0",
"react-native-vector-icons": "^10.2.0",
"yarn": "^1.22.22"
导航部分代码如下
assets 是我用公共文件创建的图片变量,与问题无关
<Tab.Navigator
initialRouteName="Settings"
screenOptions={{
tabBarActiveTintColor: 'tomato', // 设置选中标签的颜色
tabBarInactiveTintColor: 'gray', // 设置未选中标签的颜色
tabBarInactiveBackgroundColor: '#fff',
tabBarStyle: { backgroundColor: '#fff' }, // 设置底部Tab背景色
tabBarHideOnKeyboard: true,
headerShown: false, // 不显示顶部导航栏
}}
>
<Tab.Screen
name="Settings"
component={Settings}
options={{
tabBarLabel: '配置',
tabBarIcon: ({ focused, color, size }) => (
<Image
source={focused
? assets.settingLogoActive // 选中状态的图标
: assets.settingLogoInactive} // 未选中状态的图标
style={[styles.icon,]}
/>
),
}}
/>
<Tab.Screen
name="MyPage"
component={MyPage}
options={{
tabBarLabel: '我的',
tabBarIcon: ({ focused, color, size }) => (
<Image
source={focused
? assets.mineLogoActive // 选中状态的图标
: assets.mineLogoInactive} // 未选中状态的图标
style={[styles.icon,]}
/>
),
}}
/>
</Tab.Navigator>
- 我试着修改过tabBarButton属性,自定义按钮事件,但是无法实现去除涟漪效果
我希望可以去除掉这个灰色的点击效果