Page MenuHomePhabricator

D5765.id19025.diff
No OneTemporary

D5765.id19025.diff

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
@@ -50,7 +50,6 @@
// MarkdownLinkContext
+chatContext: ?ChatContextType,
+linkModalActive: boolean,
- +linkIsBlockingPresses: boolean,
};
class TextMessage extends React.PureComponent<Props> {
message: ?React.ElementRef<typeof View>;
@@ -74,7 +73,6 @@
overlayContext,
chatContext,
linkModalActive,
- linkIsBlockingPresses,
canCreateSidebarFromMessage,
...viewProps
} = this.props;
@@ -160,9 +158,9 @@
const {
message,
- props: { verticalBounds, linkIsBlockingPresses },
+ props: { verticalBounds, linkModalActive },
} = this;
- if (!message || !verticalBounds || linkIsBlockingPresses) {
+ if (!message || !verticalBounds || linkModalActive) {
return;
}
@@ -225,20 +223,17 @@
const chatContext = React.useContext(ChatContext);
const [linkModalActive, setLinkModalActive] = React.useState(false);
- const [linkPressActive, setLinkPressActive] = React.useState(false);
const markdownLinkContext = React.useMemo(
() => ({
setLinkModalActive,
- setLinkPressActive,
}),
- [setLinkModalActive, setLinkPressActive],
+ [setLinkModalActive],
);
const canCreateSidebarFromMessage = useCanCreateSidebarFromMessage(
props.item.threadInfo,
props.item.messageInfo,
);
- const linkIsBlockingPresses = linkModalActive || linkPressActive;
return (
<MarkdownLinkContext.Provider value={markdownLinkContext}>
<TextMessage
@@ -247,7 +242,6 @@
overlayContext={overlayContext}
chatContext={chatContext}
linkModalActive={linkModalActive}
- linkIsBlockingPresses={linkIsBlockingPresses}
/>
</MarkdownLinkContext.Provider>
);
diff --git a/native/markdown/markdown-link-context.js b/native/markdown/markdown-link-context.js
--- a/native/markdown/markdown-link-context.js
+++ b/native/markdown/markdown-link-context.js
@@ -4,7 +4,6 @@
export type MarkdownLinkContextType = {
+setLinkModalActive: boolean => void,
- +setLinkPressActive: boolean => void,
};
const MarkdownLinkContext: React.Context<?MarkdownLinkContextType> = React.createContext<?MarkdownLinkContextType>(
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
@@ -1,7 +1,7 @@
// @flow
import * as React from 'react';
-import { Text, Linking, Alert, Platform } from 'react-native';
+import { Text, Linking, Alert } from 'react-native';
import { normalizeURL } from 'lib/utils/url-utils';
@@ -50,42 +50,10 @@
...TextProps,
};
function MarkdownLink(props: Props): React.Node {
- const markdownLinkContext = React.useContext(MarkdownLinkContext);
-
const { target, ...rest } = props;
+ const markdownLinkContext = React.useContext(MarkdownLinkContext);
const onPressLink = useDisplayLinkPrompt(target, markdownLinkContext);
-
- const setLinkPressActive = markdownLinkContext?.setLinkPressActive;
- const androidOnStartShouldSetResponderCapture = React.useCallback(() => {
- setLinkPressActive?.(true);
- return true;
- }, [setLinkPressActive]);
-
- const activePressHasMoved = React.useRef(false);
- const androidOnResponderMove = React.useCallback(() => {
- activePressHasMoved.current = true;
- }, []);
-
- const androidOnResponderTerminate = React.useCallback(() => {
- if (!activePressHasMoved.current) {
- onPressLink();
- }
- activePressHasMoved.current = false;
- setLinkPressActive?.(false);
- }, [onPressLink, setLinkPressActive]);
-
- if (Platform.OS !== 'android') {
- return <Text onPress={onPressLink} {...rest} />;
- }
-
- // The Flow type for Text's props is missing onStartShouldSetResponderCapture
- const gestureProps: any = {
- onStartShouldSetResponderCapture: androidOnStartShouldSetResponderCapture,
- onResponderMove: androidOnResponderMove,
- onResponderTerminate: androidOnResponderTerminate,
- };
-
- return <Text {...gestureProps} {...rest} />;
+ return <Text onPress={onPressLink} {...rest} />;
}
export default MarkdownLink;

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 10:00 AM (21 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611246
Default Alt Text
D5765.id19025.diff (4 KB)

Event Timeline