Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3542563
D10060.id33766.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10060.id33766.diff
View Options
diff --git a/native/chat/image-paste-modal.react.js b/native/chat/image-paste-modal.react.js
--- a/native/chat/image-paste-modal.react.js
+++ b/native/chat/image-paste-modal.react.js
@@ -21,6 +21,8 @@
+thread: ThreadInfo | MinimallyEncodedThreadInfo,
};
+const safeAreaEdges = ['top'];
+
type Props = {
+navigation: RootNavigationProp<'ImagePasteModal'>,
+route: NavigationRoute<'ImagePasteModal'>,
@@ -51,18 +53,40 @@
filesystem.unlink(imagePasteStagingInfo.uri);
}, [imagePasteStagingInfo.uri, navigation]);
- return (
- <Modal modalStyle={styles.modal} safeAreaEdges={['top']}>
- <Image style={styles.image} source={{ uri: imagePasteStagingInfo.uri }} />
- <View style={styles.linebreak} />
- <View style={styles.spacer} />
- <Button disabled={sendButtonDisabled} title="Send" onPress={sendImage} />
- <View style={styles.linebreak} />
- <View style={styles.spacer} />
- <Button title="Cancel" onPress={cancel} />
- <View style={styles.spacer} />
- </Modal>
+ const imageSource = React.useMemo(
+ () => ({ uri: imagePasteStagingInfo.uri }),
+ [imagePasteStagingInfo.uri],
+ );
+
+ const imagePasteModal = React.useMemo(
+ () => (
+ <Modal modalStyle={styles.modal} safeAreaEdges={safeAreaEdges}>
+ <Image style={styles.image} source={imageSource} />
+ <View style={styles.linebreak} />
+ <View style={styles.spacer} />
+ <Button
+ disabled={sendButtonDisabled}
+ title="Send"
+ onPress={sendImage}
+ />
+ <View style={styles.linebreak} />
+ <View style={styles.spacer} />
+ <Button title="Cancel" onPress={cancel} />
+ <View style={styles.spacer} />
+ </Modal>
+ ),
+ [
+ cancel,
+ imageSource,
+ sendButtonDisabled,
+ sendImage,
+ styles.image,
+ styles.linebreak,
+ styles.modal,
+ styles.spacer,
+ ],
);
+ return imagePasteModal;
}
const unboundStyles = {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 8:35 AM (8 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2712197
Default Alt Text
D10060.id33766.diff (1 KB)
Attached To
Mode
D10060: [native] Add some memoization to `ImagePasteModal`
Attached
Detach File
Event Timeline
Log In to Comment