[Lightbox] Fix jump when zooming out on iOS#6633
Merged
Merged
Conversation
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, we disable bounce when the image is 1:1. This is to allow it being swiped away (instead of bouncing). However, this actually introduces a problem: if you start pinching in first, and then pinch out, the image will jump as you cross the 1:1 threshold. That's because the
bouncesprop would change while dragging, and disabling bouncing would force-center the image. The fix is to only disable bouncing while both 1:1 and at rest.Implementation-wise, I wanted an excuse to try
useAnimatedProps, so this is it. Seems like a convenient way to toggle native props without leaving the UI thread. An alternative would be to callsetNativePropsimperatively.Test Plan
Verify you still can swipe away images when at rest.
Verify you still cannot swipe away images while zoomed in.
Verify that if you pinch in and out (and in and out again), crossing the 1:1 threshold does not cause visual jumps. This is much easier to test on the device; if you do it on the Simulator, you'll have to both pinch and pan to reproduce the jump.
Before
before.mov
After
after.mov