Skip to content

Commit

Permalink
simplified bottomTabNav hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
philipye314 committed Apr 11, 2024
1 parent 5e6b95f commit 742f58e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useNavigation } from 'expo-router';
import { useEffect } from 'react';

export default function HideBottomNav() {
export default function ShowBottomNav() {
const navigation = useNavigation();
useEffect(() => {
navigation.addListener('blur', async () => {
navigation.addListener('focus', async () => {
navigation.getParent()?.setOptions({
tabBarStyle: {
height: 90,
Expand All @@ -14,7 +14,7 @@ export default function HideBottomNav() {
},
});
});
navigation.addListener('focus', async () => {
navigation.addListener('blur', async () => {
navigation.getParent()?.setOptions({
tabBarStyle: { maxHeight: 0, overflow: 'hidden' },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import CaseSummaryCard from '../../../../Components/CaseSummaryCard/CaseSummaryC
import EducationalBar from '../../../../Components/EducationalBar/EducationalBar';
import EligibilityCard from '../../../../Components/EligibilityCard/EligibilityCard';
import FormsCard from '../../../../Components/FormsCard/FormsCard';
import HideBottomNav from '../../../../Components/HideBottomNav/HideBottomNav';
import { getCaseStatus, getCaseById } from '../../../../supabase/queries/cases';
import { Case, Eligibility } from '../../../../types/types';

Expand Down Expand Up @@ -45,8 +44,6 @@ function CaseScreen() {
});
}, [navigation]);

HideBottomNav();

return (
<View style={styles.container}>
{isLoading || caseData === undefined ? (
Expand Down
6 changes: 3 additions & 3 deletions src/app/(BottomTabNavigation)/AllCases/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as Linking from 'expo-linking';
import { router } from 'expo-router';
import React, { useContext, useEffect, useState } from 'react';
import React, { useContext, useState } from 'react';
import { FlatList, Text, View, TouchableOpacity } from 'react-native';

import styles from './styles';
import Camera from '../../../../assets/camera.svg';
import CaseCard from '../../../Components/CaseCard/CaseCard';
import HideBottomNav from '../../../Components/HideBottomNav/HideBottomNav';
import ShowBottomNav from '../../../Components/ShowBottomNav/ShowBottomNav';
import { useSession } from '../../../context/AuthContext';
import { CaseContext } from '../../../context/CaseContext';
import {
Expand Down Expand Up @@ -58,7 +58,7 @@ function CasesScreen() {
}
}

//HideBottomNav();
ShowBottomNav();

return (
<View style={styles.container}>
Expand Down
2 changes: 2 additions & 0 deletions src/app/(BottomTabNavigation)/Profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import RedTrash from '../../../../assets/red-trash.svg';
import Reset from '../../../../assets/reset.svg';
import SignOut from '../../../../assets/sign-out.svg';
import WhiteRightCarrot from '../../../../assets/white-right-carrot.svg';
import ShowBottomNav from '../../../Components/ShowBottomNav/ShowBottomNav';
import { useSession } from '../../../context/AuthContext';

function ProfileScreen() {
Expand All @@ -23,6 +24,7 @@ function ProfileScreen() {
useEffect(() => {
navigation.addListener('focus', async () => {});
}, [navigation]);
ShowBottomNav();

return (
<View style={styles.container}>
Expand Down
2 changes: 2 additions & 0 deletions src/app/(BottomTabNavigation)/Updates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import React from 'react';
import { Text, View } from 'react-native';

import styles from './styles';
import ShowBottomNav from '../../../Components/ShowBottomNav/ShowBottomNav';

function ProfileScreen() {
ShowBottomNav();
return (
<View style={styles.container}>
<Text>This is the /Updates/index update screen!</Text>
Expand Down

0 comments on commit 742f58e

Please sign in to comment.