Page MenuHomePhabricator

[native] Migrate single tap gesture handling in FullScreenViewModal
ClosedPublic

Authored by angelika on Feb 6 2025, 5:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 10, 5:01 AM
Unknown Object (File)
Fri, Mar 14, 7:59 AM
Unknown Object (File)
Fri, Mar 14, 7:59 AM
Unknown Object (File)
Fri, Mar 14, 7:58 AM
Unknown Object (File)
Wed, Mar 12, 11:26 PM
Unknown Object (File)
Mar 12 2025, 9:30 AM
Unknown Object (File)
Mar 11 2025, 4:16 PM
Unknown Object (File)
Mar 11 2025, 4:14 PM
Subscribers

Details

Summary

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

Migrate single tap gesture.
On single tap:

  • if tap is on buttons then don't do anything
  • toggle the buttons on tap

There is also logic not really related to single tap gesture that is contained in singleTapUpdate and I've migrated it too:

  • if the image just became unzoomed and close button is hidden then toggle close button
  • if the image just because unzoomed then toggle action links

I've put it in useAnimatedReaction.

Depends on D14303

Test Plan

Tested after migration: verify the buttons are toggled after single tap.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

Toggles close button and animates its opacity. When animation is finished, the close button is enabled/disabled.
curCloseButtonOpacity - current opacity of the close button
targetCloseButtonOpacity - the state we're animating towards, can be 0 or 1

1202–1219 ↗(On Diff #46948)

Toggles action links and animates their opacity. When animation is finished, the action links are enabled/disabled.
curActionLinksOpacity - current opacity of the close button
targetActionLinksOpacity - the state we're animating towards, can be 0 or 1

native/flow-typed/npm/react-native-reanimated_v2.x.x.js
609 ↗(On Diff #46948)

AnimatableValue is string or number or array of numbers, but animated reaction can have anything as a value we're reacting to, in particular we need boolean. In original reanimated v2 types we also don't have :AnimatableValue here https://github.com/software-mansion/react-native-reanimated/blob/2.17.0/src/reanimated2/hook/useAnimatedReaction.ts#L8

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

In the old system, when the image becomes zoomed, we toggle the action links off.

Is this handled in a later diff via doubleTapGesture?

1241 ↗(On Diff #47082)

Shouldn't we prevent a single tap from toggling the action links when the image is zoomed?

native/components/full-screen-view-modal.react.js
1230 ↗(On Diff #47082)

good catch! fixed

1241 ↗(On Diff #47082)

good catch! fixed