diff --git a/src/lib/media/manip.ts b/src/lib/media/manip.ts index a681627e67..429d340970 100644 --- a/src/lib/media/manip.ts +++ b/src/lib/media/manip.ts @@ -1,13 +1,14 @@ -import RNFetchBlob from 'rn-fetch-blob' -import ImageResizer from '@bam.tech/react-native-image-resizer' import {Image as RNImage, Share as RNShare} from 'react-native' -import {Image} from 'react-native-image-crop-picker' import * as RNFS from 'react-native-fs' +import {Image} from 'react-native-image-crop-picker' import uuid from 'react-native-uuid' -import * as Sharing from 'expo-sharing' import * as MediaLibrary from 'expo-media-library' -import {Dimensions} from './types' +import * as Sharing from 'expo-sharing' +import ImageResizer from '@bam.tech/react-native-image-resizer' +import RNFetchBlob from 'rn-fetch-blob' + import {isAndroid, isIOS} from 'platform/detection' +import {Dimensions} from './types' export async function compressIfNeeded( img: Image, diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx index 5dac2042d3..ea29b12c61 100644 --- a/src/view/screens/Search/Search.tsx +++ b/src/view/screens/Search/Search.tsx @@ -586,18 +586,17 @@ export function SearchScreen( const onPressClearQuery = React.useCallback(() => { scrollToTopWeb() setSearchText('') - setShowAutocompleteResults(false) textInput.current?.focus() }, []) const onPressCancelSearch = React.useCallback(() => { scrollToTopWeb() - textInput.current?.blur() setShowAutocompleteResults(false) if (inputIsFocused) { setSearchText(queryTerm) - setInputIsFocused(false) + // setInputIsFocused(false) + textInput.current?.blur() } else { if (isWeb && queryTerm) { navigation.goBack() @@ -610,9 +609,7 @@ export function SearchScreen( const onChangeText = React.useCallback(async (text: string) => { scrollToTopWeb() setSearchText(text) - - const showAutoComplete = text.length > 0 - setShowAutocompleteResults(showAutoComplete) + setShowAutocompleteResults(text.length > 0) }, []) const updateSearchHistory = React.useCallback( @@ -735,7 +732,11 @@ export function SearchScreen( // HACK // give 100ms to not stop click handlers in the search history // -prf - setTimeout(() => setInputIsFocused(false), 100) + setTimeout( + () => + setInputIsFocused(Boolean(textInput.current?.isFocused())), + 100, + ) }} onChangeText={onChangeText} onSubmitEditing={onSubmit} @@ -771,7 +772,11 @@ export function SearchScreen( accessibilityRole="button" hitSlop={HITSLOP_10}> - Cancel + {isWeb && !inputIsFocused && q ? ( + Back + ) : ( + Cancel + )}