remove unnecesary usestate

This commit is contained in:
Hailey
2024-04-24 10:27:09 -07:00
parent 65b689d4af
commit ace0cb3ac9
+1 -6
View File
@@ -556,8 +556,6 @@ export function SearchScreen(
React.useState<AppBskyActorDefs.ProfileViewBasic[]>()
const [inputIsFocused, setInputIsFocused] = React.useState(false)
const [showAutocompleteResults, setShowAutocompleteResults] =
React.useState(false)
const [searchHistory, setSearchHistory] = React.useState<string[]>([])
if (q !== queryTerm) {
@@ -603,7 +601,6 @@ export function SearchScreen(
const onPressCancelSearch = React.useCallback(() => {
scrollToTopWeb()
setShowAutocompleteResults(false)
if (inputIsFocused) {
setSearchText(queryTerm)
@@ -621,7 +618,6 @@ export function SearchScreen(
const onChangeText = React.useCallback(async (text: string) => {
scrollToTopWeb()
setSearchText(text)
setShowAutocompleteResults(text.length > 0)
}, [])
const updateSearchHistory = React.useCallback(
@@ -650,7 +646,6 @@ export function SearchScreen(
const onSubmit = React.useCallback(() => {
scrollToTopWeb()
setShowAutocompleteResults(false)
updateSearchHistory(searchText)
setQueryTerm(searchText)
@@ -795,7 +790,7 @@ export function SearchScreen(
)}
</CenteredView>
{showAutocompleteResults ? (
{inputIsFocused && searchText.length > 0 ? (
<>
{/* TODO avoid showing spinner if we have any previous results -hailey */}
{(searchText && !autocompleteData) || !moderationOpts ? (