Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3374829
D5446.id19033.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D5446.id19033.diff
View Options
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
@@ -12,7 +12,7 @@
import { threadPermissions } from 'lib/types/thread-types';
import { ChatContext, type ChatContextType } from '../chat/chat-context';
-import { MarkdownLinkContext } from '../markdown/markdown-link-context';
+import { MarkdownContext } from '../markdown/markdown-context';
import {
OverlayContext,
type OverlayContextType,
@@ -47,8 +47,9 @@
+canCreateSidebarFromMessage: boolean,
// withOverlayContext
+overlayContext: ?OverlayContextType,
- // MarkdownLinkContext
+ // ChatContext
+chatContext: ?ChatContextType,
+ // MarkdownContext
+linkModalActive: boolean,
};
class TextMessage extends React.PureComponent<Props> {
@@ -223,7 +224,7 @@
const chatContext = React.useContext(ChatContext);
const [linkModalActive, setLinkModalActive] = React.useState(false);
- const markdownLinkContext = React.useMemo(
+ const markdownContext = React.useMemo(
() => ({
setLinkModalActive,
}),
@@ -235,7 +236,7 @@
);
return (
- <MarkdownLinkContext.Provider value={markdownLinkContext}>
+ <MarkdownContext.Provider value={markdownContext}>
<TextMessage
{...props}
canCreateSidebarFromMessage={canCreateSidebarFromMessage}
@@ -243,7 +244,7 @@
chatContext={chatContext}
linkModalActive={linkModalActive}
/>
- </MarkdownLinkContext.Provider>
+ </MarkdownContext.Provider>
);
},
);
diff --git a/native/markdown/markdown-context.js b/native/markdown/markdown-context.js
new file mode 100644
--- /dev/null
+++ b/native/markdown/markdown-context.js
@@ -0,0 +1,13 @@
+// @flow
+
+import * as React from 'react';
+
+export type MarkdownContextType = {
+ +setLinkModalActive: boolean => void,
+};
+
+const MarkdownContext: React.Context<?MarkdownContextType> = React.createContext<?MarkdownContextType>(
+ null,
+);
+
+export { MarkdownContext };
diff --git a/native/markdown/markdown-link.react.js b/native/markdown/markdown-link.react.js
--- a/native/markdown/markdown-link.react.js
+++ b/native/markdown/markdown-link.react.js
@@ -5,16 +5,13 @@
import { normalizeURL } from 'lib/utils/url-utils';
-import {
- MarkdownLinkContext,
- type MarkdownLinkContextType,
-} from './markdown-link-context';
+import { MarkdownContext, type MarkdownContextType } from './markdown-context';
function useDisplayLinkPrompt(
inputURL: string,
- markdownLinkContext: ?MarkdownLinkContextType,
+ markdownContext: ?MarkdownContextType,
) {
- const setLinkModalActive = markdownLinkContext?.setLinkModalActive;
+ const setLinkModalActive = markdownContext?.setLinkModalActive;
const onDismiss = React.useCallback(() => {
setLinkModalActive?.(false);
}, [setLinkModalActive]);
@@ -51,7 +48,7 @@
};
function MarkdownLink(props: Props): React.Node {
const { target, ...rest } = props;
- const markdownLinkContext = React.useContext(MarkdownLinkContext);
+ const markdownLinkContext = React.useContext(MarkdownContext);
const onPressLink = useDisplayLinkPrompt(target, markdownLinkContext);
return <Text onPress={onPressLink} {...rest} />;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 5:13 PM (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2591116
Default Alt Text
D5446.id19033.diff (3 KB)
Attached To
Mode
D5446: [native] Rename MarkdownLinkContext to MarkdownContext
Attached
Detach File
Event Timeline
Log In to Comment