-
-
Couldn't load subscription status.
- Fork 592
feat(Stack): Add support for synchronous state updates on fabric for native stack #3282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b794a54 to
3a71e96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
cafa658 to
0d6b842
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few questions & suggestions. Please answer them.
Thank you for the PR.
c4881f5 to
5f72498
Compare
…ync state update (#3285) ## Description This code was originally added to mitigate issues with jumping content during transitions. By observing the presentation layer, we were able to send intermediate column size updates, which helped with making smoother animation. However, with the current ability to send immediate updates, it seems that it now works well with the native SplitView transition. As a result, we can remove the previously added logic, which was initially introduced in: #3073 How it appears to work now: <img width="1033" height="151" alt="Screenshot 2025-10-07 at 12 50 03" src="https://github.com/user-attachments/assets/fac535c0-60a5-42be-8a9d-3430dad418c3" /> How it appeared to work with DisplayLink: <img width="1081" height="190" alt="Screenshot 2025-10-07 at 13 12 06" src="https://github.com/user-attachments/assets/3704e0b5-bab4-4b35-b6e3-aafa77dfc01d" /> Having the final frame set immediately, we can rely on the native animation (which implementation is a mystery for us). Still, it seems that we're following the same path as natively, where I also observed that the final frame is set at the beginning of the animation. This model appears to work similarly to the Android version. For example, when animating the keyboard, we can read the target value on animation start https://developer.android.com/develop/ui/views/layout/sw-keyboard#:~:text=onStart%20is%20called,the%20view%20properties. It seems that setting intermediate frames, following the presentation layer, might be slightly delayed for the value we read in comparison to the value that is currently drawn. Fixes software-mansion/react-native-screens-labs#496 ## Changes - Removed logic related to observing presentation layer for sending asynchronous state updates. ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before https://github.com/user-attachments/assets/966d0b7f-665d-4add-947e-ceeddb81d0e2 ### After https://github.com/user-attachments/assets/69955aca-e9ae-48e2-a9fd-7d04ff65835f ## Test code and steps to reproduce I went through SplitView examples, having synchronous updates in SplitView and additionally sync updates for Stack v4 #3282 . I focused on testing that there's no regression with pressables. ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I have on elast remark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, let's go
Description
This PR adds support for synchronous updates in the native stack for React Native 0.82+. Currently, enabling synchronous state updates is possible via an experimental feature flag:
unstable_synchronousStateUpdatesEnabled.At this time, I haven't found a way to perform synchronous updates on Android, so this PR only includes mocks for that platform. I'm creating a ticket for covering that: https://github.com/software-mansion/react-native-screens-labs/issues/497
Fixes https://github.com/software-mansion/react-native-screens-labs/issues/495
Changes
Screenshots / GIFs
Before
before.mov
After
after.mov
Test code and steps to reproduce
Adding a new example, which is verifying that with synchronous updates enabled, the form sheet content flicker issues are resolved.
Checklist