Add actionButton conditional hiding
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import { lightTheme, darkTheme } from './theme';
|
|||||||
import { Meme, Tag } from './database';
|
import { Meme, Tag } from './database';
|
||||||
import NavigationContainer from './navigation';
|
import NavigationContainer from './navigation';
|
||||||
import { SettingsProvider } from './contexts/settings';
|
import { SettingsProvider } from './contexts/settings';
|
||||||
import ActionButton from './components/actionButton';
|
|
||||||
|
|
||||||
function App(): JSX.Element {
|
function App(): JSX.Element {
|
||||||
const colorScheme = useColorScheme();
|
const colorScheme = useColorScheme();
|
||||||
@@ -24,7 +23,6 @@ function App(): JSX.Element {
|
|||||||
backgroundColor={theme.colors.background}
|
backgroundColor={theme.colors.background}
|
||||||
/>
|
/>
|
||||||
<NavigationContainer />
|
<NavigationContainer />
|
||||||
<ActionButton />
|
|
||||||
</SafeAreaProvider>
|
</SafeAreaProvider>
|
||||||
</SettingsProvider>
|
</SettingsProvider>
|
||||||
</PaperProvider>
|
</PaperProvider>
|
||||||
|
@@ -5,7 +5,7 @@ import { noOp } from '../constants';
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
fab: {
|
fab: {
|
||||||
marginBottom: 100,
|
paddingBottom: 90,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -7,12 +7,16 @@ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
|
|||||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||||
import { BottomNavigation, useTheme } from 'react-native-paper';
|
import { BottomNavigation, useTheme } from 'react-native-paper';
|
||||||
import { Home, Search, Tags, Settings } from './screens';
|
import { Home, Search, Tags, Settings } from './screens';
|
||||||
|
import ActionButton from './components/actionButton';
|
||||||
|
|
||||||
function NavigationContainer() {
|
function NavigationContainer() {
|
||||||
const TabNavigator = createBottomTabNavigator();
|
const TabNavigator = createBottomTabNavigator();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const [showFab, setShowFab] = React.useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<NavigationContainerBase
|
<NavigationContainerBase
|
||||||
theme={{
|
theme={{
|
||||||
dark: theme.dark,
|
dark: theme.dark,
|
||||||
@@ -47,6 +51,7 @@ function NavigationContainer() {
|
|||||||
target: state.key,
|
target: state.key,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setShowFab(route.name !== 'Settings');
|
||||||
}}
|
}}
|
||||||
renderIcon={({ route, focused, color }) => {
|
renderIcon={({ route, focused, color }) => {
|
||||||
const { options } = descriptors[route.key];
|
const { options } = descriptors[route.key];
|
||||||
@@ -98,6 +103,8 @@ function NavigationContainer() {
|
|||||||
/>
|
/>
|
||||||
</TabNavigator.Navigator>
|
</TabNavigator.Navigator>
|
||||||
</NavigationContainerBase>
|
</NavigationContainerBase>
|
||||||
|
{showFab && <ActionButton />}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user