-
-
Notifications
You must be signed in to change notification settings - Fork 574
fix(iOS): fix detents not changing if sheetInitialDetent > 0 #2935
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
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.
This looks good, thanks!
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, thanks!
I think the main culprit here is this block: react-native-screens/ios/RNSScreen.mm Lines 1334 to 1340 in c188d35
This gets called everytime you drag, causing performance issues. hence the jumpy glitch. Moving it to I've added this fix to my PR #2902 since it caused an issue with the translation value I wanted to add. Also, we wanted to actually use |
…e detent index update
…eProps (#2952) ## Description Previously, `updateFormSheetPresentationStyle` was called from `finalizeUpdates` every time it was called, which would run many times when the sheet was being dragged. This impacted performance and was the cause of the bug which was fixed in #2935 by introducing a flag for setting initial detent. Now, we are checking `updateMask` in `finalizeUpdates` method. If the props have changed, we call `updateFormSheetPresentationStyle`. We don't need the flag anymore so I removed it as well. Thanks to @lodev09 for [reporting the problem and suggesting possible solution](#2935 (comment)). ## Changes - remove `_sheetHasInitialDetentSet` - check if props have changed using `updateMask` before calling `updateFormSheetPresentationStyle` ## Test code and steps to reproduce Run formSheet-related test screens in the example app, such as `Test2543`, `TestFormSheet` (you can change `sheetInitialDetent` in the file and save to see the update), `Test2877`. ## Checklist - [x] Included code example that can be used to test this change - [ ] Ensured that CI passes
Description
Changing detents on iOS form sheets would not work correctly if
sheetInitialDetent
was set to value other than0
. For some reason, initial detent was set on every update instead of being set only once.Fixes #2543.
Changes
_hasInitialDetentSet
flag and use it to determine whether to set initial detentTest2543
test screen and e2e testScreenshots / GIFs
2543_before.mp4
2543_after.mp4
First example works on both videos, second one only after fix.
Test code and steps to reproduce
Run example app, open
Test2543
.Checklist