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
F3490916: D14128.id46347.diff
Wed, Dec 18, 5:53 PM
F3488255: D14128.id46422.diff
Wed, Dec 18, 9:33 AM
Unknown Object (File)
Tue, Dec 17, 10:49 PM
Unknown Object (File)
Mon, Dec 16, 8:42 PM
Unknown Object (File)
Fri, Dec 13, 11:17 PM
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
Lint Not Applicable
Unit
Tests Not Applicable

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