aboutsummaryrefslogtreecommitdiff
path: root/src/routes/main/MainStackScreen.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/main/MainStackScreen.tsx')
-rw-r--r--src/routes/main/MainStackScreen.tsx36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx
index 3e425101..c0cef3ea 100644
--- a/src/routes/main/MainStackScreen.tsx
+++ b/src/routes/main/MainStackScreen.tsx
@@ -1,6 +1,7 @@
+import AsyncStorage from '@react-native-community/async-storage';
import {RouteProp} from '@react-navigation/native';
import {StackNavigationOptions} from '@react-navigation/stack';
-import React from 'react';
+import React, {useState} from 'react';
import {
CaptionScreen,
CategorySelection,
@@ -12,6 +13,7 @@ import {
MomentUploadPromptScreen,
NotificationsScreen,
ProfileScreen,
+ RequestContactsAccess,
SearchScreen,
SocialMediaTaggs,
} from '../../screens';
@@ -42,6 +44,14 @@ const MainStackScreen: React.FC<MainStackProps> = ({route}) => {
const isSearchTab = screenType === ScreenType.Search;
const isNotificationsTab = screenType === ScreenType.Notifications;
+ AsyncStorage.getItem('respondedToAccessContacts').then((value) =>
+ setRespondedToAccessContacts(value ? value : 'false'),
+ );
+
+ const [respondedToAccessContacts, setRespondedToAccessContacts] = useState(
+ 'false',
+ );
+
const initialRouteName = (() => {
switch (screenType) {
case ScreenType.Profile:
@@ -90,13 +100,20 @@ const MainStackScreen: React.FC<MainStackProps> = ({route}) => {
screenType,
}}
/>
- {isSearchTab && (
- <MainStack.Screen
- name="Search"
- component={SearchScreen}
- initialParams={{screenType}}
- />
- )}
+ {isSearchTab &&
+ (respondedToAccessContacts && respondedToAccessContacts === 'true' ? (
+ <MainStack.Screen
+ name="Search"
+ component={SearchScreen}
+ initialParams={{screenType}}
+ />
+ ) : (
+ <MainStack.Screen
+ name="Search"
+ component={RequestContactsAccess}
+ initialParams={{screenType}}
+ />
+ ))}
{isNotificationsTab && (
<MainStack.Screen
name="Notifications"
@@ -180,9 +197,6 @@ const MainStackScreen: React.FC<MainStackProps> = ({route}) => {
<MainStack.Screen
name="FriendsListScreen"
component={FriendsListScreen}
- options={{
- ...modalStyle,
- }}
initialParams={{screenType}}
/>
<MainStack.Screen