revert web changes
This commit is contained in:
@@ -37,13 +37,21 @@ import {
|
|||||||
type Params,
|
type Params,
|
||||||
parseSearchQuery,
|
parseSearchQuery,
|
||||||
} from '#/screens/Search/utils'
|
} from '#/screens/Search/utils'
|
||||||
import {atoms as a, native, tokens, useBreakpoints, useTheme, web} from '#/alf'
|
import {
|
||||||
|
atoms as a,
|
||||||
|
native,
|
||||||
|
platform,
|
||||||
|
tokens,
|
||||||
|
useBreakpoints,
|
||||||
|
useTheme,
|
||||||
|
web,
|
||||||
|
} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import {SearchInput} from '#/components/forms/SearchInput'
|
import {SearchInput} from '#/components/forms/SearchInput'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {useAnalytics} from '#/analytics'
|
import {useAnalytics} from '#/analytics'
|
||||||
import {IS_WEB} from '#/env'
|
import {IS_NATIVE, IS_WEB} from '#/env'
|
||||||
import {account, useStorage} from '#/storage'
|
import {account, useStorage} from '#/storage'
|
||||||
import type * as bsky from '#/types/bsky'
|
import type * as bsky from '#/types/bsky'
|
||||||
import {AutocompleteResults} from './components/AutocompleteResults'
|
import {AutocompleteResults} from './components/AutocompleteResults'
|
||||||
@@ -307,6 +315,15 @@ export function SearchScreenShell({
|
|||||||
}
|
}
|
||||||
}, [setShowAutocomplete])
|
}, [setShowAutocomplete])
|
||||||
|
|
||||||
|
const onSearchInputBlur = useCallback(() => {
|
||||||
|
// bind to focus state on native
|
||||||
|
// on web this doesn't work because of focus management
|
||||||
|
// which would render the autocomplete results uninteractable
|
||||||
|
if (IS_NATIVE) {
|
||||||
|
setShowAutocomplete(false)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
const focusSearchInput = useCallback(
|
const focusSearchInput = useCallback(
|
||||||
(tab?: TabParam) => {
|
(tab?: TabParam) => {
|
||||||
textInput.current?.focus()
|
textInput.current?.focus()
|
||||||
@@ -377,6 +394,7 @@ export function SearchScreenShell({
|
|||||||
ref={textInput}
|
ref={textInput}
|
||||||
value={searchText}
|
value={searchText}
|
||||||
onFocus={onSearchInputFocus}
|
onFocus={onSearchInputFocus}
|
||||||
|
onBlur={onSearchInputBlur}
|
||||||
onChangeText={onChangeText}
|
onChangeText={onChangeText}
|
||||||
onClearText={onPressClearQuery}
|
onClearText={onPressClearQuery}
|
||||||
onSubmitEditing={onSubmit('typed')}
|
onSubmitEditing={onSubmit('typed')}
|
||||||
@@ -424,6 +442,7 @@ export function SearchScreenShell({
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[a.flex_1, a.relative]}>
|
<View style={[a.flex_1, a.relative]}>
|
||||||
|
<View style={[web(showAutocomplete && a.hidden)]}>
|
||||||
<SearchScreenInner
|
<SearchScreenInner
|
||||||
key={params.lang}
|
key={params.lang}
|
||||||
activeTab={activeTab}
|
activeTab={activeTab}
|
||||||
@@ -433,15 +452,20 @@ export function SearchScreenShell({
|
|||||||
headerHeight={headerHeight}
|
headerHeight={headerHeight}
|
||||||
focusSearchInput={focusSearchInput}
|
focusSearchInput={focusSearchInput}
|
||||||
/>
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
{showAutocomplete && !fixedParams && (
|
{showAutocomplete && !fixedParams && (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
entering={native(FadeInDown.easing(Easing.out(Easing.cubic)))}
|
entering={native(FadeInDown.easing(Easing.out(Easing.cubic)))}
|
||||||
exiting={native(FadeOutDown.easing(Easing.out(Easing.cubic)))}
|
exiting={native(FadeOutDown.easing(Easing.out(Easing.cubic)))}
|
||||||
style={[a.absolute, a.inset_0, t.atoms.bg]}
|
style={[
|
||||||
accessibilityViewIsModal
|
t.atoms.bg,
|
||||||
accessibilityRole="list"
|
platform({
|
||||||
aria-modal>
|
web: [a.flex_1],
|
||||||
|
native: [a.absolute, a.inset_0],
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
accessibilityViewIsModal>
|
||||||
{searchText.length > 0 ? (
|
{searchText.length > 0 ? (
|
||||||
<AutocompleteResults
|
<AutocompleteResults
|
||||||
isAutocompleteFetching={isAutocompleteFetching}
|
isAutocompleteFetching={isAutocompleteFetching}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ function RecentSearchItem({
|
|||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.flex_1,
|
a.flex_1,
|
||||||
a.px_xl,
|
a.px_lg,
|
||||||
a.py_md,
|
a.py_md,
|
||||||
(hovered || focused || pressed) && t.atoms.bg_contrast_25,
|
(hovered || focused || pressed) && t.atoms.bg_contrast_25,
|
||||||
]}>
|
]}>
|
||||||
|
|||||||
Reference in New Issue
Block a user