From 9e752233070624c246426ffad422e50448318e57 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 18 Jun 2021 01:15:02 -0700 Subject: Fix bottom tab permanently hidden issue --- src/components/comments/ZoomInCropper.tsx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/components/comments') diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx index 4e8f9e7c..54acc26e 100644 --- a/src/components/comments/ZoomInCropper.tsx +++ b/src/components/comments/ZoomInCropper.tsx @@ -1,6 +1,7 @@ import {RouteProp} from '@react-navigation/core'; +import {useFocusEffect} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; -import React, {useEffect, useState} from 'react'; +import React, {useCallback, useEffect, useState} from 'react'; import {Dimensions, Image, StyleSheet, TouchableOpacity} from 'react-native'; import {normalize} from 'react-native-elements'; import ImageZoom from 'react-native-image-pan-zoom'; @@ -26,11 +27,18 @@ export const ZoomInCropper: React.FC = ({ const {screenType, title, image} = route.params; const [aspectRatio, setAspectRatio] = useState(1); - useEffect(() => { - navigation.dangerouslyGetParent()?.setOptions({ - tabBarVisible: false, - }); - }, []); + useFocusEffect( + useCallback(() => { + navigation.dangerouslyGetParent()?.setOptions({ + tabBarVisible: false, + }); + return () => { + navigation.dangerouslyGetParent()?.setOptions({ + tabBarVisible: true, + }); + }; + }, [navigation]), + ); useEffect(() => { if (image.sourceURL) { -- cgit v1.2.3-70-g09d2