Skip to content

iOS Fabric: SafeAreaView keeps stale insets for a few frames after rotation (async state update) #802

Closed

Description

@hirbod

On iOS with Fabric, a SafeAreaView inside a native sheet keeps its old insets for a few frames after a rotation, then jumps to the right ones.

The view updates its state with the default async mode, so the new insets only land on the next event beat. When the app is busy, that takes a few frames. react-native-screens runs into the same thing with its screen state and passes unstable_Immediate there, so I did the same here.

         return std::make_shared<RNCSafeAreaViewShadowNode::ConcreteState::Data const>(newData);
-      });
+      },
+      facebook::react::EventQueue::UpdateMode::unstable_Immediate);

You can see it in https://github.com/hirbod/rnsac-rotation-repro if you open the sheet and rotate to landscape. The red frame sits under the notch for a moment before it moves in.

Tested with 5.11.0, RN 0.88.1 and react-native-screens 4.30.1 on an iOS 27 simulator. The fix is in #803.

Activity

  1. hirbod commented on Nov 2, 2026

    @hirbod
    ContributorAuthor

    Turns out there's a second bug under this one when the view is in a sheet (#781). Without that fix the view doesn't get the new insets at all until React commits again. #803 fixes both. Left is 5.11.0, middle only has the #781 fix, right has both, slowed down 4x.

    Before and after

  2. floco-af commented on Nov 2, 2026

    @floco-af
    Contributor

    Thanks for the report and repro. This is being tracked in #803, where I left a review: the fix direction looks right, but UpdateMode::unstable_Immediate only exists since RN 0.82 (the package supports any RN version), so it needs a version guard, and it may be better to limit it to the inset-change path rather than also mount-time updates. Let's continue the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions