like this
e
xport default function BottonTab() {
const tabOffsetValue = useRef(new Animated.Value(0)).current;
return (
<View style={{flex: 1, backgroundColor: colors.primaryColor}}>
<Tab.Navigator
initialRouteName="Home"
screenOptions={{
showLabel: false,
tabBarShowLabel: false,
headerShown: false,
tabBarStyle: {
backgroundColor: colors.white,
position: 'absolute',
bottom: hp(0.51),
marginHorizontal: wp(2),
height: hp(8),
borderRadius: wp(2),
shadowColor: '#000',
shadowOpacity: 0.06,
shadowOffset: {
width: 10,
height: 10,
},
paddingHorizontal: 20,
},
}}>
<Tab.Screen
name={'Home'}
component={HomeScreen}
options={{
title: 'Home',
showLabel: false,
tabBarIcon: ({focused}) => (
<View>
<FontAwesome5
name="home"
size={wp(6)}
color={
focused ? colors.primaryColor : colors.secondaryTextColor
}
/>
</View>
),
}}
listeners={({navigation, route}) => ({
tabPress: e => {
Animated.spring(tabOffsetValue, {
toValue: getWidth() * 0,
useNativeDriver: true,
}).start();
},
})}
/>
<Tab.Screen
name={'HelpDiskScreen'}
component={HelpDiskScreen}
options={{
title: 'HelpDisk',
tabBarIcon: ({focused}) => (
<View>
<FontAwesome5
name="search"
size={wp(6)}
color={
focused ? colors.primaryColor : colors.secondaryTextColor
}
/>
</View>
),
}}
listeners={({navigation, route}) => ({
tabPress: e => {
Animated.spring(tabOffsetValue, {
toValue: getWidth() * 1.22,
useNativeDriver: true,
}).start();
},
})}
/>
<Tab.Screen
name={'ManageBookingScreen'}
component={ManageBookingScreen}
options={{
title: 'Manage',
tabBarIcon: ({focused}) => (
<View>
<Feather
name="settings"
size={wp(6)}
color={
focused ? colors.primaryColor : colors.secondaryTextColor
}
/>
</View>
),
}}
listeners={({navigation, route}) => ({
tabPress: e => {
Animated.spring(tabOffsetValue, {
toValue: getWidth() * 2.52,
useNativeDriver: true,
}).start();
},
})}
/>
<Tab.Screen
name={'ParkyingTypesScreen'}
component={ParkyingTypesScreen}
options={{
title: 'Parking',
tabBarIcon: ({focused}) => (
<View>
<FontAwesome5
name="bell"
size={wp(6)}
color={
focused ? colors.primaryColor : colors.secondaryTextColor
}
/>
</View>
),
}}
listeners={({navigation, route}) => ({
tabPress: e => {
Animated.spring(tabOffsetValue, {
toValue: getWidth() * 3.82,
useNativeDriver: true,
}).start();
},
})}
/>
</Tab.Navigator>
<Animated.View
style={{
width: getWidth(),
marginLeft: getWidth() * 0.58,
height: 2,
backgroundColor: colors.primaryColor,
bottom: hp(7),
borderRadius: 20,
transform: [{translateX: tabOffsetValue}],
}}></Animated.View>
</View>
);
}
navigation.navigate("Screen2")
before navigate to screen I will screen1 to Top of the stack and when I come from tab2 -> tab1 it will show me again screen1. Thanks. – Intent