Page MenuHomePhabricator

D5541.diff
No OneTemporary

D5541.diff

diff --git a/native/chat/inner-text-message.react.js b/native/chat/inner-text-message.react.js
--- a/native/chat/inner-text-message.react.js
+++ b/native/chat/inner-text-message.react.js
@@ -5,6 +5,7 @@
import { View, StyleSheet, TouchableWithoutFeedback } from 'react-native';
import Animated from 'react-native-reanimated';
+import { messageKey } from 'lib/shared/message-utils';
import { colorIsDark } from 'lib/shared/thread-utils';
import GestureTouchableOpacity from '../components/gesture-touchable-opacity.react';
@@ -13,6 +14,7 @@
import { useColors, colors } from '../themes/colors';
import type { ChatTextMessageInfoItemWithHeight } from '../types/chat-types';
import { useComposedMessageMaxWidth } from './composed-message-width';
+import { MessageContext } from './message-context.react';
import { MessageListContext } from './message-list-types';
import {
allCorners,
@@ -101,6 +103,16 @@
return [styles.text, textStyle];
}, [darkColor]);
+ // We use a MessageContext to allow MarkdownLink and MarkdownSpoiler
+ // to access the messageKey so it is 'self-aware'
+ const key = messageKey(item.messageInfo);
+ const messageContextValue = React.useMemo(
+ () => ({
+ messageKey: key,
+ }),
+ [key],
+ );
+
const message = (
<TouchableWithoutFeedback>
<View>
@@ -111,9 +123,11 @@
style={[styles.message, cornerStyle]}
animatedStyle={messageStyle}
>
- <Markdown style={markdownStyles} rules={rules}>
- {text}
- </Markdown>
+ <MessageContext.Provider value={messageContextValue}>
+ <Markdown style={markdownStyles} rules={rules}>
+ {text}
+ </Markdown>
+ </MessageContext.Provider>
</GestureTouchableOpacity>
</View>
</TouchableWithoutFeedback>
diff --git a/native/chat/text-message.react.js b/native/chat/text-message.react.js
--- a/native/chat/text-message.react.js
+++ b/native/chat/text-message.react.js
@@ -25,7 +25,6 @@
import type { ChatNavigationProp } from './chat.react';
import ComposedMessage from './composed-message.react';
import { InnerTextMessage } from './inner-text-message.react';
-import { MessageContext } from './message-context.react';
import textMessageSendFailed from './text-message-send-failed';
import { getMessageTooltipKey } from './utils';
@@ -234,28 +233,17 @@
props.item.messageInfo,
);
- // We use a MessageContext to allow MarkdownLink and MarkdownSpoiler
- // to access the messageKey so it is 'self-aware'
- const contextValue = React.useMemo(
- () => ({
- messageKey: key,
- }),
- [key],
- );
-
React.useEffect(() => clearMarkdownContextData, [clearMarkdownContextData]);
return (
- <MessageContext.Provider value={contextValue}>
- <TextMessage
- {...props}
- canCreateSidebarFromMessage={canCreateSidebarFromMessage}
- overlayContext={overlayContext}
- chatContext={chatContext}
- isLinkModalActive={isLinkModalActive}
- linkIsBlockingPresses={linkIsBlockingPresses}
- />
- </MessageContext.Provider>
+ <TextMessage
+ {...props}
+ canCreateSidebarFromMessage={canCreateSidebarFromMessage}
+ overlayContext={overlayContext}
+ chatContext={chatContext}
+ isLinkModalActive={isLinkModalActive}
+ linkIsBlockingPresses={linkIsBlockingPresses}
+ />
);
},
);

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 9:21 AM (8 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2712492
Default Alt Text
D5541.diff (3 KB)

Event Timeline