diff options
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 5 | ||||
| -rw-r--r-- | src/screens/moments/TagFriendsScreen.tsx | 3 | ||||
| -rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 35 | ||||
| -rw-r--r-- | src/screens/profile/IndividualMoment.tsx | 5 | ||||
| -rw-r--r-- | src/screens/profile/MomentCommentsScreen.tsx | 10 | ||||
| -rw-r--r-- | src/screens/profile/MomentUploadPromptScreen.tsx | 8 | ||||
| -rw-r--r-- | src/screens/profile/SocialMediaTaggs.tsx | 6 | ||||
| -rw-r--r-- | src/screens/suggestedPeople/MutualBadgeHolders.tsx | 5 | ||||
| -rw-r--r-- | src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx | 245 | 
9 files changed, 154 insertions, 168 deletions
| diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index bce48ef2..ebcccc8e 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -36,9 +36,8 @@ const NotificationsScreen: React.FC = () => {    );    const [refreshing, setRefreshing] = useState(false);    // used for figuring out which ones are unread -  const [lastViewed, setLastViewed] = useState<moment.Moment | undefined>( -    undefined, -  ); +  const [lastViewed, setLastViewed] = +    useState<moment.Moment | undefined>(undefined);    const {notifications} = useSelector(      (state: RootState) => state.notifications,    ); diff --git a/src/screens/moments/TagFriendsScreen.tsx b/src/screens/moments/TagFriendsScreen.tsx index e6a9f5fb..b0722efc 100644 --- a/src/screens/moments/TagFriendsScreen.tsx +++ b/src/screens/moments/TagFriendsScreen.tsx @@ -99,7 +99,7 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {                  }                />              )} -            <View style={{marginHorizontal: '5%', marginTop: '3%'}}> +            <View style={styles.footerContainer}>                <TagFriendsFooter                  taggedUsers={taggedUsers}                  setTaggedUsers={setTaggedUsers} @@ -150,6 +150,7 @@ const styles = StyleSheet.create({    flex: {      flex: 1,    }, +  footerContainer: {marginHorizontal: '5%', marginTop: '3%'},  });  export default TagFriendsScreen; diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx index 188ccc1f..43665428 100644 --- a/src/screens/profile/CaptionScreen.tsx +++ b/src/screens/profile/CaptionScreen.tsx @@ -176,28 +176,13 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {                    selectedUsers: taggedUsers,                  })                } -              style={{ -                marginHorizontal: '5%', -                marginTop: '3%', -                flexDirection: 'row', -                justifyContent: 'space-between', -                alignItems: 'center', -              }}> +              style={styles.tagFriendsContainer}>                <Image                  source={require('../../assets/icons/tagging/tag-icon.png')} -                style={{width: 20, height: 20}} +                style={styles.tagIcon}                />                <Text style={styles.tagFriendsTitle}>Tag Friends</Text> -              <Text -                numberOfLines={1} -                style={{ -                  color: 'white', -                  width: 150, -                  fontSize: normalize(10), -                  lineHeight: normalize(11), -                  letterSpacing: normalize(0.3), -                  textAlign: 'right', -                }}> +              <Text numberOfLines={1} style={styles.taggedListContainer}>                  {taggedList}                  {taggedList.length > 21 ? '. . .' : ''}                </Text> @@ -255,9 +240,21 @@ const styles = StyleSheet.create({      fontWeight: '600',    },    tagFriendsContainer: { -    flexDirection: 'row', +    marginHorizontal: '5%',      marginTop: '3%', +    flexDirection: 'row', +    justifyContent: 'space-between', +    alignItems: 'center', +  }, +  taggedListContainer: { +    color: 'white', +    width: 150, +    fontSize: normalize(10), +    lineHeight: normalize(11), +    letterSpacing: normalize(0.3), +    textAlign: 'right',    }, +  tagIcon: {width: 20, height: 20},  });  export default CaptionScreen; diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx index 4baca5b2..515cbacf 100644 --- a/src/screens/profile/IndividualMoment.tsx +++ b/src/screens/profile/IndividualMoment.tsx @@ -1,17 +1,14 @@ -import AsyncStorage from '@react-native-community/async-storage';  import {BlurView} from '@react-native-community/blur';  import {RouteProp} from '@react-navigation/native';  import {StackNavigationProp} from '@react-navigation/stack';  import React from 'react'; -import {Alert, FlatList, StyleSheet, View} from 'react-native'; +import {FlatList, StyleSheet, View} from 'react-native';  import {useSelector} from 'react-redux';  import {    IndividualMomentTitleBar,    MomentPostContent,    MomentPostHeader,  } from '../../components'; -import {MOMENT_TAGS_ENDPOINT} from '../../constants'; -import {ERROR_SOMETHING_WENT_WRONG_REFRESH} from '../../constants/strings';  import {MainStackParams} from '../../routes';  import {RootState} from '../../store/rootreducer';  import {MomentType} from '../../types'; diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx index 4b332b56..402e5f44 100644 --- a/src/screens/profile/MomentCommentsScreen.tsx +++ b/src/screens/profile/MomentCommentsScreen.tsx @@ -44,14 +44,12 @@ const MomentCommentsScreen: React.FC<MomentCommentsScreenProps> = ({route}) => {    //Receives comment length from child CommentsContainer    const [commentsLength, setCommentsLength] = useState<number>(0); -  const [shouldUpdateAllComments, setShouldUpdateAllComments] = React.useState( -    true, -  ); +  const [shouldUpdateAllComments, setShouldUpdateAllComments] = +    React.useState(true);    //Keeps track of the current comments object in focus so that the application knows which comment to post a reply to -  const [commentTapped, setCommentTapped] = useState< -    CommentType | CommentThreadType | undefined -  >(); +  const [commentTapped, setCommentTapped] = +    useState<CommentType | CommentThreadType | undefined>();    useEffect(() => {      navigation.setOptions({ diff --git a/src/screens/profile/MomentUploadPromptScreen.tsx b/src/screens/profile/MomentUploadPromptScreen.tsx index f0aaffc4..7e04063c 100644 --- a/src/screens/profile/MomentUploadPromptScreen.tsx +++ b/src/screens/profile/MomentUploadPromptScreen.tsx @@ -28,12 +28,8 @@ const MomentUploadPromptScreen: React.FC<MomentUploadPromptScreenProps> = ({    route,    navigation,  }) => { -  const { -    screenType, -    momentCategory, -    profileBodyHeight, -    socialsBarHeight, -  } = route.params; +  const {screenType, momentCategory, profileBodyHeight, socialsBarHeight} = +    route.params;    return (      <View style={styles.container}>        <CloseIcon diff --git a/src/screens/profile/SocialMediaTaggs.tsx b/src/screens/profile/SocialMediaTaggs.tsx index 52d20683..0e2ebb63 100644 --- a/src/screens/profile/SocialMediaTaggs.tsx +++ b/src/screens/profile/SocialMediaTaggs.tsx @@ -85,9 +85,9 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({                type={socialMediaType}                handle={accountData?.handle}              /> -            {(accountData?.posts as Array< -              SimplePostType | TwitterPostType -            >).map((post, index) => +            {( +              accountData?.posts as Array<SimplePostType | TwitterPostType> +            ).map((post, index) =>                socialMediaType === 'Twitter' ? (                  <TwitterTaggPost                    key={index} diff --git a/src/screens/suggestedPeople/MutualBadgeHolders.tsx b/src/screens/suggestedPeople/MutualBadgeHolders.tsx index e3b69f7a..f715bd5e 100644 --- a/src/screens/suggestedPeople/MutualBadgeHolders.tsx +++ b/src/screens/suggestedPeople/MutualBadgeHolders.tsx @@ -37,9 +37,8 @@ const MutualBadgeHolders: React.FC<MutualBadgeHoldersProps> = ({    useEffect(() => {      const getUsers = async () => { -      let localUsers: -        | ProfilePreviewType[] -        | undefined = await getMutualBadgeHolders(badge_id); +      let localUsers: ProfilePreviewType[] | undefined = +        await getMutualBadgeHolders(badge_id);        setUsers(localUsers);      }; diff --git a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx index af5fd579..f5a9f280 100644 --- a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx +++ b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx @@ -38,139 +38,138 @@ type SuggestedPeopleUploadPictureScreenProps = {    route: SuggestedPeopleUploadPictureScreenRouteProp;  }; -const SuggestedPeopleUploadPictureScreen: React.FC<SuggestedPeopleUploadPictureScreenProps> = ({ -  route, -}) => { -  const {editing} = route.params; -  const [image, setImage] = useState<string | undefined>(undefined); -  const [oldImage, setOldImage] = useState<string | undefined>(undefined); -  const [loading, setLoading] = useState(false); -  const dispatch = useDispatch(); -  const navigation = useNavigation(); -  const { -    user: {userId: loggedInUserId}, -  } = useSelector((state: RootState) => state.user); +const SuggestedPeopleUploadPictureScreen: React.FC<SuggestedPeopleUploadPictureScreenProps> = +  ({route}) => { +    const {editing} = route.params; +    const [image, setImage] = useState<string | undefined>(undefined); +    const [oldImage, setOldImage] = useState<string | undefined>(undefined); +    const [loading, setLoading] = useState(false); +    const dispatch = useDispatch(); +    const navigation = useNavigation(); +    const { +      user: {userId: loggedInUserId}, +    } = useSelector((state: RootState) => state.user); -  useEffect(() => { -    const loadData = async () => { -      const response = await getSuggestedPeopleProfile(loggedInUserId); -      if (response) { -        setImage(response.suggested_people_url); -        setOldImage(response.suggested_people_url); +    useEffect(() => { +      const loadData = async () => { +        const response = await getSuggestedPeopleProfile(loggedInUserId); +        if (response) { +          setImage(response.suggested_people_url); +          setOldImage(response.suggested_people_url); +        } +      }; +      // if we're in edit SP, attempt to load current sp image +      if (editing) { +        loadData();        } -    }; -    // if we're in edit SP, attempt to load current sp image -    if (editing) { -      loadData(); -    } -  }, []); +    }, []); -  const openImagePicker = () => { -    ImagePicker.openPicker({ -      smartAlbums: [ -        'Favorites', -        'RecentlyAdded', -        'SelfPortraits', -        'Screenshots', -        'UserLibrary', -      ], -      width: SP_WIDTH, -      height: SP_HEIGHT, -      cropping: true, -      cropperToolbarTitle: 'Select Photo', -      mediaType: 'photo', -    }) -      .then((picture) => { -        if ('path' in picture) { -          setImage(picture.path); -        } +    const openImagePicker = () => { +      ImagePicker.openPicker({ +        smartAlbums: [ +          'Favorites', +          'RecentlyAdded', +          'SelfPortraits', +          'Screenshots', +          'UserLibrary', +        ], +        width: SP_WIDTH, +        height: SP_HEIGHT, +        cropping: true, +        cropperToolbarTitle: 'Select Photo', +        mediaType: 'photo',        }) -      .catch((_) => {}); -  }; +        .then((picture) => { +          if ('path' in picture) { +            setImage(picture.path); +          } +        }) +        .catch((_) => {}); +    }; -  const uploadImage = async () => { -    // Uploading image only if initially loaded image is not the same as the image being uploaded -    if (image && oldImage !== image) { -      setLoading(true); -      const success = await sendSuggestedPeoplePhoto(image); -      if (success) { -        dispatch(uploadedSuggestedPeoplePhoto(image)); -        if (!editing) { -          navigation.navigate('BadgeSelection', {editing: false}); +    const uploadImage = async () => { +      // Uploading image only if initially loaded image is not the same as the image being uploaded +      if (image && oldImage !== image) { +        setLoading(true); +        const success = await sendSuggestedPeoplePhoto(image); +        if (success) { +          dispatch(uploadedSuggestedPeoplePhoto(image)); +          if (!editing) { +            navigation.navigate('BadgeSelection', {editing: false}); +          } +        } else { +          Alert.alert(ERROR_UPLOAD); +        } +        setLoading(false); +        // Navigated back to Profile if user is editing their Suggested People Picture +        if (editing) { +          navigation.goBack(); +          setTimeout(() => { +            Alert.alert(success ? SUCCESS_PIC_UPLOAD : ERROR_UPLOAD_SP_PHOTO); +          }, 500);          } -      } else { -        Alert.alert(ERROR_UPLOAD); -      } -      setLoading(false); -      // Navigated back to Profile if user is editing their Suggested People Picture -      if (editing) { -        navigation.goBack(); -        setTimeout(() => { -          Alert.alert(success ? SUCCESS_PIC_UPLOAD : ERROR_UPLOAD_SP_PHOTO); -        }, 500);        } -    } -  }; +    }; -  return ( -    <> -      {loading && <TaggLoadingIndicator fullscreen />} -      <StatusBar barStyle={'light-content'} /> -      <SafeAreaView style={styles.container}> -        <Text style={editing ? styles.titleEditSuggested : styles.titlePHOTO}> -          {editing ? 'Edit Suggested' : 'PHOTO'} -        </Text> -        {image ? ( -          <Text style={styles.body}> -            {editing -              ? 'Tap to upload new photo' -              : 'Tap again to choose another photo'} +    return ( +      <> +        {loading && <TaggLoadingIndicator fullscreen />} +        <StatusBar barStyle={'light-content'} /> +        <SafeAreaView style={styles.container}> +          <Text style={editing ? styles.titleEditSuggested : styles.titlePHOTO}> +            {editing ? 'Edit Suggested' : 'PHOTO'}            </Text> -        ) : ( -          <Text style={styles.body}> -            Upload a photo, this is what other users will see -          </Text> -        )} -        {image ? ( -          <TouchableOpacity onPress={openImagePicker}> -            <ImageBackground -              source={{uri: image, cache: 'reload'}} -              style={[styles.imageContainer, styles.overlay]} -              borderRadius={30}> -              <Image -                style={styles.overlay} +          {image ? ( +            <Text style={styles.body}> +              {editing +                ? 'Tap to upload new photo' +                : 'Tap again to choose another photo'} +            </Text> +          ) : ( +            <Text style={styles.body}> +              Upload a photo, this is what other users will see +            </Text> +          )} +          {image ? ( +            <TouchableOpacity onPress={openImagePicker}> +              <ImageBackground +                source={{uri: image, cache: 'reload'}} +                style={[styles.imageContainer, styles.overlay]} +                borderRadius={30}> +                <Image +                  style={styles.overlay} +                  source={require('../../assets/images/suggested-people-preview-silhouette.png')} +                /> +              </ImageBackground> +            </TouchableOpacity> +          ) : ( +            <TouchableOpacity onPress={openImagePicker}> +              <ImageBackground                  source={require('../../assets/images/suggested-people-preview-silhouette.png')} -              /> -            </ImageBackground> -          </TouchableOpacity> -        ) : ( -          <TouchableOpacity onPress={openImagePicker}> -            <ImageBackground -              source={require('../../assets/images/suggested-people-preview-silhouette.png')} -              style={[styles.imageContainer, styles.overlay]}> -              <Image -                style={styles.images} -                source={require('../../assets/images/images.png')} -              /> -              <Text style={styles.body}>Upload Photo</Text> -            </ImageBackground> -          </TouchableOpacity> -        )} -        {image && ( -          <TaggSquareButton -            onPress={uploadImage} -            title={'Done'} -            buttonStyle={'normal'} -            buttonColor={editing ? 'blue' : 'purple'} -            labelColor={'white'} -            style={styles.buttonStyle} -            labelStyle={styles.buttonLabel} -          /> -        )} -      </SafeAreaView> -    </> -  ); -}; +                style={[styles.imageContainer, styles.overlay]}> +                <Image +                  style={styles.images} +                  source={require('../../assets/images/images.png')} +                /> +                <Text style={styles.body}>Upload Photo</Text> +              </ImageBackground> +            </TouchableOpacity> +          )} +          {image && ( +            <TaggSquareButton +              onPress={uploadImage} +              title={'Done'} +              buttonStyle={'normal'} +              buttonColor={editing ? 'blue' : 'purple'} +              labelColor={'white'} +              style={styles.buttonStyle} +              labelStyle={styles.buttonLabel} +            /> +          )} +        </SafeAreaView> +      </> +    ); +  };  const styles = StyleSheet.create({    container: { | 
