Page MenuHomePhabricator

[native] Migrate recenter functionality in FullScreenViewModal
ClosedPublic

Authored by angelika on Feb 6 2025, 5:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 6, 4:02 AM
Unknown Object (File)
Sat, Apr 5, 9:51 PM
Unknown Object (File)
Sat, Apr 5, 4:47 PM
Unknown Object (File)
Sat, Apr 5, 9:10 AM
Unknown Object (File)
Sat, Apr 5, 6:56 AM
Unknown Object (File)
Fri, Apr 4, 10:26 AM
Unknown Object (File)
Fri, Apr 4, 5:24 AM
Unknown Object (File)
Thu, Apr 3, 4:44 AM
Subscribers

Details

Summary

https://linear.app/comm/issue/ENG-8150/convert-fullscreenviewmodal-to-reanimated-2-syntax

The recenter function triggers if there is no interaction (after some gesture ends and there is no animation). If the image is panned or zoomed out so there is some space left, the image is zoomed in to 1 (if necessary) and moved.

Depends on D14306

Test Plan

Tested after migration: verify the image is recentered after pan ended when zoomed out

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

angelika held this revision as a draft.
tomek added inline comments.
native/components/full-screen-view-modal.react.js
1179–1187 ↗(On Diff #47085)

It looks like in the original code this if was split into 3, for each value respectively. Should we do the same here?

This revision is now accepted and ready to land.Feb 17 2025, 3:52 AM
native/components/full-screen-view-modal.react.js
1076 ↗(On Diff #47085)

I think "reset animation" is confusing naming here, as that could mean a lot of things. How about isRunningDoubleTapZoomAnimation?

1164 ↗(On Diff #47085)

In the old system, we would stop the recentering animations when activeInteraction flipped to true.

In the new system, when this happens due to pinchActive or isRunningResetAnimation, it looks like all three animations will be cancelled because new values are set for curScale, curX, and curY.

But in the case of panActive and isRunningDismissAnimation, it appears that a new value is not set for curScale. Does this mean the animation will continue? Do we need to cancel it some other way?

This revision is now accepted and ready to land.Feb 21 2025, 8:07 PM
native/components/full-screen-view-modal.react.js
1164 ↗(On Diff #47085)

Copied the comment from other diff, because it also applies here:

I added cancelAnimation(curScale) when dismissing from pan. Now fling should be stopped when activeInteraction is true. In case activeInteraction is triggered by:

panActive turning to true: we explicitly cancel all animations in panStart
pinchActive turning to true: we explicitly cancel all animation in pinchStart
isRunningDismissAnimation: curX and curY are overridden and we explicitly cancel curScale
isRunningDoubleTapZoomAnimation: curX, curY and curScale are are overridden
This also applies to the recenter animation.