aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Jiang <35908040+leonyjiang@users.noreply.github.com>2021-03-08 06:39:28 -0500
committerLeon Jiang <35908040+leonyjiang@users.noreply.github.com>2021-03-08 06:39:28 -0500
commita3b9a1e6cfa0ad5e0a8ce4378de905d312c7fee3 (patch)
tree4b4cc7a37d47050c31c558d38a526be66f548a84
parent01800876e7441d0cc8e7ed77ac1ec9915c15a613 (diff)
Move setQuery('') to animation callback to hide re-render
-rw-r--r--src/screens/search/SearchScreen.tsx3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/screens/search/SearchScreen.tsx b/src/screens/search/SearchScreen.tsx
index 39feee3b..835a5622 100644
--- a/src/screens/search/SearchScreen.tsx
+++ b/src/screens/search/SearchScreen.tsx
@@ -112,14 +112,13 @@ const SearchScreen: React.FC = () => {
setSearching(true);
};
const handleCancel = () => {
- setQuery('');
Keyboard.dismiss();
const topOutConfig = {
duration: 180,
toValue: -SCREEN_HEIGHT,
easing: Easing.inOut(Easing.ease),
};
- timing(top, topOutConfig).start();
+ timing(top, topOutConfig).start(() => setQuery(''));
setSearching(false);
};