diff --git a/native/chat/chat-item-height-measurer.react.js b/native/chat/chat-item-height-measurer.react.js --- a/native/chat/chat-item-height-measurer.react.js +++ b/native/chat/chat-item-height-measurer.react.js @@ -155,7 +155,7 @@ return ( + = React.createContext(); -function useMessageListContext(threadID: ?string) { - const getTextMessageMarkdownRules = useTextMessageRulesFunc(threadID); +function useMessageListContext(threadInfo: ThreadInfo) { + const getTextMessageMarkdownRules = useTextMessageRulesFunc(threadInfo); return React.useMemo( () => ({ getTextMessageMarkdownRules, @@ -36,10 +36,10 @@ type Props = { +children: React.Node, - +threadID: ?string, + +threadInfo: ThreadInfo, }; function MessageListContextProvider(props: Props): React.Node { - const context = useMessageListContext(props.threadID); + const context = useMessageListContext(props.threadInfo); return ( {props.children} diff --git a/native/chat/text-message-tooltip-button.react.js b/native/chat/text-message-tooltip-button.react.js --- a/native/chat/text-message-tooltip-button.react.js +++ b/native/chat/text-message-tooltip-button.react.js @@ -75,8 +75,6 @@ }; }, [initialCoordinates.height, initialCoordinates.x, progress, windowWidth]); - const threadID = item.threadInfo.id; - const messagePressResponderContext = React.useMemo( () => ({ onPressMessage: navigation.goBackOnce, @@ -164,7 +162,7 @@ ); return ( - + MarkdownRules { - return useSelector(getTextMessageRulesFunction(threadID)); + const { members } = threadInfo; + return React.useMemo( + () => + _memoize<[boolean], MarkdownRules>((useDarkStyle: boolean) => + textMessageRules(members, useDarkStyle), + ), + [members], + ); } -const getTextMessageRulesFunction = _memoize((threadID: ?string) => - createSelector( - relativeMemberInfoSelectorForMembersOfThread(threadID), - ( - threadMembers: $ReadOnlyArray, - ): (boolean => MarkdownRules) => { - if (!threadID) { - return fullMarkdownRules; - } - return _memoize<[boolean], MarkdownRules>((useDarkStyle: boolean) => - textMessageRules(threadMembers, useDarkStyle), - ); - }, - ), -); - function textMessageRules( members: $ReadOnlyArray, useDarkStyle: boolean,