From c32197f793005a81a0a06c6d755ed374078624c3 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Mon, 8 Feb 2021 14:43:20 -0800 Subject: navigation bar to go to suggested people --- .../navigationIcons/suggested-people-clicked.png | Bin 0 -> 435183 bytes src/assets/navigationIcons/suggested-people.png | Bin 0 -> 673387 bytes src/components/common/NavigationIcon.tsx | 13 ++++++++- src/routes/main/MainStackNavigator.tsx | 1 + src/routes/main/MainStackScreen.tsx | 12 +++++++++ src/routes/tabs/NavigationBar.tsx | 9 +++++++ src/screens/index.ts | 1 + .../suggestedPeople/SuggestedPeopleScreen.tsx | 30 +++++++++++++++++++++ src/screens/suggestedPeople/index.ts | 1 + src/types/types.ts | 1 + 10 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/assets/navigationIcons/suggested-people-clicked.png create mode 100644 src/assets/navigationIcons/suggested-people.png create mode 100644 src/screens/suggestedPeople/SuggestedPeopleScreen.tsx create mode 100644 src/screens/suggestedPeople/index.ts (limited to 'src') diff --git a/src/assets/navigationIcons/suggested-people-clicked.png b/src/assets/navigationIcons/suggested-people-clicked.png new file mode 100644 index 00000000..e297b2e6 Binary files /dev/null and b/src/assets/navigationIcons/suggested-people-clicked.png differ diff --git a/src/assets/navigationIcons/suggested-people.png b/src/assets/navigationIcons/suggested-people.png new file mode 100644 index 00000000..d19cc167 Binary files /dev/null and b/src/assets/navigationIcons/suggested-people.png differ diff --git a/src/components/common/NavigationIcon.tsx b/src/components/common/NavigationIcon.tsx index 4bf35360..1a9934f2 100644 --- a/src/components/common/NavigationIcon.tsx +++ b/src/components/common/NavigationIcon.tsx @@ -8,7 +8,13 @@ import { } from 'react-native'; interface NavigationIconProps extends TouchableOpacityProps { - tab: 'Home' | 'Search' | 'Upload' | 'Notifications' | 'Profile'; + tab: + | 'Home' + | 'Search' + | 'Upload' + | 'Notifications' + | 'Profile' + | 'SuggestedPeople'; disabled?: boolean; newIcon?: boolean; } @@ -43,6 +49,11 @@ const NavigationIcon = (props: NavigationIconProps) => { ? require('../../assets/navigationIcons/profile.png') : require('../../assets/navigationIcons/profile-clicked.png'); break; + case 'SuggestedPeople': + imgSrc = props.disabled + ? require('../../assets/navigationIcons/suggested-people.png') + : require('../../assets/navigationIcons/suggested-people-clicked.png'); + break; default: imgSrc = null; } diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx index 74993af9..04d2fc38 100644 --- a/src/routes/main/MainStackNavigator.tsx +++ b/src/routes/main/MainStackNavigator.tsx @@ -11,6 +11,7 @@ import { } from '../../types'; export type MainStackParams = { + SuggestedPeople: {screenType: ScreenType}; Search: { screenType: ScreenType; }; diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index c0cef3ea..15950729 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -16,6 +16,7 @@ import { RequestContactsAccess, SearchScreen, SocialMediaTaggs, + SuggestedPeopleScreen, } from '../../screens'; import {ScreenType} from '../../types'; import {AvatarHeaderHeight, SCREEN_WIDTH} from '../../utils'; @@ -43,6 +44,7 @@ const MainStackScreen: React.FC = ({route}) => { // const isProfileTab = screenType === ScreenType.Profile; const isSearchTab = screenType === ScreenType.Search; const isNotificationsTab = screenType === ScreenType.Notifications; + const isSuggestedPeopleTab = screenType === ScreenType.SuggestedPeople; AsyncStorage.getItem('respondedToAccessContacts').then((value) => setRespondedToAccessContacts(value ? value : 'false'), @@ -60,6 +62,8 @@ const MainStackScreen: React.FC = ({route}) => { return 'Search'; case ScreenType.Notifications: return 'Notifications'; + case ScreenType.SuggestedPeople: + return 'SuggestedPeople'; } })(); @@ -77,6 +81,7 @@ const MainStackScreen: React.FC = ({route}) => { }), }; + console.log('screenType: ', screenType); return ( = ({route}) => { initialParams={{screenType}} /> )} + {isSuggestedPeopleTab && console.log('triggered') && ( + + )} { ); case 'Profile': return ; + case 'SuggestedPeople': + return ( + + ); default: return ; } @@ -72,6 +76,11 @@ const NavigationBar: React.FC = () => { bottom: '1%', }, }}> + { + /** + * This is a double safety check to avoid app crash. + * Checks if the required userXId is present in the store, if not userXId is set to dummy id + */ + // if (userXId && !(userXId in useStore().getState().userX[screenType])) { + // userXId = DUMMY_USERID; + // } + + return ( + <> + {/* */} + + Suggested People + + ); +}; + +export default SuggestedPeopleScreen; diff --git a/src/screens/suggestedPeople/index.ts b/src/screens/suggestedPeople/index.ts new file mode 100644 index 00000000..a42d9c52 --- /dev/null +++ b/src/screens/suggestedPeople/index.ts @@ -0,0 +1 @@ +export {default as SuggestedPeopleScreen} from './SuggestedPeopleScreen'; diff --git a/src/types/types.ts b/src/types/types.ts index ab995292..7fccaa44 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -114,6 +114,7 @@ export enum ScreenType { Profile, Search, Notifications, + SuggestedPeople, } export type ExploreSectionType = -- cgit v1.2.3-70-g09d2 From 8fa21aabb237586cf9cffd59ae573f2ba48857e9 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Mon, 8 Feb 2021 19:19:16 -0800 Subject: changed status bar from default to black --- src/screens/main/NotificationsScreen.tsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index f35bb22c..266ba3f9 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -5,6 +5,7 @@ import React, {useCallback, useEffect, useState} from 'react'; import { RefreshControl, SectionList, + StatusBar, StyleSheet, Text, View, @@ -146,6 +147,7 @@ const NotificationsScreen: React.FC = () => { return ( + Notifications -- cgit v1.2.3-70-g09d2 From a25ec0b95017a9b6e0c3392f8fe1ad4c604de520 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 9 Feb 2021 11:25:10 -0500 Subject: added newVersionAvailable to store, added logic to request newest version --- src/constants/api.ts | 2 +- src/routes/Routes.tsx | 34 +++++++++++++++++++++++++--------- src/screens/onboarding/Login.tsx | 12 ++++-------- src/services/CommonService.ts | 11 +++++++++++ src/store/actions/user.ts | 32 ++++++++++++++++++++++++-------- src/store/initialStates.ts | 1 + src/store/reducers/userReducer.ts | 5 +++++ 7 files changed, 71 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/constants/api.ts b/src/constants/api.ts index 32631be0..165bd550 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -3,7 +3,7 @@ const BASE_URL: string = 'http://127.0.0.1:8000/'; // local server const API_URL: string = BASE_URL + 'api/'; export const LOGIN_ENDPOINT: string = API_URL + 'login/'; -export const LOGOUT_ENDPOINT: string = API_URL + 'logout/'; +export const VERSION_ENDPOINT: string = API_URL + 'version/'; export const REGISTER_ENDPOINT: string = API_URL + 'register/'; export const EDIT_PROFILE_ENDPOINT: string = API_URL + 'edit-profile/'; export const SEND_OTP_ENDPOINT: string = API_URL + 'send-otp/'; diff --git a/src/routes/Routes.tsx b/src/routes/Routes.tsx index a5383a47..1cbc9bc5 100644 --- a/src/routes/Routes.tsx +++ b/src/routes/Routes.tsx @@ -1,18 +1,23 @@ -import React, {useEffect} from 'react'; -import NavigationBar from './tabs'; -import Onboarding from './onboarding'; -import {useSelector, useDispatch} from 'react-redux'; +import messaging from '@react-native-firebase/messaging'; +import React, {useEffect, useState} from 'react'; +import DeviceInfo from 'react-native-device-info'; +import SplashScreen from 'react-native-splash-screen'; +import {useDispatch, useSelector} from 'react-redux'; +import {fcmService, getLiveVersion} from '../services'; +import { + updateNewNotificationReceived, + updateNewVersionAvailable, +} from '../store/actions'; import {RootState} from '../store/rootReducer'; import {userLogin} from '../utils'; -import SplashScreen from 'react-native-splash-screen'; -import messaging from '@react-native-firebase/messaging'; -import {updateNewNotificationReceived} from '../store/actions'; -import {fcmService} from '../services'; +import Onboarding from './onboarding'; +import NavigationBar from './tabs'; const Routes: React.FC = () => { const { user: {userId}, } = useSelector((state: RootState) => state.user); + const [newVersionAvailable, setNewVersionAvailable] = useState(false); const dispatch = useDispatch(); /** @@ -47,7 +52,18 @@ const Routes: React.FC = () => { } }); - return userId ? : ; + useEffect(() => { + const checkVersion = async () => { + const liveVersion = await getLiveVersion(); + if (liveVersion && liveVersion !== DeviceInfo.getVersion()) { + setNewVersionAvailable(true); + dispatch(updateNewVersionAvailable(true)); + } + }; + checkVersion(); + }); + + return userId && !newVersionAvailable ? : ; }; export default Routes; diff --git a/src/screens/onboarding/Login.tsx b/src/screens/onboarding/Login.tsx index 2db039c1..4d1fb09a 100644 --- a/src/screens/onboarding/Login.tsx +++ b/src/screens/onboarding/Login.tsx @@ -13,7 +13,7 @@ import { TouchableOpacity, } from 'react-native'; import SplashScreen from 'react-native-splash-screen'; -import {useDispatch} from 'react-redux'; +import {useDispatch, useSelector} from 'react-redux'; import {Background, TaggInput, TaggSquareButton} from '../../components'; import {LOGIN_ENDPOINT, usernameRegex} from '../../constants'; import { @@ -25,6 +25,7 @@ import { } from '../../constants/strings'; import {OnboardingStackParams} from '../../routes/onboarding'; import {fcmService} from '../../services'; +import {RootState} from '../../store/rootReducer'; import {BackgroundGradientType, UserType} from '../../types'; import {normalize, userLogin} from '../../utils'; @@ -45,11 +46,6 @@ const Login: React.FC = ({navigation}: LoginProps) => { // ref for focusing on input fields const inputRef = useRef(); - const NO_USER: UserType = { - userId: '', - username: '', - }; - // login form state const [form, setForm] = React.useState({ username: '', @@ -59,7 +55,7 @@ const Login: React.FC = ({navigation}: LoginProps) => { attemptedSubmit: false, token: '', }); - const [user, setUser] = useState(NO_USER); + const {newVersionAvailable} = useSelector((state: RootState) => state.user); /** * Redux Store stuff @@ -167,7 +163,6 @@ const Login: React.FC = ({navigation}: LoginProps) => { userLogin(dispatch, {userId: data.UserID, username}); fcmService.sendFcmTokenToServer(); } catch (err) { - setUser(NO_USER); console.log(data); Alert.alert(ERROR_INVALID_LOGIN); } @@ -216,6 +211,7 @@ const Login: React.FC = ({navigation}: LoginProps) => { style={styles.container} gradientType={BackgroundGradientType.Light}> + {/* */} diff --git a/src/services/CommonService.ts b/src/services/CommonService.ts index dfbbf70e..9fa7417f 100644 --- a/src/services/CommonService.ts +++ b/src/services/CommonService.ts @@ -1,4 +1,5 @@ import RNFetchBlob from 'rn-fetch-blob'; +import {VERSION_ENDPOINT} from '../constants'; export const loadImageFromURL = async (url: string) => { try { @@ -20,3 +21,13 @@ export const loadImageFromURL = async (url: string) => { return undefined; } }; + +export const getLiveVersion = async () => { + try { + const response = await fetch(VERSION_ENDPOINT, {method: 'GET'}); + return response.status === 200 ? await response.json() : undefined; + } catch (error) { + console.log(error); + return undefined; + } +}; diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 5f49a103..589e6f0d 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -1,18 +1,19 @@ -import { CommentThreadType } from './../../types/types'; -import {RootState} from '../rootReducer'; -import {UserType} from '../../types/types'; -import {loadProfileInfo, loadAvatar, loadCover} from '../../services'; import {Action, ThunkAction} from '@reduxjs/toolkit'; +import {loadAvatar, loadCover, loadProfileInfo} from '../../services'; +import {UserType} from '../../types/types'; +import {getTokenOrLogout} from '../../utils'; import { - userLoggedIn, - userDetailsFetched, - socialEdited, profileCompletionStageUpdated, setIsOnboardedUser, setNewNotificationReceived, + setNewVersionAvailable, setReplyPosted, + socialEdited, + userDetailsFetched, + userLoggedIn, } from '../reducers'; -import {getTokenOrLogout} from '../../utils'; +import {RootState} from '../rootReducer'; +import {CommentThreadType} from './../../types/types'; /** * Entry point to our store. @@ -98,6 +99,21 @@ export const updateIsOnboardedUser = ( } }; +export const updateNewVersionAvailable = ( + newVersionAvailable: boolean, +): ThunkAction, RootState, unknown, Action> => async ( + dispatch, +) => { + try { + dispatch({ + type: setNewVersionAvailable.type, + payload: {newVersionAvailable}, + }); + } catch (error) { + console.log(error); + } +}; + export const updateNewNotificationReceived = ( newNotificationReceived: boolean, ): ThunkAction, RootState, unknown, Action> => async ( diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index 8d137a5d..6ca133e0 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -44,6 +44,7 @@ export const NO_USER_DATA = { avatar: '', cover: '', isOnboardedUser: false, + newVersionAvailable: false, newNotificationReceived: false, replyPosted: undefined, }; diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index 1e575339..29ec38cc 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -57,6 +57,10 @@ const userDataSlice = createSlice({ setReplyPosted: (state, action) => { state.replyPosted = action.payload.replyPosted; }, + + setNewVersionAvailable: (state, action) => { + state.newVersionAvailable = action.payload.newVersionAvailable; + }, }, }); @@ -66,6 +70,7 @@ export const { socialEdited, profileCompletionStageUpdated, setIsOnboardedUser, + setNewVersionAvailable, setNewNotificationReceived, setReplyPosted, } = userDataSlice.actions; -- cgit v1.2.3-70-g09d2 From dbbbcfd6c73979632d42429479f0ce2e5c9987a4 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 9 Feb 2021 13:47:35 -0500 Subject: using centered view, updated TaggSquareButton styles --- src/assets/images/logo-purple.png | Bin 0 -> 12702 bytes src/components/common/SocialLinkModal.tsx | 80 +++++++++++++---------------- src/components/common/TaggSquareButton.tsx | 41 ++++++++++----- src/screens/onboarding/Login.tsx | 12 +++-- src/screens/onboarding/WelcomeScreen.tsx | 5 +- 5 files changed, 76 insertions(+), 62 deletions(-) create mode 100644 src/assets/images/logo-purple.png (limited to 'src') diff --git a/src/assets/images/logo-purple.png b/src/assets/images/logo-purple.png new file mode 100644 index 00000000..48768f67 Binary files /dev/null and b/src/assets/images/logo-purple.png differ diff --git a/src/components/common/SocialLinkModal.tsx b/src/components/common/SocialLinkModal.tsx index d3bc3945..67a3f074 100644 --- a/src/components/common/SocialLinkModal.tsx +++ b/src/components/common/SocialLinkModal.tsx @@ -4,6 +4,7 @@ import {TextInput} from 'react-native-gesture-handler'; import {SocialIcon} from '.'; import CloseIcon from '../../assets/ionicons/close-outline.svg'; import {normalize, SCREEN_WIDTH} from '../../utils'; +import CenteredView from './CenteredView'; import TaggSquareButton from './TaggSquareButton'; interface SocialLinkModalProps { @@ -34,55 +35,46 @@ const SocialLinkModal: React.FC = ({ }; return ( - <> - - {}}> - - - - - - - {social} - - Insert your {social.toLowerCase()} username to link your{' '} - {social.toLowerCase()} account to your profile! - - - - + + {}}> + + + + + + + {social} + + Insert your {social.toLowerCase()} username to link your{' '} + {social.toLowerCase()} account to your profile! + + + - - - + + + ); }; const styles = StyleSheet.create({ - centeredView: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, modalView: { width: SCREEN_WIDTH * 0.8, backgroundColor: 'white', diff --git a/src/components/common/TaggSquareButton.tsx b/src/components/common/TaggSquareButton.tsx index 78a90554..817a2690 100644 --- a/src/components/common/TaggSquareButton.tsx +++ b/src/components/common/TaggSquareButton.tsx @@ -3,6 +3,7 @@ import { GestureResponderEvent, StyleSheet, Text, + TextStyle, TouchableOpacity, ViewProps, ViewStyle, @@ -14,14 +15,16 @@ import {normalize, SCREEN_WIDTH} from '../../utils'; interface TaggSquareButtonProps extends ViewProps { onPress: (event: GestureResponderEvent) => void; title: string; - mode: 'normal' | 'large' | 'gradient'; - color: 'purple' | 'white'; + buttonStyle: 'normal' | 'large' | 'gradient'; + buttonColor: 'purple' | 'white'; + labelColor: 'white' | 'blue'; style?: ViewStyle; + labelStyle?: TextStyle; } const TaggSquareButton: React.FC = (props) => { - const buttonStyles = (() => { - switch (props.color) { + const buttonColor = (() => { + switch (props.buttonColor) { case 'purple': return {backgroundColor: TAGG_PURPLE}; case 'white': @@ -29,24 +32,37 @@ const TaggSquareButton: React.FC = (props) => { return {backgroundColor: 'white'}; } })(); - switch (props.mode) { + const labelColor = (() => { + switch (props.labelColor) { + case 'white': + return {color: 'white'}; + case 'blue': + default: + return {color: '#78A0EF'}; + } + })(); + switch (props.buttonStyle) { case 'large': return ( - {props.title} + style={[styles.largeButton, buttonColor, props.style]}> + + {props.title} + ); case 'gradient': return ( - + - {props.title} + + {props.title} + ); @@ -55,8 +71,10 @@ const TaggSquareButton: React.FC = (props) => { return ( - {props.title} + style={[styles.normalButton, buttonColor, props.style]}> + + {props.title} + ); } @@ -86,7 +104,6 @@ const styles = StyleSheet.create({ normalLabel: { fontSize: normalize(20), fontWeight: '500', - color: '#78A0EF', }, gradientButton: { marginTop: '8%', diff --git a/src/screens/onboarding/Login.tsx b/src/screens/onboarding/Login.tsx index 4d1fb09a..450c5039 100644 --- a/src/screens/onboarding/Login.tsx +++ b/src/screens/onboarding/Login.tsx @@ -28,6 +28,7 @@ import {fcmService} from '../../services'; import {RootState} from '../../store/rootReducer'; import {BackgroundGradientType, UserType} from '../../types'; import {normalize, userLogin} from '../../utils'; +import UpdateRequired from './UpdateRequired'; type VerificationScreenRouteProp = RouteProp; type VerificationScreenNavigationProp = StackNavigationProp< @@ -212,6 +213,7 @@ const Login: React.FC = ({navigation}: LoginProps) => { gradientType={BackgroundGradientType.Light}> {/* */} + @@ -255,14 +257,16 @@ const Login: React.FC = ({navigation}: LoginProps) => { diff --git a/src/screens/onboarding/WelcomeScreen.tsx b/src/screens/onboarding/WelcomeScreen.tsx index bfb1a127..ae31f933 100644 --- a/src/screens/onboarding/WelcomeScreen.tsx +++ b/src/screens/onboarding/WelcomeScreen.tsx @@ -39,8 +39,9 @@ const WelcomeScreen: React.FC = ({navigation}) => { -- cgit v1.2.3-70-g09d2 From 55b1102ce08376a5dce6c9cd9380b13ac4bf3960 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 9 Feb 2021 13:47:49 -0500 Subject: updated required modal --- src/screens/onboarding/UpdateRequired.tsx | 80 +++++++++++++++++++++++++++++++ src/screens/onboarding/index.ts | 1 + 2 files changed, 81 insertions(+) create mode 100644 src/screens/onboarding/UpdateRequired.tsx (limited to 'src') diff --git a/src/screens/onboarding/UpdateRequired.tsx b/src/screens/onboarding/UpdateRequired.tsx new file mode 100644 index 00000000..17fcc6cf --- /dev/null +++ b/src/screens/onboarding/UpdateRequired.tsx @@ -0,0 +1,80 @@ +import React from 'react'; +import {Image, Modal, StyleSheet, View} from 'react-native'; +import {Text} from 'react-native-animatable'; +import {CenteredView, TaggSquareButton} from '../../components'; +import {normalize, SCREEN_WIDTH} from '../../utils'; + +interface UpdateRequiredProps { + visible: boolean; +} + +const UpdateRequired: React.FC = ({visible}) => { + return ( + + + + + Update Required + + You have to update your app to continue using Tagg, please download + the latest version from the app store + + {}} + buttonStyle={'normal'} + buttonColor={'purple'} + labelColor={'white'} + labelStyle={styles.button} + /> + + + + ); +}; + +const styles = StyleSheet.create({ + contentContainer: { + marginTop: '20%', + width: SCREEN_WIDTH * 0.9, + backgroundColor: 'white', + borderRadius: 5, + padding: '10%', + alignItems: 'center', + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 2, + }, + shadowOpacity: 0.25, + shadowRadius: 3.84, + elevation: 5, + }, + logo: { + width: normalize(60), + height: normalize(60), + marginBottom: '10%', + }, + header: { + fontSize: normalize(17), + fontWeight: '700', + lineHeight: 20, + marginBottom: '5%', + }, + body: { + fontSize: normalize(13), + color: 'grey', + lineHeight: 20, + textAlign: 'center', + width: SCREEN_WIDTH * 0.8, + marginBottom: '10%', + }, + button: { + fontWeight: '700', + }, +}); + +export default UpdateRequired; diff --git a/src/screens/onboarding/index.ts b/src/screens/onboarding/index.ts index 14d0e405..596683e5 100644 --- a/src/screens/onboarding/index.ts +++ b/src/screens/onboarding/index.ts @@ -14,3 +14,4 @@ export {default as CategorySelection} from './CategorySelection'; export {default as AddWaitlistUserScreen} from './AddWaitlistUserScreen'; export {default as WaitlistSuccessScreen} from './WaitlistSuccessScreen'; export {default as CreateCustomCategory} from './CreateCustomCategory'; +export {default as UpdateRequired} from './UpdateRequired'; -- cgit v1.2.3-70-g09d2 From 952eb1b9b58362cc4ead737554872197ae8a89b1 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 9 Feb 2021 14:06:06 -0500 Subject: added actual url to redirect, fixed bug for twitter handle redirect --- src/components/taggs/TwitterTaggPost.tsx | 11 +++++------ src/screens/onboarding/UpdateRequired.tsx | 8 ++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/components/taggs/TwitterTaggPost.tsx b/src/components/taggs/TwitterTaggPost.tsx index 0cfde857..834e32ef 100644 --- a/src/components/taggs/TwitterTaggPost.tsx +++ b/src/components/taggs/TwitterTaggPost.tsx @@ -3,11 +3,7 @@ import {Image, Linking, StyleSheet, View} from 'react-native'; import {Text} from 'react-native-animatable'; import Hyperlink from 'react-native-hyperlink'; import LinearGradient from 'react-native-linear-gradient'; -import { - AVATAR_DIM, - TAGGS_GRADIENT, - TAGG_LIGHT_BLUE, -} from '../../constants'; +import {AVATAR_DIM, TAGGS_GRADIENT, TAGG_LIGHT_BLUE} from '../../constants'; import {TwitterPostType} from '../../types'; import {handleOpenSocialUrlOnBrowser, SCREEN_WIDTH} from '../../utils'; import {DateLabel, PostCarousel} from '../common'; @@ -94,7 +90,10 @@ const TwitterTaggPost: React.FC = ({ - openTwitterProfileLink(post.in_reply_to?.handle) + handleOpenSocialUrlOnBrowser( + post.in_reply_to?.handle, + 'Twitter', + ) }> @{post.in_reply_to.handle} diff --git a/src/screens/onboarding/UpdateRequired.tsx b/src/screens/onboarding/UpdateRequired.tsx index 17fcc6cf..adf7ba71 100644 --- a/src/screens/onboarding/UpdateRequired.tsx +++ b/src/screens/onboarding/UpdateRequired.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {Image, Modal, StyleSheet, View} from 'react-native'; +import {Image, Linking, Modal, StyleSheet, View} from 'react-native'; import {Text} from 'react-native-animatable'; import {CenteredView, TaggSquareButton} from '../../components'; import {normalize, SCREEN_WIDTH} from '../../utils'; @@ -24,7 +24,11 @@ const UpdateRequired: React.FC = ({visible}) => { {}} + onPress={() => { + Linking.openURL( + 'https://apps.apple.com/us/app/tagg-discover-your-community/id1537853613', + ); + }} buttonStyle={'normal'} buttonColor={'purple'} labelColor={'white'} -- cgit v1.2.3-70-g09d2 From c9a8f87a29e12bfb78939fa9a94b6f8919b04836 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 4 Feb 2021 16:58:40 -0500 Subject: refactored header styles # Conflicts: # src/components/common/FriendsButton.tsx # src/screens/profile/FriendsListScreen.tsx # src/screens/profile/MomentCommentsScreen.tsx --- src/assets/icons/back-arrow.svg | 2 +- src/components/common/FriendsButton.tsx | 1 - src/routes/main/MainStackScreen.tsx | 59 +++++++++++++++++++++++++--- src/screens/profile/FriendsListScreen.tsx | 36 +++++------------ src/screens/profile/MomentCommentsScreen.tsx | 27 +++++++------ 5 files changed, 79 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/assets/icons/back-arrow.svg b/src/assets/icons/back-arrow.svg index aa203dea..16beae5a 100644 --- a/src/assets/icons/back-arrow.svg +++ b/src/assets/icons/back-arrow.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/common/FriendsButton.tsx b/src/components/common/FriendsButton.tsx index c7f56e2d..243a551d 100644 --- a/src/components/common/FriendsButton.tsx +++ b/src/components/common/FriendsButton.tsx @@ -78,7 +78,6 @@ const styles = StyleSheet.create({ borderRadius: 3, marginRight: '2%', marginLeft: '1%', - padding: 0, backgroundColor: 'transparent', }, requestedButtonTitle: { diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index c0cef3ea..0141a418 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -20,6 +20,10 @@ import { import {ScreenType} from '../../types'; import {AvatarHeaderHeight, SCREEN_WIDTH} from '../../utils'; import {MainStack, MainStackParams} from './MainStackNavigator'; +import BackIcon from '../../assets/icons/back-arrow.svg'; +import {StyleSheet, Text} from 'react-native'; +import {normalize} from 'react-native-elements'; +import {StackHeaderOptions} from '@react-navigation/stack/lib/typescript/src/types'; /** * Profile : To display the logged in user's profile when the userXId passed in to it is (undefined | null | empty string) else displays profile of the user being visited. @@ -185,6 +189,9 @@ const MainStackScreen: React.FC = ({route}) => { name="MomentCommentsScreen" component={MomentCommentsScreen} initialParams={{screenType}} + options={{ + ...headerBarOptions('black', 'Comments'), + }} /> = ({route}) => { name="FriendsListScreen" component={FriendsListScreen} initialParams={{screenType}} + options={{ + ...headerBarOptions('black', 'Friends'), + }} /> ); }; +export const headerBarOptions: ( + color: 'white' | 'black', + title: string, +) => StackNavigationOptions = (color, title) => ({ + headerShown: true, + headerTransparent: true, + headerBackTitleVisible: false, + headerBackImage: () => ( + + ), + headerTitle: () => ( + {title} + ), +}); + +const styles = StyleSheet.create({ + backButton: { + marginLeft: 30, + }, + headerTitle: { + fontSize: normalize(16), + letterSpacing: normalize(1.3), + fontWeight: '700', + }, + whiteHeaderTitle: { + fontSize: normalize(16), + letterSpacing: normalize(1.3), + fontWeight: '700', + color: 'white', + }, + blackHeaderTitle: { + fontSize: normalize(16), + letterSpacing: normalize(1.3), + fontWeight: '700', + color: 'black', + }, +}); + export default MainStackScreen; diff --git a/src/screens/profile/FriendsListScreen.tsx b/src/screens/profile/FriendsListScreen.tsx index b2123f44..7abe289f 100644 --- a/src/screens/profile/FriendsListScreen.tsx +++ b/src/screens/profile/FriendsListScreen.tsx @@ -1,7 +1,12 @@ -import React from 'react'; +import React, {Fragment, useEffect} from 'react'; import {RouteProp, useNavigation} from '@react-navigation/native'; import {TabsGradient, Friends} from '../../components'; -import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import { + HeaderHeight, + normalize, + SCREEN_HEIGHT, + SCREEN_WIDTH, +} from '../../utils'; import { SafeAreaView, StyleSheet, @@ -24,7 +29,6 @@ interface FriendsListScreenProps { const FriendsListScreen: React.FC = ({route}) => { const {userXId, screenType} = route.params; - const navigation = useNavigation(); const {friends} = userXId ? useSelector((state: RootState) => state.userX[screenType][userXId]) @@ -55,31 +59,11 @@ const styles = StyleSheet.create({ backgroundColor: 'white', height: '100%', }, - header: { - flexDirection: 'column', - justifyContent: 'center', - height: SCREEN_HEIGHT * 0.05, - padding: '3%', - paddingBottom: 0, - marginTop: '1%', - }, - headerText: { - position: 'absolute', - alignSelf: 'center', - fontSize: normalize(18), - fontWeight: '700', - lineHeight: normalize(21.48), - letterSpacing: normalize(1.3), - }, - headerButton: { - width: '5%', - aspectRatio: 1, - padding: 0, - marginLeft: '5%', - alignSelf: 'flex-start', - marginBottom: '1%', + backButton: { + marginLeft: 10, }, body: { + marginTop: HeaderHeight, width: SCREEN_WIDTH, height: SCREEN_HEIGHT * 0.8, }, diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx index ec193db5..4a902e9e 100644 --- a/src/screens/profile/MomentCommentsScreen.tsx +++ b/src/screens/profile/MomentCommentsScreen.tsx @@ -1,5 +1,5 @@ import {RouteProp, useNavigation} from '@react-navigation/native'; -import React, {useState} from 'react'; +import React, {useEffect, useState} from 'react'; import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'; import {SafeAreaView} from 'react-native-safe-area-context'; import BackIcon from '../../assets/icons/back-arrow.svg'; @@ -7,9 +7,14 @@ import {TabsGradient} from '../../components'; import {AddComment} from '../../components/'; import CommentsContainer from '../../components/comments/CommentsContainer'; import {ADD_COMMENT_TEXT} from '../../constants/strings'; -import {MainStackParams} from '../../routes/main'; +import {headerBarOptions, MainStackParams} from '../../routes/main'; import {CommentType} from '../../types'; -import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import { + HeaderHeight, + normalize, + SCREEN_HEIGHT, + SCREEN_WIDTH, +} from '../../utils'; /** * Comments Screen for an image uploaded @@ -39,19 +44,15 @@ const MomentCommentsScreen: React.FC = ({route}) => { CommentType | undefined >(undefined); + useEffect(() => { + navigation.setOptions({ + ...headerBarOptions('black', `${commentsLength} Comments`), + }); + }, [commentsLength, navigation]); + return ( - - { - navigation.pop(); - }}> - - - {commentsLength + ' Comments'} - Date: Tue, 9 Feb 2021 14:41:58 -0500 Subject: refactored styles in main stack --- src/routes/main/MainStackScreen.tsx | 81 +++++++++++++------------------------ 1 file changed, 27 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index 0141a418..b8b471c2 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -67,20 +67,6 @@ const MainStackScreen: React.FC = ({route}) => { } })(); - const modalStyle: StackNavigationOptions = { - cardStyle: {backgroundColor: 'rgba(80,80,80,0.9)'}, - gestureDirection: 'vertical', - cardOverlayEnabled: true, - cardStyleInterpolator: ({current: {progress}}) => ({ - cardStyle: { - opacity: progress.interpolate({ - inputRange: [0, 0.5, 0.9, 1], - outputRange: [0, 0.25, 0.7, 1], - }), - }, - }), - }; - return ( = ({route}) => { {isSearchTab && @@ -128,62 +107,42 @@ const MainStackScreen: React.FC = ({route}) => { ({ - cardStyle: { - opacity: progress.interpolate({ - inputRange: [0, 0.5, 0.9, 1], - outputRange: [0, 0.25, 0.7, 1], - }), - }, - }), }} - initialParams={{screenType}} /> = ({route}) => { ({ + cardStyle: { + opacity: progress.interpolate({ + inputRange: [0, 0.5, 0.9, 1], + outputRange: [0, 0.25, 0.7, 1], + }), + }, + }), +}; + const styles = StyleSheet.create({ backButton: { marginLeft: 30, -- cgit v1.2.3-70-g09d2 From c5e4bfbba73090b9fa3d422ddf31aaa915d032df Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 9 Feb 2021 14:43:11 -0500 Subject: fixed header styles in several screens --- src/routes/main/MainStackScreen.tsx | 7 +++-- src/screens/profile/FriendsListScreen.tsx | 38 +++++++--------------------- src/screens/profile/MomentCommentsScreen.tsx | 4 +-- 3 files changed, 14 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index b8b471c2..f8f93eb0 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -2,6 +2,9 @@ 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 {StyleSheet, Text} from 'react-native'; +import {normalize} from 'react-native-elements'; +import BackIcon from '../../assets/icons/back-arrow.svg'; import { CaptionScreen, CategorySelection, @@ -20,10 +23,6 @@ import { import {ScreenType} from '../../types'; import {AvatarHeaderHeight, SCREEN_WIDTH} from '../../utils'; import {MainStack, MainStackParams} from './MainStackNavigator'; -import BackIcon from '../../assets/icons/back-arrow.svg'; -import {StyleSheet, Text} from 'react-native'; -import {normalize} from 'react-native-elements'; -import {StackHeaderOptions} from '@react-navigation/stack/lib/typescript/src/types'; /** * Profile : To display the logged in user's profile when the userXId passed in to it is (undefined | null | empty string) else displays profile of the user being visited. diff --git a/src/screens/profile/FriendsListScreen.tsx b/src/screens/profile/FriendsListScreen.tsx index 7abe289f..1cfef058 100644 --- a/src/screens/profile/FriendsListScreen.tsx +++ b/src/screens/profile/FriendsListScreen.tsx @@ -1,26 +1,14 @@ -import React, {Fragment, useEffect} from 'react'; -import {RouteProp, useNavigation} from '@react-navigation/native'; -import {TabsGradient, Friends} from '../../components'; -import { - HeaderHeight, - normalize, - SCREEN_HEIGHT, - SCREEN_WIDTH, -} from '../../utils'; -import { - SafeAreaView, - StyleSheet, - Text, - TouchableOpacity, - View, -} from 'react-native'; -import {ProfileStackParams} from '../../routes'; +import {RouteProp} from '@react-navigation/native'; +import React from 'react'; +import {SafeAreaView, StyleSheet, View} from 'react-native'; import {useSelector} from 'react-redux'; +import {Friends, TabsGradient} from '../../components'; +import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootReducer'; -import BackIcon from '../../assets/icons/back-arrow.svg'; +import {HeaderHeight, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; type FriendsListScreenRouteProp = RouteProp< - ProfileStackParams, + MainStackParams, 'FriendsListScreen' >; interface FriendsListScreenProps { @@ -37,17 +25,9 @@ const FriendsListScreen: React.FC = ({route}) => { return ( <> - - { - navigation.pop(); - }}> - - - Friends + + - diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx index 4a902e9e..b0208f6f 100644 --- a/src/screens/profile/MomentCommentsScreen.tsx +++ b/src/screens/profile/MomentCommentsScreen.tsx @@ -1,8 +1,7 @@ import {RouteProp, useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; -import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'; +import {StyleSheet, View} from 'react-native'; import {SafeAreaView} from 'react-native-safe-area-context'; -import BackIcon from '../../assets/icons/back-arrow.svg'; import {TabsGradient} from '../../components'; import {AddComment} from '../../components/'; import CommentsContainer from '../../components/comments/CommentsContainer'; @@ -111,6 +110,7 @@ const styles = StyleSheet.create({ fontWeight: '400', }, body: { + marginTop: HeaderHeight, width: SCREEN_WIDTH * 0.9, height: SCREEN_HEIGHT * 0.8, paddingTop: '3%', -- cgit v1.2.3-70-g09d2 From e60250a3661df67a6c0f3d7e17cf5943f03538c3 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Wed, 10 Feb 2021 11:06:33 -0800 Subject: does not add unlinked socials on SP --- src/components/taggs/TaggsBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx index cc0c70a7..e7bdb0f2 100644 --- a/src/components/taggs/TaggsBar.tsx +++ b/src/components/taggs/TaggsBar.tsx @@ -77,7 +77,7 @@ const TaggsBar: React.FC = ({ ); i++; } - if (!userXId) { + if (!userXId && screenType !== ScreenType.SuggestedPeople) { for (let social of unlinkedSocials) { new_taggs.push( Date: Wed, 10 Feb 2021 18:23:06 -0500 Subject: linting --- src/screens/onboarding/ProfileOnboarding.tsx | 33 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/ProfileOnboarding.tsx index 26ad93a7..8a6275a9 100644 --- a/src/screens/onboarding/ProfileOnboarding.tsx +++ b/src/screens/onboarding/ProfileOnboarding.tsx @@ -1,38 +1,34 @@ -import React from 'react'; +import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; -import moment from 'moment'; import {StackNavigationProp} from '@react-navigation/stack'; +import moment from 'moment'; +import React from 'react'; import { - Text, + Alert, + Image, StatusBar, StyleSheet, - Image, + Text, TouchableOpacity, - Alert, View, } from 'react-native'; +import ImagePicker from 'react-native-image-crop-picker'; +import Animated from 'react-native-reanimated'; import { Background, + BirthDatePicker, TaggBigInput, - TaggInput, TaggDropDown, - BirthDatePicker, + TaggInput, } from '../../components'; -import {OnboardingStackParams} from '../../routes/onboarding'; -import ImagePicker from 'react-native-image-crop-picker'; import { - EDIT_PROFILE_ENDPOINT, - websiteRegex, bioRegex, - genderRegex, CLASS_YEAR_LIST, + EDIT_PROFILE_ENDPOINT, + genderRegex, TAGG_PURPLE, + websiteRegex, } from '../../constants'; -import AsyncStorage from '@react-native-community/async-storage'; -import {BackgroundGradientType} from '../../types'; -import {PickerSelectProps} from 'react-native-picker-select'; -import Animated from 'react-native-reanimated'; -import {SCREEN_WIDTH} from '../../utils'; import { ERROR_DOUBLE_CHECK_CONNECTION, ERROR_PROFILE_CREATION_SHORT, @@ -41,6 +37,9 @@ import { ERROR_UPLOAD_LARGE_PROFILE_PIC, ERROR_UPLOAD_SMALL_PROFILE_PIC, } from '../../constants/strings'; +import {OnboardingStackParams} from '../../routes/onboarding'; +import {BackgroundGradientType} from '../../types'; +import {SCREEN_WIDTH} from '../../utils'; type ProfileOnboardingScreenRouteProp = RouteProp< OnboardingStackParams, -- cgit v1.2.3-70-g09d2 From 1cb48a8985d5eb38a9480fccf0a876ce929de20a Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 10 Feb 2021 18:30:14 -0500 Subject: added fix using useMemo --- src/screens/onboarding/ProfileOnboarding.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/ProfileOnboarding.tsx index 8a6275a9..c173c8e3 100644 --- a/src/screens/onboarding/ProfileOnboarding.tsx +++ b/src/screens/onboarding/ProfileOnboarding.tsx @@ -2,7 +2,7 @@ import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; import moment from 'moment'; -import React from 'react'; +import React, {useMemo} from 'react'; import { Alert, Image, @@ -382,6 +382,15 @@ const ProfileOnboarding: React.FC = ({ } }; + const profilePics = useMemo(() => { + return ( + + + + + ); + }, [form.largePic, form.smallPic]); + return ( = ({ gradientType={BackgroundGradientType.Light} style={styles.container}> - - - - + {profilePics} Date: Thu, 11 Feb 2021 13:38:53 -0800 Subject: updated instagram icon --- src/components/common/SocialIcon.tsx | 4 ++-- src/components/taggs/Tagg.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/components/common/SocialIcon.tsx b/src/components/common/SocialIcon.tsx index 0cd5d2a7..8216b6ff 100644 --- a/src/components/common/SocialIcon.tsx +++ b/src/components/common/SocialIcon.tsx @@ -17,9 +17,9 @@ const SocialIcon: React.FC = ({ }) => { switch (social) { case 'Instagram': - var icon = require('../../assets/socials/instagram-icon-white-bg.png'); + var icon = require('../../assets/socials/instagram-icon.png'); if (screenType === ScreenType.SuggestedPeople) { - icon = require('../../assets/socials/instagram-icon.png'); + icon = require('../../assets/socials/instagram-icon-white-bg.png'); } break; case 'Facebook': diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 29b55786..bb450b64 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -148,7 +148,7 @@ const Tagg: React.FC = ({ {pickTheRightRingHere()} -- cgit v1.2.3-70-g09d2