Page MenuHomePhabricator

[native] Migrate useOverlayPosition, useContentAndHeaderOpacity, useDeliveryIconOpacity hooks to Reanimated V2 API
ClosedPublic

Authored by angelika on Wed, Dec 11, 11:00 AM.
Tags
None
Referenced Files
F3509499: D14128.diff
Sat, Dec 21, 5:38 AM
F3507330: D14128.id46422.diff
Fri, Dec 20, 8:15 PM
F3505335: D14128.id46485.diff
Fri, Dec 20, 1:12 PM
Unknown Object (File)
Thu, Dec 19, 9:25 PM
Unknown Object (File)
Thu, Dec 19, 6:59 PM
Unknown Object (File)
Thu, Dec 19, 6:40 PM
Unknown Object (File)
Thu, Dec 19, 4:16 AM
Unknown Object (File)
Thu, Dec 19, 3:43 AM
Subscribers
None

Details

Summary

Ideally I'd split it into 3 diffs but I guess it would be more trouble than it's worth because both useContentAndHeaderOpacity and useDeliveryIconOpacity use useOverlayPosition so I'd need to create a temporary copy of useOverlayPosition that returns v2, migrate useContentAndHeaderOpacity, migrate useDeliveryIconOpacity and delete a copy of useOverlayPosition that returns v1. And the migration here is straightforward: instead of returning a number or reanimated node we return a SharedValue from useDerivedValue with the exact same logic and I replaced useMemo with useAnimatedStyle when needed.

Depends on D14127

Test Plan

Open up a tooltip on text and robotext message and navigate to thread. Verify the transition looks correctly.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

angelika held this revision as a draft.
ashoat added inline comments.
native/chat/composed-message.react.js
117–121 ↗(On Diff #46347)

Nit

native/chat/utils.js
292 ↗(On Diff #46347)

The docs seem to indicate that the dep lists only help useAnimatedStyle when used without the Babel plugin on web, but not sure if that's fully true

This revision is now accepted and ready to land.Wed, Dec 11, 7:58 PM

Rebase and address feedback

angelika added inline comments.
native/chat/utils.js
292 ↗(On Diff #46347)

Yes, in v3 docs it's mentioned. However it's not mentioned in v2 docs: https://docs.swmansion.com/react-native-reanimated/docs/2.x/api/hooks/useAnimatedStyle#dependencies-array and we're still using v2. So to be on a safe side I kept the dependencies.

native/chat/utils.js
292 ↗(On Diff #46347)

Good catch!!

angelika marked an inline comment as done.

Rebase