diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-06-18 01:15:02 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-06-18 01:15:02 -0700 |
commit | 9e752233070624c246426ffad422e50448318e57 (patch) | |
tree | 61abd233d2587ed41cdd512fa7114ad46324c769 /src | |
parent | 11fe0a31a7d9bba4f9fc8cdc79ef9896f4e1decc (diff) |
Fix bottom tab permanently hidden issue
Diffstat (limited to 'src')
-rw-r--r-- | src/components/comments/ZoomInCropper.tsx | 20 |
1 files changed, 14 insertions, 6 deletions
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<ZoomInCropperProps> = ({ const {screenType, title, image} = route.params; const [aspectRatio, setAspectRatio] = useState<number>(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) { |