HomePhabricator
Diffusion Comm ce0a730b1bd6

[native] Migrate Tooltip component to Reanimated v2 API

Description

[native] Migrate Tooltip component to Reanimated v2 API

Summary:
This diff migrates now functional Tooltip component to Reanimated V2 api. This includes:

  • using useAnimatedStyle instead of useMemo for animated styles
  • moving reanimated nodes and their interpolations into useAnimatedStyle worklet
  • migrating tooltipHorizontalOffset to shared value
  • using positionV2 instead of position
  • I passed opacityStyle and styles.backdrop as separate styles because you can’t merge those styles like they were originally merged, this shouldn’t have any impact though

Also I calculate getTooltipLocation(), getMargin() and getTooltipHeight() outside of a worklet. The reason is that I’d need to make them into worklets and they’re calling functions that I’d need to make into worklets too and those functions are calling some Map or Set operations that are not worklets so it’s a mess. And worklets are supposed to be small functions after all. The results of those functions are in useAnimatedStyle dependencies and they shouldn’t change much so it should be ok

Depends on D14113

Test Plan: Open up tooltips and verify they're animated correctly

Reviewers: ashoat, tomek

Reviewed By: ashoat

Differential Revision: https://phab.comm.dev/D14117

Details

Provenance
angelikaAuthored on Tue, Dec 3, 11:58 AM
Reviewer
ashoat
Differential Revision
D14117: [native] Migrate Tooltip component to Reanimated v2 API
Parents
rCOMMb68c01744e20: [native] Enable Flow types in Reanimated worklets
Branches
Unknown
Tags
Unknown