@@ -7,55 +7,30 @@ import Error from './error/container'
77import YouAreReset from './you-are-reset'
88import Rekey from './rekey/container'
99import { headerNavigationOptions } from './header-area/container'
10- import { useFocusEffect , useNavigation } from '@react-navigation/core'
11- import { tabBarStyle } from '../../router-v2/common'
10+ import { useNavigation } from '@react-navigation/core'
1211import type { RouteProps } from '../../router-v2/route-params'
12+ import { tabBarStyle } from '../../router-v2/common'
1313
1414type SwitchProps = RouteProps < 'chatConversation' >
1515const hideTabBarStyle = { display : 'none' }
1616
17- // due to timing issues if we go between convos we can 'lose track' of focus in / out
18- // so instead we keep a count and only bring back the tab if we're entirely gone
19- let focusRefCount = 0
20-
21- let showDeferId : any = 0
22- const deferChangeTabOptions = ( tabNav , tabBarStyle , defer ) => {
23- if ( showDeferId ) {
24- clearTimeout ( showDeferId )
25- }
26- if ( tabNav ) {
27- if ( defer ) {
28- showDeferId = setTimeout ( ( ) => {
29- tabNav . setOptions ( { tabBarStyle} )
30- } , 1 )
31- } else {
32- tabNav . setOptions ( { tabBarStyle} )
33- }
34- }
35- }
36-
3717const Conversation = ( p : SwitchProps ) => {
3818 const navigation = useNavigation ( )
3919 let tabNav : any = navigation . getParent ( )
4020 if ( tabNav ?. getState ( ) ?. type !== 'tab' ) {
4121 tabNav = undefined
4222 }
4323
44- useFocusEffect (
45- React . useCallback ( ( ) => {
46- if ( ! Container . isPhone ) {
47- return
48- }
49- ++ focusRefCount
50- deferChangeTabOptions ( tabNav , hideTabBarStyle , false )
51- return ( ) => {
52- -- focusRefCount
53- if ( focusRefCount === 0 ) {
54- deferChangeTabOptions ( tabNav , tabBarStyle , true )
55- }
56- }
57- } , [ tabNav ] )
58- )
24+ // wait till the animation is over, works but maybe we can fix the resize thing later, its an issue in react-native-screens
25+ React . useEffect ( ( ) => {
26+ const unsubscribe = navigation . addListener ( 'transitionEnd' as any , ( ) => {
27+ tabNav ?. setOptions ( { tabBarStyle : hideTabBarStyle } )
28+ } )
29+ return ( ) => {
30+ unsubscribe ( )
31+ tabNav ?. setOptions ( { tabBarStyle} )
32+ }
33+ } , [ navigation , tabNav ] )
5934
6035 const conversationIDKey = p . route . params ?. conversationIDKey ?? Constants . noConversationIDKey
6136 const type = Container . useSelector ( state => {
@@ -107,6 +82,7 @@ const Conversation = (p: SwitchProps) => {
10782Conversation . navigationOptions = ( { route} ) => ( {
10883 ...headerNavigationOptions ( route ) ,
10984 needsSafe : true ,
85+ presentation : undefined ,
11086} )
11187
11288const ConversationMemoed = React . memo ( Conversation )
0 commit comments