Skip to content

Android: touch hit testing breaks after fullscreen orientation change when screen shadow state reset is enabled #4289

Description

@yezhou

Description

We are seeing an Android regression where touch hit testing becomes broken on the previous RNSScreen after a fullscreen video flow changes orientation and then returns to the previous screen.

This appears to be related to the Android orientation-change layout fix from #3295, specifically the androidResetScreenShadowStateOnOrientationChangeEnabled / RNSScreenShadowNodeCommitHook path.

Environment

  • react-native-screens: reproduced with 4.19.0 and 4.25.2
  • react-native: 0.86.0
  • expo: ~57.0.4
  • expo-router: ~57.0.4
  • Platform: Android
  • New Architecture/Fabric: enabled by default in Expo SDK 57
  • Navigation: Expo Router / native stack

Regression range

  • react-native-screens@4.18.0: works
  • react-native-screens@4.19.0: broken
  • react-native-screens@4.25.2: broken
  • react-native-screens@4.25.2 with androidResetScreenShadowStateOnOrientationChangeEnabled default changed from true to false: works

Reproduction pattern

  1. Open a stack screen, for example a workspace/file-list screen.
  2. Navigate to a video player screen.
  3. Enter fullscreen video, which changes the device/app orientation to landscape.
  4. Exit fullscreen, returning orientation to portrait.
  5. Dismiss the video player and return to the previous stack screen.
  6. Try tapping content inside the previous screen.

Actual behavior

The native header still responds to taps, but the previous screen content area becomes mostly unresponsive.

For example:

  • file/folder list items mostly cannot be tapped;
  • repeated taps may occasionally trigger something;
  • native header back button still works;
  • tab/root screens still work;
  • entering the same screen again as a new screen instance restores normal touch behavior;
  • manually rotating the device again also restores normal touch behavior.

This makes it look like the old RNSScreen content area's native layout / hit-test state is stale after the fullscreen orientation transition.

Expected behavior

After exiting fullscreen and dismissing the video player screen, the previous screen should receive touches normally.

Workaround that fixes it

Keeping react-native-screens@4.25.2, this local patch fixes the issue for us:

-const RNS_ANDROID_RESET_SCREEN_SHADOW_STATE_ON_ORIENTATION_CHANGE_DEFAULT = true;
+const RNS_ANDROID_RESET_SCREEN_SHADOW_STATE_ON_ORIENTATION_CHANGE_DEFAULT = false;

and in the codegen spec:

 androidResetScreenShadowStateOnOrientationChangeEnabled?: CT.WithDefault<
   boolean,
-  true
+  false
 >;

After that patch, the same fullscreen video orientation flow no longer breaks touch handling on the previous screen.

Why this looks related to #3295

#3295 introduced a commit hook that detects orientation changes and resets RNSScreen frame size so Yoga recalculates layout. That matches the regression boundary exactly: 4.18.0 works, 4.19.0 fails.

The issue also seems consistent with later work such as commit aedf1ee / #4200, whose description says stale Yoga measurements can still be received after orientation changes and avoids applying Yoga layout directly to StackHost children.

Our case may be another path where the orientation reset happens while a fullscreen/modal video screen is being dismissed and the previous screen is being revealed. The parent/root/native dimensions may not be fully synchronized yet, so the recalculated Yoga layout or hit-test geometry for the previous screen can become stale until another full orientation/layout pass occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe user didn't precise the problem enoughmissing-reproThis issue need minimum repro scenarioplatform:androidIssue related to Android part of the library

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions