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 as RNImage, Share as RNShare} from 'react-native'
|
||||||
import {Image} from 'react-native-image-crop-picker'
|
|
||||||
import * as RNFS from 'react-native-fs'
|
import * as RNFS from 'react-native-fs'
|
||||||
|
import {Image} from 'react-native-image-crop-picker'
|
||||||
import uuid from 'react-native-uuid'
|
import uuid from 'react-native-uuid'
|
||||||
import * as Sharing from 'expo-sharing'
|
|
||||||
import * as MediaLibrary from 'expo-media-library'
|
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 {isAndroid, isIOS} from 'platform/detection'
|
||||||
|
import {Dimensions} from './types'
|
||||||
|
|
||||||
export async function compressIfNeeded(
|
export async function compressIfNeeded(
|
||||||
img: Image,
|
img: Image,
|
||||||
|
|||||||
@@ -586,18 +586,17 @@ export function SearchScreen(
|
|||||||
const onPressClearQuery = React.useCallback(() => {
|
const onPressClearQuery = React.useCallback(() => {
|
||||||
scrollToTopWeb()
|
scrollToTopWeb()
|
||||||
setSearchText('')
|
setSearchText('')
|
||||||
setShowAutocompleteResults(false)
|
|
||||||
textInput.current?.focus()
|
textInput.current?.focus()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const onPressCancelSearch = React.useCallback(() => {
|
const onPressCancelSearch = React.useCallback(() => {
|
||||||
scrollToTopWeb()
|
scrollToTopWeb()
|
||||||
textInput.current?.blur()
|
|
||||||
setShowAutocompleteResults(false)
|
setShowAutocompleteResults(false)
|
||||||
|
|
||||||
if (inputIsFocused) {
|
if (inputIsFocused) {
|
||||||
setSearchText(queryTerm)
|
setSearchText(queryTerm)
|
||||||
setInputIsFocused(false)
|
// setInputIsFocused(false)
|
||||||
|
textInput.current?.blur()
|
||||||
} else {
|
} else {
|
||||||
if (isWeb && queryTerm) {
|
if (isWeb && queryTerm) {
|
||||||
navigation.goBack()
|
navigation.goBack()
|
||||||
@@ -610,9 +609,7 @@ export function SearchScreen(
|
|||||||
const onChangeText = React.useCallback(async (text: string) => {
|
const onChangeText = React.useCallback(async (text: string) => {
|
||||||
scrollToTopWeb()
|
scrollToTopWeb()
|
||||||
setSearchText(text)
|
setSearchText(text)
|
||||||
|
setShowAutocompleteResults(text.length > 0)
|
||||||
const showAutoComplete = text.length > 0
|
|
||||||
setShowAutocompleteResults(showAutoComplete)
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const updateSearchHistory = React.useCallback(
|
const updateSearchHistory = React.useCallback(
|
||||||
@@ -735,7 +732,11 @@ export function SearchScreen(
|
|||||||
// HACK
|
// HACK
|
||||||
// give 100ms to not stop click handlers in the search history
|
// give 100ms to not stop click handlers in the search history
|
||||||
// -prf
|
// -prf
|
||||||
setTimeout(() => setInputIsFocused(false), 100)
|
setTimeout(
|
||||||
|
() =>
|
||||||
|
setInputIsFocused(Boolean(textInput.current?.isFocused())),
|
||||||
|
100,
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
onChangeText={onChangeText}
|
onChangeText={onChangeText}
|
||||||
onSubmitEditing={onSubmit}
|
onSubmitEditing={onSubmit}
|
||||||
@@ -771,7 +772,11 @@ export function SearchScreen(
|
|||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
hitSlop={HITSLOP_10}>
|
hitSlop={HITSLOP_10}>
|
||||||
<Text style={[pal.text]}>
|
<Text style={[pal.text]}>
|
||||||
<Trans>Cancel</Trans>
|
{isWeb && !inputIsFocused && q ? (
|
||||||
|
<Trans>Back</Trans>
|
||||||
|
) : (
|
||||||
|
<Trans>Cancel</Trans>
|
||||||
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user