use "back" on web in some cases
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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}>
|
||||
<Text style={[pal.text]}>
|
||||
<Trans>Cancel</Trans>
|
||||
{isWeb && !inputIsFocused && q ? (
|
||||
<Trans>Back</Trans>
|
||||
) : (
|
||||
<Trans>Cancel</Trans>
|
||||
)}
|
||||
</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user