diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-02-25 14:42:31 -0800 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-02-25 14:42:31 -0800 |
commit | 79edd43bd998e5f9f425b1c8150cd8f3592e47d6 (patch) | |
tree | 544022db5b50264c0bd80e9d4690310265ee0eef /src/routes/main/MainStackScreen.tsx | |
parent | 5c5e53799dde337ca9baa298c218f5cf02764226 (diff) |
try blocks, else
Diffstat (limited to 'src/routes/main/MainStackScreen.tsx')
-rw-r--r-- | src/routes/main/MainStackScreen.tsx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index aec860f2..5b3f1178 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -50,15 +50,23 @@ const MainStackScreen: React.FC<MainStackProps> = ({route}) => { const isSearchTab = screenType === ScreenType.Search; const isNotificationsTab = screenType === ScreenType.Notifications; const isSuggestedPeopleTab = screenType === ScreenType.SuggestedPeople; - - AsyncStorage.getItem('respondedToAccessContacts').then((value) => - setRespondedToAccessContacts(value ? value : 'false'), - ); - const [respondedToAccessContacts, setRespondedToAccessContacts] = useState( 'false', ); + const loadResponseToAccessContacts = () => { + try { + AsyncStorage.getItem('respondedToAccessContacts').then((value) => { + setRespondedToAccessContacts(value ? value : 'false'); + }); + } catch (err) { + console.log( + 'Unable to check and request permission to get access to user contacts', + ); + } + }; + loadResponseToAccessContacts(); + const initialRouteName = (() => { switch (screenType) { case ScreenType.Profile: |