Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3372065
D5446.id17746.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D5446.id17746.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
@@ -11,7 +11,7 @@
} from 'lib/shared/thread-utils';
import { threadPermissions } from 'lib/types/thread-types';
-import { MarkdownLinkContext } from '../markdown/markdown-link-context';
+import { MarkdownContext } from '../markdown/markdown-context';
import {
OverlayContext,
type OverlayContextType,
@@ -42,7 +42,7 @@
+canCreateSidebarFromMessage: boolean,
// withOverlayContext
+overlayContext: ?OverlayContextType,
- // MarkdownLinkContext
+ // MarkdownContext
+linkModalActive: boolean,
+linkIsBlockingPresses: boolean,
};
@@ -202,7 +202,7 @@
const [linkModalActive, setLinkModalActive] = React.useState(false);
const [linkPressActive, setLinkPressActive] = React.useState(false);
- const markdownLinkContext = React.useMemo(
+ const markdownContext = React.useMemo(
() => ({
setLinkModalActive,
setLinkPressActive,
@@ -216,7 +216,7 @@
const linkIsBlockingPresses = linkModalActive || linkPressActive;
return (
- <MarkdownLinkContext.Provider value={markdownLinkContext}>
+ <MarkdownContext.Provider value={markdownContext}>
<TextMessage
{...props}
canCreateSidebarFromMessage={canCreateSidebarFromMessage}
@@ -224,7 +224,7 @@
linkModalActive={linkModalActive}
linkIsBlockingPresses={linkIsBlockingPresses}
/>
- </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,14 @@
+// @flow
+
+import * as React from 'react';
+
+export type MarkdownContextType = {
+ +setLinkModalActive: boolean => void,
+ +setLinkPressActive: boolean => void,
+};
+
+const MarkdownContext: React.Context<?MarkdownContextType> = React.createContext<?MarkdownContextType>(
+ null,
+);
+
+export { MarkdownContext };
diff --git a/native/markdown/markdown-link-context.js b/native/markdown/markdown-link-context.js
deleted file mode 100644
--- a/native/markdown/markdown-link-context.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// @flow
-
-import * as React from 'react';
-
-export type MarkdownLinkContextType = {
- +setLinkModalActive: boolean => void,
- +setLinkPressActive: boolean => void,
-};
-
-const MarkdownLinkContext: React.Context<?MarkdownLinkContextType> = React.createContext<?MarkdownLinkContextType>(
- null,
-);
-
-export { MarkdownLinkContext };
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]);
@@ -50,12 +47,12 @@
...TextProps,
};
function MarkdownLink(props: Props): React.Node {
- const markdownLinkContext = React.useContext(MarkdownLinkContext);
+ const markdownContext = React.useContext(MarkdownContext);
const { target, ...rest } = props;
- const onPressLink = useDisplayLinkPrompt(target, markdownLinkContext);
+ const onPressLink = useDisplayLinkPrompt(target, markdownContext);
- const setLinkPressActive = markdownLinkContext?.setLinkPressActive;
+ const setLinkPressActive = markdownContext?.setLinkPressActive;
const androidOnStartShouldSetResponderCapture = React.useCallback(() => {
setLinkPressActive?.(true);
return true;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 5:30 AM (7 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2588867
Default Alt Text
D5446.id17746.diff (4 KB)
Attached To
Mode
D5446: [native] Rename MarkdownLinkContext to MarkdownContext
Attached
Detach File
Event Timeline
Log In to Comment