Page MenuHomePhabricator

[native] Migrate threadColorOverride in useAnimatedMessageTooltipButton to Reanimate V2 API
ClosedPublic

Authored by angelika on Wed, Dec 11, 8:45 AM.
Tags
None
Referenced Files
F3508613: D14120.id46477.diff
Fri, Dec 20, 11:06 PM
F3508541: D14120.id46513.diff
Fri, Dec 20, 10:50 PM
F3508516: D14120.id46338.diff
Fri, Dec 20, 10:39 PM
F3507236: D14120.diff
Fri, Dec 20, 7:52 PM
F3504857: D14120.id46477.diff
Fri, Dec 20, 10:50 AM
F3504488: D14120.id46414.diff
Fri, Dec 20, 9:11 AM
F3502615: D14120.id.diff
Fri, Dec 20, 4:26 AM
Unknown Object (File)
Thu, Dec 19, 1:44 PM
Subscribers
None

Details

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

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

angelika held this revision as a draft.
This revision is now accepted and ready to land.Wed, Dec 11, 7:53 PM

Rebase and address feedback