make entire recent search clickable (#3387)
parent
8de27160f5
commit
907c7c0586
|
@ -1,59 +1,60 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {
|
import {
|
||||||
View,
|
|
||||||
StyleSheet,
|
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
TextInput,
|
|
||||||
Pressable,
|
|
||||||
Platform,
|
Platform,
|
||||||
|
Pressable,
|
||||||
|
StyleSheet,
|
||||||
|
TextInput,
|
||||||
|
View,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {ScrollView, CenteredView} from '#/view/com/util/Views'
|
|
||||||
import {List} from '#/view/com/util/List'
|
|
||||||
import {AppBskyActorDefs, AppBskyFeedDefs, moderateProfile} from '@atproto/api'
|
import {AppBskyActorDefs, AppBskyFeedDefs, moderateProfile} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
|
||||||
import {useLingui} from '@lingui/react'
|
|
||||||
import {
|
import {
|
||||||
FontAwesomeIcon,
|
FontAwesomeIcon,
|
||||||
FontAwesomeIconStyle,
|
FontAwesomeIconStyle,
|
||||||
} from '@fortawesome/react-native-fontawesome'
|
} from '@fortawesome/react-native-fontawesome'
|
||||||
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
|
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||||
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {useAnalytics} from '#/lib/analytics/analytics'
|
||||||
|
import {HITSLOP_10} from '#/lib/constants'
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {MagnifyingGlassIcon} from '#/lib/icons'
|
||||||
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
|
import {augmentSearchQuery} from '#/lib/strings/helpers'
|
||||||
|
import {s} from '#/lib/styles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
|
import {listenSoftReset} from '#/state/events'
|
||||||
|
import {useActorAutocompleteFn} from '#/state/queries/actor-autocomplete'
|
||||||
|
import {useActorSearch} from '#/state/queries/actor-search'
|
||||||
|
import {useModerationOpts} from '#/state/queries/preferences'
|
||||||
|
import {useSearchPostsQuery} from '#/state/queries/search-posts'
|
||||||
|
import {useGetSuggestedFollowersByActor} from '#/state/queries/suggested-follows'
|
||||||
|
import {useSession} from '#/state/session'
|
||||||
|
import {useSetDrawerOpen} from '#/state/shell'
|
||||||
|
import {useSetDrawerSwipeDisabled, useSetMinimalShellMode} from '#/state/shell'
|
||||||
|
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||||
import {
|
import {
|
||||||
NativeStackScreenProps,
|
NativeStackScreenProps,
|
||||||
SearchTabNavigatorParams,
|
SearchTabNavigatorParams,
|
||||||
} from 'lib/routes/types'
|
} from 'lib/routes/types'
|
||||||
import {Text} from '#/view/com/util/text/Text'
|
import {useTheme} from 'lib/ThemeContext'
|
||||||
import {ProfileCardFeedLoadingPlaceholder} from 'view/com/util/LoadingPlaceholder'
|
|
||||||
import {ProfileCardWithFollowBtn} from '#/view/com/profile/ProfileCard'
|
|
||||||
import {Post} from '#/view/com/post/Post'
|
|
||||||
import {Pager} from '#/view/com/pager/Pager'
|
import {Pager} from '#/view/com/pager/Pager'
|
||||||
import {TabBar} from '#/view/com/pager/TabBar'
|
import {TabBar} from '#/view/com/pager/TabBar'
|
||||||
import {HITSLOP_10} from '#/lib/constants'
|
import {Post} from '#/view/com/post/Post'
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
import {ProfileCardWithFollowBtn} from '#/view/com/profile/ProfileCard'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {List} from '#/view/com/util/List'
|
||||||
import {useTheme} from 'lib/ThemeContext'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
import {useSession} from '#/state/session'
|
import {CenteredView, ScrollView} from '#/view/com/util/Views'
|
||||||
import {useGetSuggestedFollowersByActor} from '#/state/queries/suggested-follows'
|
|
||||||
import {useSearchPostsQuery} from '#/state/queries/search-posts'
|
|
||||||
import {useActorSearch} from '#/state/queries/actor-search'
|
|
||||||
import {useActorAutocompleteFn} from '#/state/queries/actor-autocomplete'
|
|
||||||
import {useSetDrawerOpen} from '#/state/shell'
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {MagnifyingGlassIcon} from '#/lib/icons'
|
|
||||||
import {useModerationOpts} from '#/state/queries/preferences'
|
|
||||||
import {
|
import {
|
||||||
MATCH_HANDLE,
|
MATCH_HANDLE,
|
||||||
SearchLinkCard,
|
SearchLinkCard,
|
||||||
SearchProfileCard,
|
SearchProfileCard,
|
||||||
} from '#/view/shell/desktop/Search'
|
} from '#/view/shell/desktop/Search'
|
||||||
import {useSetMinimalShellMode, useSetDrawerSwipeDisabled} from '#/state/shell'
|
import {ProfileCardFeedLoadingPlaceholder} from 'view/com/util/LoadingPlaceholder'
|
||||||
import {isNative, isWeb} from '#/platform/detection'
|
import {atoms as a} from '#/alf'
|
||||||
import {listenSoftReset} from '#/state/events'
|
|
||||||
import {s} from '#/lib/styles'
|
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
||||||
import {augmentSearchQuery} from '#/lib/strings/helpers'
|
|
||||||
import {NavigationProp} from '#/lib/routes/types'
|
|
||||||
|
|
||||||
function Loader() {
|
function Loader() {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
@ -776,16 +777,24 @@ export function SearchScreen(
|
||||||
<Trans>Recent Searches</Trans>
|
<Trans>Recent Searches</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
{searchHistory.map((historyItem, index) => (
|
{searchHistory.map((historyItem, index) => (
|
||||||
<View key={index} style={styles.historyItemContainer}>
|
<View
|
||||||
|
key={index}
|
||||||
|
style={[
|
||||||
|
a.flex_row,
|
||||||
|
a.mt_md,
|
||||||
|
a.justify_center,
|
||||||
|
a.justify_between,
|
||||||
|
]}>
|
||||||
<Pressable
|
<Pressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
onPress={() => handleHistoryItemClick(historyItem)}
|
onPress={() => handleHistoryItemClick(historyItem)}
|
||||||
style={styles.historyItem}>
|
style={[a.flex_1, a.py_sm]}>
|
||||||
<Text style={pal.text}>{historyItem}</Text>
|
<Text style={pal.text}>{historyItem}</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
<Pressable
|
<Pressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
onPress={() => handleRemoveHistoryItem(historyItem)}>
|
onPress={() => handleRemoveHistoryItem(historyItem)}
|
||||||
|
style={[a.px_md, a.py_xs, a.justify_center]}>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon="xmark"
|
icon="xmark"
|
||||||
size={16}
|
size={16}
|
||||||
|
@ -872,13 +881,4 @@ const styles = StyleSheet.create({
|
||||||
searchHistoryTitle: {
|
searchHistoryTitle: {
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
historyItem: {
|
|
||||||
paddingVertical: 8,
|
|
||||||
},
|
|
||||||
historyItemContainer: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'center',
|
|
||||||
paddingVertical: 8,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue