HomePhabricator
Diffusion Comm 74431b24ce54

[native] Migrate threadColorOverride in useAnimatedMessageTooltipButton to…

Description

[native] Migrate threadColorOverride in useAnimatedMessageTooltipButton to Reanimate V2 API

Summary:
Before threadColorOverride was a reanimated node or null. It returned null if the message is not a text message or there is no transition.
It contained a node with a block:

  • if progress is 1 then call setThreadColorBrightness
  • return interpolated color based on progress value

By using useDerivedValue I achieved something similar. Now it’s a SharedValue that:

  • contains null if the message is not a text message or there is no transition
  • if progress is 1 then setThreadColorBrightness is called on JS thread
  • contains an interpolated color if there is a transition and it’s a text message

So the behaviour is the same but now it returns SharedValue<string | null> instead of Node | null.

threadColorOverride is used by InnerTextMessage component so I needed to migrate it too but it’s very straightforward, just add useAnimatedStyle instead of useMemo and use a shared value instead of a node

Depends on D14119

Test Plan: Have a thread with a different thread color than the parent thread. Open up a tooltip on a text message and navigate to the child thread. Verify that the message background color is interpolated correctly

Reviewers: ashoat, tomek

Reviewed By: ashoat

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