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
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
Unknown Object (File)
Thu, Dec 19, 11:37 AM
Unknown Object (File)
Wed, Dec 18, 8:21 PM
Unknown Object (File)
Wed, Dec 18, 4:10 PM
Unknown Object (File)
Wed, Dec 18, 1:46 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
Lint Not Applicable
Unit
Tests Not Applicable

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