From ea38a3965df2f194da37b1350eb4ed0baa3bd38b Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 22 Dec 2020 11:51:45 -0500 Subject: added default values (#147) --- src/components/search/SearchResults.tsx | 19 ++++++++++--------- src/screens/search/SearchScreen.tsx | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/components/search/SearchResults.tsx b/src/components/search/SearchResults.tsx index 9d95593a..bf355220 100644 --- a/src/components/search/SearchResults.tsx +++ b/src/components/search/SearchResults.tsx @@ -29,15 +29,16 @@ const SearchResults: React.FC = ({ } return ( - {results.map((profilePreview) => ( - - ))} + {results && + results.map((profilePreview) => ( + + ))} ); }; diff --git a/src/screens/search/SearchScreen.tsx b/src/screens/search/SearchScreen.tsx index b11f6a1a..78c0c5cc 100644 --- a/src/screens/search/SearchScreen.tsx +++ b/src/screens/search/SearchScreen.tsx @@ -37,7 +37,7 @@ const SearchScreen: React.FC = () => { const [query, setQuery] = useState(''); const [results, setResults] = useState>([]); const [recents, setRecents] = useState>( - recentSearches, + recentSearches ?? [], ); const [searching, setSearching] = useState(false); const top = Animated.useValue(-SCREEN_HEIGHT); -- cgit v1.2.3-70-g09d2