react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

Tabs switching stops

Open Bardiamist opened this issue 4 months ago • 5 comments

Description

Tabs switching stops with enabled freeze if a screen is heavy

https://github.com/user-attachments/assets/6cd89717-1ac6-401c-8a9c-f69043141f6f

Problem appeared in react-native-screens 4.12.0 and still exist in 4.15.3 No problem on react-native-screens 4.11.1

Steps to reproduce

  1. Open App
  2. Focus heavy screen
  3. Unfocus heavy screen
  4. Focus and immediately unfocus heavy screen

Snack or a link to a repository

https://github.com/Bardiamist/diff/tree/tabs-switching

Screens version

4.15.3

React Native version

0.81.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 16 Pro

Acknowledgements

Yes

Bardiamist avatar Aug 27 '25 10:08 Bardiamist

I am also facing the same issue. Please let me know if you are able to figure out any interim solution.

krupal811 avatar Aug 29 '25 08:08 krupal811

Having the same issue on Android. It's intermittent, sometimes it works, sometimes - grey screen :(

agrinko avatar Sep 14 '25 13:09 agrinko

Same on latest...

artymir avatar Nov 19 '25 19:11 artymir

I am experiencing this issue on 4.18.0

I believe complicated / heavy screen essentially conflict with DelayedFreeze's setTimeout due to delayed/busy JS thread.

This issue https://github.com/software-mansion/react-native-screens/issues/2972 is somewhat related and this component was last changed in https://github.com/software-mansion/react-native-screens/pull/2963

I've tried to patch DelayedFreeze to use

  • requestIdleCallback / cancelIdleCallback
  • requestAnimationFrame

instead of setTimeout but neithe worked.

kirkas avatar Dec 12 '25 21:12 kirkas

I tracked this down to an iOS 26 specific change introduced in 4.17.0. In RNSScreen.mm, there's a willMoveToWindow: method that disables userInteractionEnabled on the window:

- (void)willMoveToWindow:(UIWindow *)newWindow
{
  if (@available(iOS 26, *)) {
    newWindow.userInteractionEnabled = false;
  }
}

It gets re-enabled in viewDidAppear:

- (void)viewDidAppear:(BOOL)animated
{
  if (@available(iOS 26, *)) {
    self.view.window.userInteractionEnabled = true;
  }
  // ...
}                                                                                

The problem is that when using enableFreeze() with tab navigation, frozen screens don't go through viewDidAppear so userInteractionEnabled never gets re-enabled and the app appears frozen. 4.16.0 works fine, 4.17.0+ is broken on iOS 26.
My workaround was to just remove the iOS 26 block in willMoveToWindow:. This might bring back some minor cosmetic glitches during transitions, but fixes the freeze.

kdvmgn avatar Dec 16 '25 21:12 kdvmgn