Change handling for mobile
parent
809c534d32
commit
f58e1149c9
|
@ -48,7 +48,7 @@ import {
|
||||||
SearchProfileCard,
|
SearchProfileCard,
|
||||||
} from '#/view/shell/desktop/Search'
|
} from '#/view/shell/desktop/Search'
|
||||||
import {useSetMinimalShellMode, useSetDrawerSwipeDisabled} from '#/state/shell'
|
import {useSetMinimalShellMode, useSetDrawerSwipeDisabled} from '#/state/shell'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
import {listenSoftReset} from '#/state/events'
|
import {listenSoftReset} from '#/state/events'
|
||||||
import {s} from '#/lib/styles'
|
import {s} from '#/lib/styles'
|
||||||
|
|
||||||
|
@ -626,7 +626,12 @@ export function SearchScreen(
|
||||||
keyboardDismissMode="on-drag">
|
keyboardDismissMode="on-drag">
|
||||||
<SearchLinkCard
|
<SearchLinkCard
|
||||||
label={_(msg`Search for "${query}"`)}
|
label={_(msg`Search for "${query}"`)}
|
||||||
to={`/search?q=${encodeURIComponent(query)}`}
|
onPress={isNative ? onSubmit : undefined}
|
||||||
|
to={
|
||||||
|
isNative
|
||||||
|
? undefined
|
||||||
|
: `/search?q=${encodeURIComponent(query)}`
|
||||||
|
}
|
||||||
style={{borderBottomWidth: 1}}
|
style={{borderBottomWidth: 1}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,36 @@ export const MATCH_HANDLE =
|
||||||
export function SearchLinkCard({
|
export function SearchLinkCard({
|
||||||
label,
|
label,
|
||||||
to,
|
to,
|
||||||
|
onPress,
|
||||||
style,
|
style,
|
||||||
}: {
|
}: {
|
||||||
label: string
|
label: string
|
||||||
to: string
|
to?: string
|
||||||
|
onPress?: () => void
|
||||||
style?: ViewStyle
|
style?: ViewStyle
|
||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
|
||||||
|
const inner = (
|
||||||
|
<View
|
||||||
|
style={[pal.border, {paddingVertical: 16, paddingHorizontal: 12}, style]}>
|
||||||
|
<Text type="md" style={[pal.text]}>
|
||||||
|
{label}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
|
||||||
|
if (onPress) {
|
||||||
|
return (
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={onPress}
|
||||||
|
accessibilityLabel={label}
|
||||||
|
accessibilityHint="">
|
||||||
|
{inner}
|
||||||
|
</TouchableOpacity>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link href={to} asAnchor anchorNoUnderline>
|
<Link href={to} asAnchor anchorNoUnderline>
|
||||||
<View
|
<View
|
||||||
|
|
Loading…
Reference in New Issue