use replace on web still

This commit is contained in:
Hailey
2024-04-26 13:39:32 -07:00
parent 234537b8a6
commit 6e29cce90d
+8 -2
View File
@@ -537,8 +537,14 @@ export function SearchScreen(
setInputIsFocused(false)
setSearchText(queryParam)
} else {
// The empty object will remove `q=` from the URL
navigation.setParams({})
// If we just `setParams` and set `q` to an empty string, the URL still displays `q=`, which isn't pretty.
// However, `.replace()` on native has a "push" animation that we don't want. So we need to handle these
// differently.
if (isWeb) {
navigation.replace('Search', {})
} else {
navigation.setParams({q: ''})
}
}
}, [inputIsFocused, navigation, queryParam])