This can be achieved without a custom bar using screenOptions function and then standard styles. Like using tabBarStyle and setting position to absolute and setting margins. This provides full control of styling the bar and based on the route too when needed.
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarActiveTintColor: 'black',
tabBarInactiveTintColor: 'white',
tabBarActiveBackgroundColor: 'yellow',
tabBarInactiveBackgroundColor: 'black',
tabBarStyle: {
position: 'absolute',
height: 60,
margin: 10,
borderRadius: 30,
borderTopWidth: 0,
backgroundColor: 'black',
},
tabBarItemStyle: {
margin: 10,
borderRadius: 30,
},
tabBarIconStyle: { display: 'none' },
tabBarLabel: ({ focused, color }) => {
let icon = '';
switch (route.name) {
case 'Home':
icon = 'home';
break;
case 'Profile':
icon = 'account';
break;
case 'Settings':
icon = 'tools';
break;
}
return (
<View
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}}>
<MaterialCommunityIcons name={icon} color={color} size={24} />
{focused && <Text>{route.name}</Text>}
</View>
);
},
})}>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Profile" component={Profile} />
<Tab.Screen name="Settings" component={Settings} />
</Tab.Navigator>