use setParams instead of replace

This commit is contained in:
Hailey
2024-04-26 13:36:18 -07:00
parent 907957ba45
commit 234537b8a6
+3 -3
View File
@@ -538,7 +538,7 @@ export function SearchScreen(
setSearchText(queryParam) setSearchText(queryParam)
} else { } else {
// The empty object will remove `q=` from the URL // The empty object will remove `q=` from the URL
navigation.replace('Search', {}) navigation.setParams({})
} }
}, [inputIsFocused, navigation, queryParam]) }, [inputIsFocused, navigation, queryParam])
@@ -572,14 +572,14 @@ export function SearchScreen(
) )
const onSubmit = React.useCallback(() => { const onSubmit = React.useCallback(() => {
textInput.current?.blur()
setInputIsFocused(false)
scrollToTopWeb() scrollToTopWeb()
updateSearchHistory(searchText) updateSearchHistory(searchText)
if (isWeb) { if (isWeb) {
navigation.push('Search', {q: searchText}) navigation.push('Search', {q: searchText})
} else { } else {
textInput.current?.blur()
setInputIsFocused(false)
navigation.setParams({q: searchText}) navigation.setParams({q: searchText})
} }
}, [navigation, searchText, updateSearchHistory]) }, [navigation, searchText, updateSearchHistory])