From a3b9a1e6cfa0ad5e0a8ce4378de905d312c7fee3 Mon Sep 17 00:00:00 2001 From: Leon Jiang <35908040+leonyjiang@users.noreply.github.com> Date: Mon, 8 Mar 2021 06:39:28 -0500 Subject: Move setQuery('') to animation callback to hide re-render --- src/screens/search/SearchScreen.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') 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); }; -- cgit v1.2.3-70-g09d2