diff --git a/native/chat/image-paste-modal.react.js b/native/chat/image-paste-modal.react.js index 9f8dffb7d..a64c6bb7d 100644 --- a/native/chat/image-paste-modal.react.js +++ b/native/chat/image-paste-modal.react.js @@ -1,97 +1,98 @@ // @flow import invariant from 'invariant'; import * as React from 'react'; import { Button, View, Image } from 'react-native'; import filesystem from 'react-native-fs'; import type { PhotoPaste } from 'lib/types/media-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import sleep from 'lib/utils/sleep.js'; import Modal from '../components/modal.react.js'; import { InputStateContext } from '../input/input-state.js'; import type { RootNavigationProp } from '../navigation/root-navigator.react.js'; import type { NavigationRoute } from '../navigation/route-names.js'; import { useStyles } from '../themes/colors.js'; export type ImagePasteModalParams = { +imagePasteStagingInfo: PhotoPaste, - +thread: ThreadInfo, + +thread: ThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { +navigation: RootNavigationProp<'ImagePasteModal'>, +route: NavigationRoute<'ImagePasteModal'>, }; function ImagePasteModal(props: Props): React.Node { const styles = useStyles(unboundStyles); const inputState = React.useContext(InputStateContext); const { navigation, route: { params: { imagePasteStagingInfo, thread: threadInfo }, }, } = props; const [sendButtonDisabled, setSendButtonDisabled] = React.useState(false); const sendImage = React.useCallback(async () => { setSendButtonDisabled(true); navigation.goBackOnce(); const selection: $ReadOnlyArray = [imagePasteStagingInfo]; invariant(inputState, 'inputState should be set in ImagePasteModal'); await inputState.sendMultimediaMessage(selection, threadInfo); }, [imagePasteStagingInfo, inputState, navigation, threadInfo]); const cancel = React.useCallback(async () => { navigation.goBackOnce(); await sleep(5000); filesystem.unlink(imagePasteStagingInfo.uri); }, [imagePasteStagingInfo.uri, navigation]); return (