import {useTheme} from 'react-native-paper'; import {TouchableOpacity, View} from "react-native"; import {useSafeAreaInsets} from "react-native-safe-area-context"; // tab bar inspired by https://stackoverflow.com/a/64028171 export function AMUITabBar({state, descriptors, navigation}) { const theme = useTheme(); const insets = useSafeAreaInsets(); return ( {state.routes.map((route, index) => { const {options} = descriptors[route.key]; const isFocused = state.index === index; const onPress = () => { const event = navigation.emit({ type: 'tabPress', target: route.key, }); if (!isFocused && !event.defaultPrevented) { navigation.navigate(route.name); } }; return ( {options.tabBarIcon({color: isFocused ? theme.colors.primary : theme.colors.outline, size: 24})} ); })} ); }