diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 7 | ||||
-rw-r--r-- | src/components/suggestedPeople/MutualFriends.tsx | 1 | ||||
-rw-r--r-- | src/constants/strings.ts | 2 | ||||
-rw-r--r-- | src/routes/main/MainStackScreen.tsx | 18 | ||||
-rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 2 | ||||
-rw-r--r-- | src/screens/profile/ProfileScreen.tsx | 2 | ||||
-rw-r--r-- | src/screens/search/RequestContactsAccess.tsx | 22 | ||||
-rw-r--r-- | src/screens/search/SearchScreen.tsx | 2 | ||||
-rw-r--r-- | src/screens/suggestedPeople/SuggestedPeopleScreen.tsx | 10 |
9 files changed, 36 insertions, 30 deletions
diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 02ab94e7..0021b1c6 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -37,12 +37,14 @@ interface ProfilePreviewProps extends ViewProps { profilePreview: ProfilePreviewType; previewType: PreviewType; screenType: ScreenType; + setMFDrawer?: Function; } const ProfilePreview: React.FC<ProfilePreviewProps> = ({ profilePreview: {username, first_name, last_name, id, thumbnail_url}, previewType, screenType, + setMFDrawer, }) => { const navigation = useNavigation(); const {user: loggedInUser} = useSelector((state: RootState) => state.user); @@ -139,6 +141,11 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ ); } + // Close Mutual Friends drawer on suggested people upon navigation + if (setMFDrawer) { + setMFDrawer(false); + } + navigation.push('Profile', { userXId, screenType, diff --git a/src/components/suggestedPeople/MutualFriends.tsx b/src/components/suggestedPeople/MutualFriends.tsx index fdda104a..f72104d4 100644 --- a/src/components/suggestedPeople/MutualFriends.tsx +++ b/src/components/suggestedPeople/MutualFriends.tsx @@ -70,6 +70,7 @@ const MutualFriends: React.FC<MutualFriendsProps> = ({ previewType={'Suggested People Drawer'} screenType={ScreenType.SuggestedPeople} profilePreview={profilePreview} + setMFDrawer={setDrawerVisible} /> ))} </ScrollView> diff --git a/src/constants/strings.ts b/src/constants/strings.ts index 5ae19e9c..353e0d02 100644 --- a/src/constants/strings.ts +++ b/src/constants/strings.ts @@ -25,7 +25,7 @@ export const ERROR_INVALID_VERIFICATION_CODE_FORMAT = 'Please enter the 6 digit export const ERROR_INVLAID_CODE = 'The code entered is not valid!'; export const ERROR_LINK = (str: string) => `Unable to link with ${str}, Please check your login and try again`; export const ERROR_LOGIN = 'There was a problem logging you in, please refresh and try again'; -export const ERROR_LOGIN_FAILED = 'Login failed. Check your username and passoword, and try again'; +export const ERROR_LOGIN_FAILED = 'Login failed. Check your username and password, and try again'; export const ERROR_NEXT_PAGE = 'There was a problem while loading the next page 😓, try again in a couple minutes'; export const ERROR_PROFILE_CREATION_SHORT = 'Profile creation failed 😓'; export const ERROR_PWD_ACCOUNT = (str: string) => `Please make sure that the email / username entered is registered with us. You may contact our customer support at ${str}`; diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index 5b3f1178..acf0cd28 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -1,7 +1,7 @@ import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationOptions} from '@react-navigation/stack'; -import React, {useState} from 'react'; +import React, {useEffect, useState} from 'react'; import {StyleSheet, Text} from 'react-native'; import {normalize} from 'react-native-elements'; import BackIcon from '../../assets/icons/back-arrow.svg'; @@ -51,20 +51,20 @@ const MainStackScreen: React.FC<MainStackProps> = ({route}) => { const isNotificationsTab = screenType === ScreenType.Notifications; const isSuggestedPeopleTab = screenType === ScreenType.SuggestedPeople; const [respondedToAccessContacts, setRespondedToAccessContacts] = useState( - 'false', + 'true', ); const loadResponseToAccessContacts = () => { - try { - AsyncStorage.getItem('respondedToAccessContacts').then((value) => { + AsyncStorage.getItem('respondedToAccessContacts') + .then((value) => { setRespondedToAccessContacts(value ? value : 'false'); + }) + .catch((error) => { + console.log('Something went wrong', error); + setRespondedToAccessContacts('true'); }); - } catch (err) { - console.log( - 'Unable to check and request permission to get access to user contacts', - ); - } }; + loadResponseToAccessContacts(); const initialRouteName = (() => { diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 511680ea..aa53c4a9 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -153,7 +153,7 @@ const NotificationsScreen: React.FC = () => { return ( <SafeAreaView> - <StatusBar barStyle={'dark-content'} /> + <StatusBar barStyle="dark-content" /> <View style={styles.header}> <Text style={styles.headerText}>Notifications</Text> </View> diff --git a/src/screens/profile/ProfileScreen.tsx b/src/screens/profile/ProfileScreen.tsx index 9cdba555..5edc6277 100644 --- a/src/screens/profile/ProfileScreen.tsx +++ b/src/screens/profile/ProfileScreen.tsx @@ -46,7 +46,7 @@ const ProfileScreen: React.FC<ProfileOnboardingProps> = ({route}) => { return ( <> - <StatusBar /> + <StatusBar barStyle="dark-content" /> <Content {...{y, userXId, screenType}} /> <TabsGradient /> </> diff --git a/src/screens/search/RequestContactsAccess.tsx b/src/screens/search/RequestContactsAccess.tsx index 69de1ddf..08548c69 100644 --- a/src/screens/search/RequestContactsAccess.tsx +++ b/src/screens/search/RequestContactsAccess.tsx @@ -22,22 +22,12 @@ const RequestContactsAccess: React.FC = () => { const handleAllowAccess = async () => { try { - checkPermission().then((permission) => { - if (permission === 'undefined') { - requestPermission().then((response) => { - if (response === 'authorized' || response === 'denied') { - AsyncStorage.setItem( - 'respondedToAccessContacts', - 'true', - ).then(() => navigation.navigate('Search')); - } - }); - } else { - AsyncStorage.setItem('respondedToAccessContacts', 'true').then(() => - navigation.navigate('Search'), - ); - } - }); + let permission = await checkPermission(); + if (permission === 'undefined') { + await requestPermission(); + } + await AsyncStorage.setItem('respondedToAccessContacts', 'true'); + navigation.navigate('Search'); } catch (err) { console.log( 'Unable to check and request permission to get access to user contacts', diff --git a/src/screens/search/SearchScreen.tsx b/src/screens/search/SearchScreen.tsx index f0be7c9e..84efa931 100644 --- a/src/screens/search/SearchScreen.tsx +++ b/src/screens/search/SearchScreen.tsx @@ -139,7 +139,7 @@ const SearchScreen: React.FC = () => { return ( <SearchBackground> - <StatusBar /> + <StatusBar barStyle="dark-content" /> <ScrollView scrollEnabled={!searching} keyboardShouldPersistTaps={'always'} diff --git a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx index 702e60e2..ec9d2f01 100644 --- a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx +++ b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx @@ -6,6 +6,7 @@ import React, { useEffect, useState, useMemo, + useRef, } from 'react'; import { FlatList, @@ -70,7 +71,7 @@ const SuggestedPeopleScreen: React.FC = () => { const [refreshing, setRefreshing] = useState(false); const [shouldResetData, setShouldResetData] = useState(false); const [hideStatusBar, setHideStatusBar] = useState(false); - + const stausBarRef = useRef(hideStatusBar); // loads data and append it to users based on current page useEffect(() => { loadMore(); @@ -153,6 +154,12 @@ const SuggestedPeopleScreen: React.FC = () => { } }; navigateToAnimatedTutorial(); + StatusBar.setHidden(stausBarRef.current); + StatusBar.setBarStyle('light-content'); + return () => { + StatusBar.setHidden(false); + StatusBar.setBarStyle('dark-content'); + }; }, [navigation, suggested_people_linked]), ); @@ -191,6 +198,7 @@ const SuggestedPeopleScreen: React.FC = () => { const onViewableItemsChanged = useCallback( ({viewableItems}: {viewableItems: ViewToken[]}) => { setHideStatusBar(viewableItems[0].index !== 0); + stausBarRef.current = viewableItems[0].index !== 0; }, [], ); |