This diff handles refactoring the existing MarkdownContext API to encompass AppNavigator - this means that when each text-message now uses the MarkdownContext, that context is not unique-per-message. To solve this, the methods in the API take in messageID parameters, that maps a message to a boolean state in the Provider. The following was done in this diff in order to replicate existing behavior:
- Update the existing Context in markdown-context.js to use React.useState so we can update the state of a message and re-render automatically. This is of type Object, where the keys are messageIDs and the values are booleans.
- Introduce a clearMessageData method to clear data on unmount
- Create a markdown-context-provider.react.js. This allows the Context to track what message is being pressed and if it should be blocked from the tooltip appearing.
- Use this Context in ConnectedTextMessage to adjust linkIsBlockingPresses
- Pass in the messageID to MarkdownLink through a MessageContext so onPress, we can call setLinkModalActive or setLinkPressActive with the specific messageID being tapped
- Encompass App.Navigator within MarkdownContextProvider
This is Step 3 of https://linear.app/comm/issue/ENG-2072/maintain-the-spoiler-state-upon-opening-textmessagetooltipmodal
Depends on D5446