Open hsource opened 4 years ago
When a user releases a photo while panning on Android, the next image isn't smoothly animated in.
index
onChange
goNext
goPrevious
componentDidUpdate
jumpToCurrentImage
setValue
Make jumpToCurrentImage not call setValue if it's already animating to the right place
In a test app on Android:
@ArtemKolichenkov, @ascoders - could you take a look? We'd love to merge this and stop using our own fork of this repository
Motivation
When a user releases a photo while panning on Android, the next image isn't smoothly animated in.
Cause/debugging
index
prop from within theonChange
handler of the parent componentgoNext
orgoPrevious
, which also calls theonChange
handleronChange
callback, the parent updates theindex
. this causescomponentDidUpdate
to calljumpToCurrentImage
jumpToCurrentImage
callssetValue
, which immediately cancels the animationFix
Make
jumpToCurrentImage
not callsetValue
if it's already animating to the right placeTesting
In a test app on Android: