diff --git a/src/app.tsx b/src/app.tsx index 35c4fd2..532c774 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -7,7 +7,6 @@ import { lightTheme, darkTheme } from './theme'; import { Meme, Tag } from './database'; import NavigationContainer from './navigation'; import { SettingsProvider } from './contexts/settings'; -import ActionButton from './components/actionButton'; function App(): JSX.Element { const colorScheme = useColorScheme(); @@ -24,7 +23,6 @@ function App(): JSX.Element { backgroundColor={theme.colors.background} /> - diff --git a/src/components/actionButton.tsx b/src/components/actionButton.tsx index 5dafff0..51c62bc 100644 --- a/src/components/actionButton.tsx +++ b/src/components/actionButton.tsx @@ -5,7 +5,7 @@ import { noOp } from '../constants'; const styles = StyleSheet.create({ fab: { - marginBottom: 100, + paddingBottom: 90, }, }); diff --git a/src/navigation.tsx b/src/navigation.tsx index a7e2f7e..2f9dbd6 100644 --- a/src/navigation.tsx +++ b/src/navigation.tsx @@ -7,97 +7,104 @@ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { BottomNavigation, useTheme } from 'react-native-paper'; import { Home, Search, Tags, Settings } from './screens'; +import ActionButton from './components/actionButton'; function NavigationContainer() { const TabNavigator = createBottomTabNavigator(); const theme = useTheme(); + const [showFab, setShowFab] = React.useState(true); + return ( - - ( - { - const event = navigation.emit({ - type: 'tabPress', - target: route.key, - canPreventDefault: true, - }); - if (event.defaultPrevented) { - preventDefault(); - } else { - navigation.dispatch({ - ...CommonActions.navigate(route.name, route.params), - target: state.key, + <> + + ( + { + const event = navigation.emit({ + type: 'tabPress', + target: route.key, + canPreventDefault: true, }); - } - }} - renderIcon={({ route, focused, color }) => { - const { options } = descriptors[route.key]; - if (options.tabBarIcon) { - return options.tabBarIcon({ focused, color, size: 24 }); - } - }} - getLabelText={({ route }) => { - const { options } = descriptors[route.key]; - return options.title ?? route.name; + if (event.defaultPrevented) { + preventDefault(); + } else { + navigation.dispatch({ + ...CommonActions.navigate(route.name, route.params), + target: state.key, + }); + } + setShowFab(route.name !== 'Settings'); + }} + renderIcon={({ route, focused, color }) => { + const { options } = descriptors[route.key]; + if (options.tabBarIcon) { + return options.tabBarIcon({ focused, color, size: 24 }); + } + }} + getLabelText={({ route }) => { + const { options } = descriptors[route.key]; + return options.title ?? route.name; + }} + /> + )}> + ( + + ), }} /> - )}> - ( - - ), - }} - /> - ( - - ), - }} - /> - ( - - ), - }} - /> - ( - - ), - }} - /> - - + ( + + ), + }} + /> + ( + + ), + }} + /> + ( + + ), + }} + /> + + + {showFab && } + ); }