Skip to content

fix(iOS, Paper, Fabric): previous tab visible on tab-change request#2823

Closed
kkafar wants to merge 7 commits intomainfrom
@kkafar/spf-old-screen-visible-on-tab-change
Closed

fix(iOS, Paper, Fabric): previous tab visible on tab-change request#2823
kkafar wants to merge 7 commits intomainfrom
@kkafar/spf-old-screen-visible-on-tab-change

Conversation

@kkafar
Copy link
Copy Markdown
Member

@kkafar kkafar commented Apr 2, 2025

@kkafar kkafar force-pushed the @kkafar/spf-old-screen-visible-on-tab-change branch from 8324981 to 7bcbbc9 Compare April 4, 2025 09:56
@kkafar kkafar force-pushed the @kkafar/spf-old-screen-visible-on-tab-change branch from 2d39ea1 to 6028aa8 Compare April 8, 2025 13:54
@maciekstosio maciekstosio changed the title fix(Android,Paper): previous tab visible on tab-change request fix(iOS,Paper): previous tab visible on tab-change request Apr 17, 2025
@maciekstosio maciekstosio changed the title fix(iOS,Paper): previous tab visible on tab-change request fix(iOS, Paper, Fabric): previous tab visible on tab-change request Apr 24, 2025
@maciekstosio
Copy link
Copy Markdown
Contributor

maciekstosio commented Apr 25, 2025

We spend some time with @kkafar investigating this issue. Unfortunately we weren't able to resolve this issue, and it seems that's how UIKit works and there isn't really something we can do about it.

The problem

Not working* Working*
Not.working.mov
Working.mov

*This is our assumption on how expected result should look like, it might be the other way around - haven't reproduce it on just UI Kit

Testing

I branched from this PR and added some logs on native side, you can find it on: https://github.com/software-mansion/react-native-screens/tree/%40maciekstosio/Investigate-2823-issue-

When testing it's good to clear the logs after opening form sheet - we log a lot this is useful to narrow the scope.

This is what's going on in both cases:

SCR-20250425-jior

Not working case

  • react-navigation updates its state
  • We get commit transaction mountingTransactionWillMount that says form sheet is detached and new screen is attached
  • New screen is mounted but does not have a window yet (didMoveToWindow)
  • In mountingTransactionDidMount we SCHEDULE updateContainer for the Screen
  • In mountingTransactionDidMount we SCHEDULE updateContainer for the FormSheet
    <-- Same for both until now --->
  • We get some empty transactions
  • We execute scheduled updateContainer for the new Screen, but the Screen doesn't have the window so we skip setPushControllers <--- this is the problem - that we don't have a window in this case and we skip setting new controllers, thus delay the transition
  • We execute scheduled updateContainer for the form sheet, setModalViewControllers does its logic and the transition (animation) starts
  • Old screen (in nested stack) is moved to window (didMoveToWindow) - this is the moment when the iOS actually finished switching tab - it runs updateContainer in nested stack, but because fromSheet animation is ongoing, we don't update the controllers (start transition form one Screen to another in the bottom tab's stack)
  • When animation of the from sheet is finished we run updateContainer that runs setPushControllers and starts transition

Working case

  • react-navigation updates its state
  • We get commit transaction mountingTransactionWillMount that says form sheet is detached and new screen is attached
  • New screen is mounted but does not have a window yet (didMoveToWindow)
  • In mountingTransactionDidMount we SCHEDULE updateContainer for the Screen
  • In mountingTransactionDidMount we SCHEDULE updateContainer for the FormSheet
    <-- Same for both until now --->
  • Old screen (in nested stack) is moved to window (didMoveToWindow) - this is the moment when the iOS actually finished switching tab - it runs updateContainer in nested stack
  • While running updateContainer we see that there is newly attached screen, and because outer screen is attached to window, we have a window, thus we set controllers with animation in setPushControllers - start transition between screens
  • Scheduled updateContainers start, the first one connected to the new screen is skipped as nothing changes, the second runs setModalControllers that runs transition of formSheet
Logs from NOT working case
[tag=164] mountingTransactionWillMount, revision: 124
!!! None matched, displaing all !!!
mutation type=16, parent=852, oldShadowTag=800, newShadowTag=800
mutation type=16, parent=852, oldShadowTag=848, newShadowTag=848
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 124
!!! None matched, displaing all !!!
mutation type=16, parent=852, oldShadowTag=800, newShadowTag=800
mutation type=16, parent=852, oldShadowTag=848, newShadowTag=848
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 124
!!! None matched, displaing all !!!
mutation type=16, parent=852, oldShadowTag=800, newShadowTag=800
mutation type=16, parent=852, oldShadowTag=848, newShadowTag=848
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 124
!!! None matched, displaing all !!!
mutation type=16, parent=852, oldShadowTag=800, newShadowTag=800
mutation type=16, parent=852, oldShadowTag=848, newShadowTag=848
[tag=118] mountingTransactionDidMount END
'STACK ROUTER', 'NAVIGATE', { source: 'RootSheet-SmdUIUa-ex-Eo9RiAr4y7',
  type: 'NAVIGATE',
  payload: 
   { name: 'TabThreeStackScreenTwo',
     params: undefined,
     merge: undefined } }
'TAB ROUTER', 'NAVIGATE', { source: 'RootSheet-SmdUIUa-ex-Eo9RiAr4y7',
  type: 'NAVIGATE',
  payload: 
   { name: 'TabThreeStackScreenTwo',
     params: undefined,
     merge: undefined } }
'STACK ROUTER', 'NAVIGATE', { source: 'RootSheet-SmdUIUa-ex-Eo9RiAr4y7',
  type: 'NAVIGATE',
  payload: 
   { name: 'TabThreeStackScreenTwo',
     params: undefined,
     merge: undefined } }
Render ScreenStack.tsx
Render ScreenStack.tsx
'Navigation State Change', { stale: false,
  type: 'stack',
  key: 'stack-pXPEBWrjs7HItiibrXv8j',
  index: 0,
  routeNames: [ 'TabsHost', 'RootSheet' ],
  preloadedRoutes: [],
  routes: 
   [ { key: 'TabsHost-aLMlwpw0OlOKM0eB-IXYz',
       name: 'TabsHost',
       params: undefined,
       state: 
        { stale: false,
          type: 'tab',
          key: 'tab-qCGYra8KDGhwOuVrfVmi7',
          index: 2,
          routeNames: [ 'TabOne', 'TabTwo', 'TabThree' ],
          history: 
           [ { type: 'route', key: 'TabOne-GD2IopAEGUBBrr_hPvTLQ' },
             { type: 'route', key: 'TabThree-jvFCVGRENqjL5AAjcQtiE' } ],
          routes: 
           [ { name: 'TabOne',
               key: 'TabOne-GD2IopAEGUBBrr_hPvTLQ',
               params: undefined },
             { name: 'TabTwo',
               key: 'TabTwo-f1kcrFxAllgLHrsW5nnC2',
               params: undefined },
             { name: 'TabThree',
               key: 'TabThree-jvFCVGRENqjL5AAjcQtiE',
               params: undefined,
               state: 
                { stale: false,
                  type: 'stack',
                  key: 'stack-IbhbHkHW9_BMLWHOQiE_n',
                  index: 1,
                  routeNames: [ 'TabThreeStackScreenOne', 'TabThreeStackScreenTwo' ],
                  preloadedRoutes: [],
                  routes: 
                   [ { key: 'TabThreeStackScreenOne-PX9AhmVR4LrRdyvpNXx-w',
                       name: 'TabThreeStackScreenOne',
                       params: undefined,
                       path: undefined },
                     { key: 'TabThreeStackScreenTwo-1ZOQGjLeGBpEdPytOY_DF',
                       name: 'TabThreeStackScreenTwo',
                       path: undefined,
                       params: undefined } ] } } ],
          preloadedRouteKeys: [ 'TabThree-jvFCVGRENqjL5AAjcQtiE' ] } } ] }
[tag=164] mountingTransactionWillMount, revision: 125
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=856, newShadowTag=0
mutation type=16, parent=164, oldShadowTag=162, newShadowTag=162
mutation type=4, parent=164, oldShadowTag=0, newShadowTag=868
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 125
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=856, newShadowTag=0
mutation type=16, parent=164, oldShadowTag=162, newShadowTag=162
mutation type=4, parent=164, oldShadowTag=0, newShadowTag=868
[tag=118] mountingTransactionWillMount END
Screen [856] didMoveToWindow (null)
NavigationContainer [36] updateContainer SYNC
NavigationContainer [36] updateContainer SYNC
NavigationContainer [36] updateContainer to 172
[tag=164] RNSScreenStack mountChildComponentView with tag=868
[tag=164] mountingTransactionDidMount START, revision: 125
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=856, newShadowTag=0
mutation type=16, parent=164, oldShadowTag=162, newShadowTag=162
mutation type=4, parent=164, oldShadowTag=0, newShadowTag=868
[tag=164] RNSScreenStackView mountingTransactionDidMount SCHEDULE async update, revision: 125
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 125
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=856, newShadowTag=0
[tag=118] RNSScreenStackView mountingTransactionDidMount SCHEDULE async update, revision: 125
[tag=118] mountingTransactionDidMount END
[tag=164] mountingTransactionWillMount, revision: 126
!!! None matched, displaing all !!!
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 126
!!! None matched, displaing all !!!
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 126
!!! None matched, displaing all !!!
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 126
!!! None matched, displaing all !!!
[tag=118] mountingTransactionDidMount END
[tag=164] RNSScreenStackView mountingTransactionDidMount EXECUTE async update, revision: 125
[tag=164] RNSScreenStackView maybeAddToParentAndUpdateContainer 1 window = (null)
[tag=164] RNScreenStack updateContainer ref=<RNSScreenStackView: 0x31cbc60f0; frame = (0 97.6667; 393 671.333); tag = 164; gestureRecognizers = <NSArray: 0x6000025b42d0>; layer = <CALayer: 0x600002bb9340>>
[tag=164]RNSScreenStack setPushViewControllers vc not attached to window, vc = <RNSScreenStackView: 0x31cbc60f0; frame = (0 97.6667; 393 671.333); tag = 164; gestureRecognizers = <NSArray: 0x6000025b42d0>; layer = <CALayer: 0x600002bb9340>>
[tag=164]RNSScreenStack setModalViewControllers controlers did not changed !!
[tag=164] RNScreenStack current controllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack current presentation ctrls tag=0, ref=<RNSScreen: 0x320ca5000>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=868, ref=<RNSScreen: 0x320ca7600>
[tag=164] RNScreenStack updateContainer END
[tag=118] RNSScreenStackView mountingTransactionDidMount EXECUTE async update, revision: 125
[tag=118] RNSScreenStackView maybeAddToParentAndUpdateContainer 1 window = <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x60000255e250>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=118] RNScreenStack updateContainer ref=<RNSScreenStackView: 0x31cc28990; frame = (0 0; 393 852); tag = 118; gestureRecognizers = <NSArray: 0x6000025b5320>; layer = <CALayer: 0x600002b9ae80>>
[tag=118]RNSScreenStack setPushViewControllers controllers did not change
[tag=118] RNScreenStack current controllers tag=116, ref=<RNSScreen: 0x3209f3a00>
[tag=118] RNScreenStack current presentation ctrls tag=0, ref=<RNSScreen: 0x320ca5000>
[tag=118] RNScreenStack updateContainer new setPushControllers tag=116, ref=<RNSScreen: 0x3209f3a00>
[tag=118] <---- ANIMATION STARTED ---->
Transition coordinators: <RNSNavigationController: 0x31fe3ee00> <_UIViewControllerTransitionCoordinator: 0x6000030d1300>
From ViewController: RNSScreen tag=0 <RNSScreen: 0x320ca5000>
To ViewController: UIViewController tag=0 <UIViewController: 0x154f1f870>
[tag=118] </---- ANIMATION STARTED ---->
[tag=118] RNScreenStack updateContainer END
Screen [162] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x60000255e250>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=164] RNSScreenStackView didMoveToWindow, schedule container update
[tag=164] RNSScreenStackView maybeAddToParentAndUpdateContainer 1 window = <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x60000255e250>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=164] RNScreenStack updateContainer ref=<RNSScreenStackView: 0x31cbc60f0; frame = (0 97.6667; 393 671.333); tag = 164; gestureRecognizers = <NSArray: 0x6000025b42d0>; layer = <CALayer: 0x600002bb9340>>
[tag=164] setPushViewControllers; ONGOING animation detected
[tag=164] setPushViewControllers; ONGOING animation detected; schedule update
Transition coordinators: navctrl <RNSNavigationController: 0x320bb3000> transitionCoord <_UIViewControllerTransitionCoordinator: 0x6000030d1300>
From ViewController: RNSScreen tag=0 <RNSScreen: 0x320ca5000>
To ViewController: UIViewController tag=0 <UIViewController: 0x154f1f870>
[tag=164]RNSScreenStack setModalViewControllers controlers did not changed !!
[tag=164] RNScreenStack current controllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack current presentation ctrls tag=0, ref=<RNSScreen: 0x320ca5000>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=868, ref=<RNSScreen: 0x320ca7600>
[tag=164] <---- ANIMATION STARTED ---->
Transition coordinators: <RNSNavigationController: 0x320bb3000> <_UIViewControllerTransitionCoordinator: 0x6000030d1300>
From ViewController: RNSScreen tag=0 <RNSScreen: 0x320ca5000>
To ViewController: UIViewController tag=0 <UIViewController: 0x154f1f870>
[tag=164] </---- ANIMATION STARTED ---->
[tag=164] RNScreenStack updateContainer END
Screen [172] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x60000255e250>; layer = <UIWindowLayer: 0x60000240cd80>>
Screen [34] didMoveToWindow (null)
[tag=164] RNSScreenStackView setPushControllers after completion of existing transition; run updateContainer SYNC
[tag=164] RNScreenStack updateContainer ref=<RNSScreenStackView: 0x31cbc60f0; frame = (0 97.6667; 393 671.333); tag = 164; gestureRecognizers = <NSArray: 0x6000025b42d0>; layer = <CALayer: 0x600002bb9340>>
[tag=164] setPushViewControllers; NO ongoing animation detected; proceeding with VC update
[tag=164]RNSScreenStack setModalViewControllers controlers did not changed !!
[tag=164] RNScreenStack current controllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack current controllers tag=868, ref=<RNSScreen: 0x320ca7600>
[tag=164] RNScreenStack current presentation ctrls tag=0, ref=(null)
[tag=164] RNScreenStack updateContainer new setPushControllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=868, ref=<RNSScreen: 0x320ca7600>
[tag=164] <---- ANIMATION STARTED ---->
Transition coordinators: <RNSNavigationController: 0x320bb3000> <_UIViewControllerTransitionCoordinator: 0x6000030935c0>
From ViewController: RNSScreen tag=162 <RNSScreen: 0x320bd5c00>
To ViewController: RNSScreen tag=868 <RNSScreen: 0x320ca7600>
[tag=164] </---- ANIMATION STARTED ---->
[tag=164] RNScreenStack updateContainer END
Screen [162] didMoveToWindow (null)
Screen [162] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x600002573960>; layer = <UIWindowLayer: 0x60000240cd80>>
Screen [868] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x600002573960>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=164] mountingTransactionWillMount, revision: 127
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 127
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 127
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 127
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=118] mountingTransactionDidMount END
[tag=164] mountingTransactionWillMount, revision: 128
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 128
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 128
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 128
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=118] mountingTransactionDidMount END
[tag=164] mountingTransactionWillMount, revision: 129
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 129
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 129
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 129
mutation type=16, parent=164, oldShadowTag=868, newShadowTag=868
[tag=118] mountingTransactionDidMount END
Screen [162] didMoveToWindow (null)
Logs from working case
[tag=164] mountingTransactionWillMount, revision: 22
!!! None matched, displaing all !!!
mutation type=16, parent=288, oldShadowTag=236, newShadowTag=236
mutation type=16, parent=288, oldShadowTag=284, newShadowTag=284
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 22
!!! None matched, displaing all !!!
mutation type=16, parent=288, oldShadowTag=236, newShadowTag=236
mutation type=16, parent=288, oldShadowTag=284, newShadowTag=284
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 22
!!! None matched, displaing all !!!
mutation type=16, parent=288, oldShadowTag=236, newShadowTag=236
mutation type=16, parent=288, oldShadowTag=284, newShadowTag=284
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 22
!!! None matched, displaing all !!!
mutation type=16, parent=288, oldShadowTag=236, newShadowTag=236
mutation type=16, parent=288, oldShadowTag=284, newShadowTag=284
[tag=118] mountingTransactionDidMount END
'STACK ROUTER', 'NAVIGATE', { source: 'RootSheet-mgxWcfJXDcNkpI2eldUMZ',
  type: 'NAVIGATE',
  payload: 
   { name: 'TabThreeStackScreenTwo',
     params: undefined,
     merge: undefined } }
'TAB ROUTER', 'NAVIGATE', { source: 'RootSheet-mgxWcfJXDcNkpI2eldUMZ',
  type: 'NAVIGATE',
  payload: 
   { name: 'TabThreeStackScreenTwo',
     params: undefined,
     merge: undefined } }
'STACK ROUTER', 'NAVIGATE', { source: 'RootSheet-mgxWcfJXDcNkpI2eldUMZ',
  type: 'NAVIGATE',
  payload: 
   { name: 'TabThreeStackScreenTwo',
     params: undefined,
     merge: undefined } }
Render ScreenStack.tsx
Render ScreenStack.tsx
'Navigation State Change', { stale: false,
  type: 'stack',
  key: 'stack-pXPEBWrjs7HItiibrXv8j',
  index: 0,
  routeNames: [ 'TabsHost', 'RootSheet' ],
  preloadedRoutes: [],
  routes: 
   [ { key: 'TabsHost-aLMlwpw0OlOKM0eB-IXYz',
       name: 'TabsHost',
       params: undefined,
       state: 
        { stale: false,
          type: 'tab',
          key: 'tab-qCGYra8KDGhwOuVrfVmi7',
          index: 2,
          routeNames: [ 'TabOne', 'TabTwo', 'TabThree' ],
          history: 
           [ { type: 'route', key: 'TabOne-GD2IopAEGUBBrr_hPvTLQ' },
             { type: 'route', key: 'TabThree-jvFCVGRENqjL5AAjcQtiE' } ],
          routes: 
           [ { name: 'TabOne',
               key: 'TabOne-GD2IopAEGUBBrr_hPvTLQ',
               params: undefined },
             { name: 'TabTwo',
               key: 'TabTwo-f1kcrFxAllgLHrsW5nnC2',
               params: undefined },
             { name: 'TabThree',
               key: 'TabThree-jvFCVGRENqjL5AAjcQtiE',
               params: undefined,
               state: 
                { stale: false,
                  type: 'stack',
                  key: 'stack-IbhbHkHW9_BMLWHOQiE_n',
                  index: 1,
                  routeNames: [ 'TabThreeStackScreenOne', 'TabThreeStackScreenTwo' ],
                  preloadedRoutes: [],
                  routes: 
                   [ { key: 'TabThreeStackScreenOne-PX9AhmVR4LrRdyvpNXx-w',
                       name: 'TabThreeStackScreenOne',
                       params: undefined,
                       path: undefined },
                     { key: 'TabThreeStackScreenTwo-USEwFKxJLpVWxxQwcmewi',
                       name: 'TabThreeStackScreenTwo',
                       path: undefined,
                       params: undefined } ] } } ],
          preloadedRouteKeys: [ 'TabThree-jvFCVGRENqjL5AAjcQtiE' ] } } ] }
[tag=164] mountingTransactionWillMount, revision: 23
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=292, newShadowTag=0
mutation type=16, parent=164, oldShadowTag=162, newShadowTag=162
mutation type=4, parent=164, oldShadowTag=0, newShadowTag=304
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 23
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=292, newShadowTag=0
mutation type=16, parent=164, oldShadowTag=162, newShadowTag=162
mutation type=4, parent=164, oldShadowTag=0, newShadowTag=304
[tag=118] mountingTransactionWillMount END
Screen [292] didMoveToWindow (null)
NavigationContainer [36] updateContainer SYNC
NavigationContainer [36] updateContainer SYNC
NavigationContainer [36] updateContainer to 172
[tag=164] RNSScreenStack mountChildComponentView with tag=304
[tag=164] mountingTransactionDidMount START, revision: 23
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=292, newShadowTag=0
mutation type=16, parent=164, oldShadowTag=162, newShadowTag=162
mutation type=4, parent=164, oldShadowTag=0, newShadowTag=304
[tag=164] RNSScreenStackView mountingTransactionDidMount SCHEDULE async update, revision: 23
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 23
mutation type=16, parent=118, oldShadowTag=116, newShadowTag=116
mutation type=8, parent=118, oldShadowTag=292, newShadowTag=0
[tag=118] RNSScreenStackView mountingTransactionDidMount SCHEDULE async update, revision: 23
[tag=118] mountingTransactionDidMount END
Screen [162] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000025a2d60>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=164] RNSScreenStackView didMoveToWindow, schedule container update
[tag=164] RNSScreenStackView maybeAddToParentAndUpdateContainer 1 window = <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000025a2d60>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=164] RNScreenStack updateContainer ref=<RNSScreenStackView: 0x31cbc60f0; frame = (0 97.6667; 393 671.333); tag = 164; gestureRecognizers = <NSArray: 0x6000025b42d0>; layer = <CALayer: 0x600002bb9340>>
[tag=164] setPushViewControllers; NO ongoing animation detected; proceeding with VC update
[tag=164]RNSScreenStack setModalViewControllers controlers did not changed !!
[tag=164] RNScreenStack current controllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack current controllers tag=304, ref=<RNSScreen: 0x320c2ce00>
[tag=164] RNScreenStack current presentation ctrls tag=0, ref=<RNSScreen: 0x31f1ed200>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=304, ref=<RNSScreen: 0x320c2ce00>
[tag=164] <---- ANIMATION STARTED ---->
Transition coordinators: <RNSNavigationController: 0x320bb3000> <_UIViewControllerTransitionCoordinator: 0x600003f75c40>
From ViewController: RNSScreen tag=162 <RNSScreen: 0x320bd5c00>
To ViewController: RNSScreen tag=304 <RNSScreen: 0x320c2ce00>
[tag=164] </---- ANIMATION STARTED ---->
[tag=164] RNScreenStack updateContainer END
Screen [172] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000025a2d60>; layer = <UIWindowLayer: 0x60000240cd80>>
Screen [34] didMoveToWindow (null)
Screen [162] didMoveToWindow (null)
Screen [162] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000025a2d60>; layer = <UIWindowLayer: 0x60000240cd80>>
Screen [304] didMoveToWindow <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000025a2d60>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=164] mountingTransactionWillMount, revision: 24
!!! None matched, displaing all !!!
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 24
!!! None matched, displaing all !!!
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 24
!!! None matched, displaing all !!!
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 24
!!! None matched, displaing all !!!
[tag=118] mountingTransactionDidMount END
[tag=164] RNSScreenStackView mountingTransactionDidMount EXECUTE async update, revision: 23
[tag=164] RNSScreenStackView maybeAddToParentAndUpdateContainer 1 window = <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000025a2d60>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=164] RNScreenStack updateContainer ref=<RNSScreenStackView: 0x31cbc60f0; frame = (0 97.6667; 393 671.333); tag = 164; gestureRecognizers = <NSArray: 0x6000025b42d0>; layer = <CALayer: 0x600002bb9340>>
[tag=164]RNSScreenStack setPushViewControllers controllers did not change
[tag=164]RNSScreenStack setModalViewControllers controlers did not changed !!
[tag=164] RNScreenStack current controllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack current controllers tag=304, ref=<RNSScreen: 0x320c2ce00>
[tag=164] RNScreenStack current presentation ctrls tag=0, ref=<RNSScreen: 0x31f1ed200>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=162, ref=<RNSScreen: 0x320bd5c00>
[tag=164] RNScreenStack updateContainer new setPushControllers tag=304, ref=<RNSScreen: 0x320c2ce00>
[tag=164] <---- ANIMATION STARTED ---->
Transition coordinators: <RNSNavigationController: 0x320bb3000> <_UIViewControllerTransitionCoordinator: 0x600003f75c40>
From ViewController: RNSScreen tag=162 <RNSScreen: 0x320bd5c00>
To ViewController: RNSScreen tag=304 <RNSScreen: 0x320c2ce00>
[tag=164] </---- ANIMATION STARTED ---->
[tag=164] RNScreenStack updateContainer END
[tag=118] RNSScreenStackView mountingTransactionDidMount EXECUTE async update, revision: 23
[tag=118] RNSScreenStackView maybeAddToParentAndUpdateContainer 1 window = <UIWindow: 0x154f1e4e0; frame = (0 0; 393 852); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000025a2d60>; layer = <UIWindowLayer: 0x60000240cd80>>
[tag=118] RNScreenStack updateContainer ref=<RNSScreenStackView: 0x31cc28990; frame = (0 0; 393 852); tag = 118; gestureRecognizers = <NSArray: 0x6000025b5320>; layer = <CALayer: 0x600002b9ae80>>
[tag=118]RNSScreenStack setPushViewControllers controllers did not change
[tag=118] RNScreenStack current controllers tag=116, ref=<RNSScreen: 0x3209f3a00>
[tag=118] RNScreenStack current presentation ctrls tag=0, ref=<RNSScreen: 0x31f1ed200>
[tag=118] RNScreenStack updateContainer new setPushControllers tag=116, ref=<RNSScreen: 0x3209f3a00>
[tag=118] <---- ANIMATION STARTED ---->
Transition coordinators: <RNSNavigationController: 0x31fe3ee00> <_UIViewControllerTransitionCoordinator: 0x600003f2cc00>
From ViewController: RNSScreen tag=0 <RNSScreen: 0x31f1ed200>
To ViewController: UIViewController tag=0 <UIViewController: 0x154f1f870>
[tag=118] </---- ANIMATION STARTED ---->
[tag=118] RNScreenStack updateContainer END
[tag=164] mountingTransactionWillMount, revision: 25
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 25
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 25
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 25
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=118] mountingTransactionDidMount END
[tag=164] mountingTransactionWillMount, revision: 26
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 26
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 26
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 26
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=118] mountingTransactionDidMount END
[tag=164] mountingTransactionWillMount, revision: 27
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=164] mountingTransactionWillMount END
[tag=118] mountingTransactionWillMount, revision: 27
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=118] mountingTransactionWillMount END
[tag=164] mountingTransactionDidMount START, revision: 27
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=164] mountingTransactionDidMount END
[tag=118] mountingTransactionDidMount START, revision: 27
mutation type=16, parent=164, oldShadowTag=304, newShadowTag=304
[tag=118] mountingTransactionDidMount END
Screen [162] didMoveToWindow (null)

Conclusion

Based on above, we concluded that the problem lies in timing when new screen, and its parents, are attached to the window, which is handled by iOS (at the end of this operation iOS calls ASYNCHRONOUSLY didMoveToWindow which triggers updateContainer). We didn't see any reasonable solution that could allow us to wait and keep order of calls the same.

There was an alternative idea that the problem maybe in the step We get some empty transactions, the idea here was that maybe the queue is busy and thus the order is different, but we rejected it, as if the would be the problem didMoveToWindow should be run just after those transactions. Im writing about about here just for record.

One remark for the feature

What is interesting, and could be further investigated - when we transition between screens, in working case, we start formsheet transition and those two are continued simultaneously. In the not working case, when the foresheet transition starts, screen transition is scheduled after the first one finished. This is explicitly in the code, but when I commented that part out, the behavior stayed the same.

@kkafar
Copy link
Copy Markdown
Member Author

kkafar commented Mar 30, 2026

Won't proceed here.

@kkafar kkafar closed this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants