diff --git a/native/chat/image-paste-modal.react.js b/native/chat/image-paste-modal.react.js index 59e1605e4..20aafc52b 100644 --- a/native/chat/image-paste-modal.react.js +++ b/native/chat/image-paste-modal.react.js @@ -1,112 +1,101 @@ // @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'; import sleep from 'lib/utils/sleep'; import Modal from '../components/modal.react'; import { InputStateContext } from '../input/input-state'; import type { RootNavigationProp } from '../navigation/root-navigator.react'; import type { NavigationRoute } from '../navigation/route-names'; import { useStyles } from '../themes/colors'; export type ImagePasteModalParams = {| +imagePasteStagingInfo: PhotoPaste, +threadID: string, |}; type Props = {| +navigation: RootNavigationProp<'ImagePasteModal'>, +route: NavigationRoute<'ImagePasteModal'>, |}; function ImagePasteModal(props: Props) { const styles = useStyles(unboundStyles); const inputState = React.useContext(InputStateContext); const { navigation, route: { params: { imagePasteStagingInfo, threadID }, }, } = props; const sendImage = React.useCallback(async () => { navigation.goBackOnce(); const selection: $ReadOnlyArray = [imagePasteStagingInfo]; invariant(inputState, 'inputState should be set in ImagePasteModal'); await inputState.sendMultimediaMessage(threadID, selection); invariant( imagePasteStagingInfo, 'imagePasteStagingInfo should be set in ImagePasteModal', ); }, [imagePasteStagingInfo, inputState, navigation, threadID]); const cancel = React.useCallback(async () => { navigation.goBackOnce(); await sleep(5000); filesystem.unlink(imagePasteStagingInfo.uri); }, [imagePasteStagingInfo.uri, navigation]); return ( - - + +