androidreact-nativeexpo

React Native Expo - android ripple effect


Im currently working in a react native expo project, where i used default HepticTab and PlatformPressable for the bottom nav bar. The issue is im getting the android ripple effect in my mobile, even after applying android_ripple={{ foreground: true }} this in the HepticTab. And also i tried giving pressColor='transparent', pressOpacity={0} in both HepticTab and my _layout.jsx separately, but still it is not working. Can someone help me on this!

Thanks in advance.


Solution

  • I found the answer for this myself. I used Tabs.Screen in which i had options and tabBarIcon, so i added tabBarButton and added props and styling

    <Tabs.Screen
            name="index"
            options={{
              title: 'Home',
              tabBarIcon: ({ color, focused }) => focused ? <Entypo name="home" color={color} size={24} /> : <AntDesign name='home' color={color} size={22} />,
              tabBarButton: (props) => ( // this is what i added
                <TouchableOpacity
                  {...props}
                  activeOpacity={1} // no opacity change
                  style={[props.style, { backgroundColor: 'transparent' }]}
                />
              ),
            }}
          />
    

    like this I have added and it worked.