use replace on web still
This commit is contained in:
@@ -537,8 +537,14 @@ export function SearchScreen(
|
|||||||
setInputIsFocused(false)
|
setInputIsFocused(false)
|
||||||
setSearchText(queryParam)
|
setSearchText(queryParam)
|
||||||
} else {
|
} else {
|
||||||
// The empty object will remove `q=` from the URL
|
// If we just `setParams` and set `q` to an empty string, the URL still displays `q=`, which isn't pretty.
|
||||||
navigation.setParams({})
|
// 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])
|
}, [inputIsFocused, navigation, queryParam])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user