diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-04-22 14:32:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-22 14:32:15 -0400 |
| commit | f0cff95cfa612b295caf68552bc3d29a7fb23a42 (patch) | |
| tree | dd3df697478a19048cd4bf6d0b499a91c1a93eb3 /src/screens | |
| parent | 4e8e1c0d58424e6b63cfb8470fc0a73c0e6b102b (diff) | |
| parent | 33c172cc31957966b14321520c56816ba044db14 (diff) | |
Merge pull request #374 from IvanIFChen/hotfix-linting-fixup
[HOTFIX] Linter fixup
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/badge/BadgeItem.tsx | 14 | ||||
| -rw-r--r-- | src/screens/badge/BadgeSelection.tsx | 12 | ||||
| -rw-r--r-- | src/screens/chat/ChatSearchBar.tsx | 3 | ||||
| -rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 9 | ||||
| -rw-r--r-- | src/screens/onboarding/OnboardingStepThree.tsx | 4 | ||||
| -rw-r--r-- | src/screens/onboarding/PasswordResetRequest.tsx | 2 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/ProfileOnboarding.tsx | 2 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/SocialMedia.tsx | 7 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx | 2 | ||||
| -rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 12 | ||||
| -rw-r--r-- | src/screens/profile/EditProfile.tsx | 80 | ||||
| -rw-r--r-- | src/screens/profile/FriendsListScreen.tsx | 14 | ||||
| -rw-r--r-- | src/screens/profile/SocialMediaTaggs.tsx | 38 | ||||
| -rw-r--r-- | src/screens/search/RequestContactsAccess.tsx | 5 | ||||
| -rw-r--r-- | src/screens/suggestedPeople/SPBody.tsx | 1 | ||||
| -rw-r--r-- | src/screens/suggestedPeople/SuggestedPeopleScreen.tsx | 2 |
16 files changed, 92 insertions, 115 deletions
diff --git a/src/screens/badge/BadgeItem.tsx b/src/screens/badge/BadgeItem.tsx index 3141e662..1051d4a7 100644 --- a/src/screens/badge/BadgeItem.tsx +++ b/src/screens/badge/BadgeItem.tsx @@ -34,7 +34,7 @@ const BadgeItem: React.FC<BadgeItemProps> = ({ style={styles.border}> <TouchableOpacity onPress={() => onSelection(title)} - style={{alignSelf: 'center', marginTop: 3}}> + style={styles.button}> <LinearGradient colors={index === 0 ? BADGE_GRADIENT_FIRST : BADGE_GRADIENT_REST} // BACKGROUND_GRADIENT_MAP @@ -74,14 +74,6 @@ const styles = StyleSheet.create({ borderRadius: 8, borderColor: 'transparent', }, - selectedDetailContainer: { - flexGrow: 1, - justifyContent: 'center', - alignItems: 'center', - borderWidth: 3, - borderColor: 'white', - borderRadius: 8, - }, imageStyles: { width: 40, height: 40, @@ -96,6 +88,10 @@ const styles = StyleSheet.create({ color: 'white', marginHorizontal: '2%', }, + button: { + alignSelf: 'center', + marginTop: 3, + }, }); export default BadgeItem; diff --git a/src/screens/badge/BadgeSelection.tsx b/src/screens/badge/BadgeSelection.tsx index 2fec8ea3..91617377 100644 --- a/src/screens/badge/BadgeSelection.tsx +++ b/src/screens/badge/BadgeSelection.tsx @@ -1,26 +1,26 @@ import {RouteProp} from '@react-navigation/core'; +import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import {Alert, SafeAreaView, StatusBar, StyleSheet, View} from 'react-native'; import {Text} from 'react-native-animatable'; import {TouchableOpacity} from 'react-native-gesture-handler'; import LinearGradient from 'react-native-linear-gradient'; import {useDispatch, useSelector} from 'react-redux'; +import {BACKGROUND_GRADIENT_MAP} from '../../constants'; +import {BADGE_DATA} from '../../constants/badges'; +import {ERROR_BADGES_EXCEED_LIMIT} from '../../constants/strings'; import {MainStackParams} from '../../routes'; import { addBadgesService, getSuggestedPeopleProfile, updateBadgesService, } from '../../services'; -import {BACKGROUND_GRADIENT_MAP} from '../../constants'; -import {BADGE_DATA} from '../../constants/badges'; -import {ERROR_BADGES_EXCEED_LIMIT} from '../../constants/strings'; import {suggestedPeopleBadgesFinished} from '../../store/actions'; -import {BackgroundGradientType, UniversityType} from '../../types'; +import {RootState} from '../../store/rootReducer'; +import {BackgroundGradientType} from '../../types'; import {SCREEN_HEIGHT, StatusBarHeight} from '../../utils'; import BadgeList from './BadgeList'; import BadgeScreenHeader from './BadgeScreenHeader'; -import {useNavigation} from '@react-navigation/native'; -import {RootState} from '../../store/rootReducer'; /** * Home Screen for displaying Tagg Badge Selections diff --git a/src/screens/chat/ChatSearchBar.tsx b/src/screens/chat/ChatSearchBar.tsx index 4916ec45..d8aff567 100644 --- a/src/screens/chat/ChatSearchBar.tsx +++ b/src/screens/chat/ChatSearchBar.tsx @@ -26,7 +26,6 @@ const ChatSearchBar: React.FC<SearchBarProps> = ({ onChangeText, value, onCancel, - searching, animationProgress, onLayout, placeholder, @@ -53,7 +52,7 @@ const ChatSearchBar: React.FC<SearchBarProps> = ({ <Text style={styles.searchTextStyes}>To:</Text> </Animated.View> <TextInput - style={[styles.input]} + style={styles.input} placeholderTextColor={'#828282'} onSubmitEditing={handleSubmit} clearButtonMode="always" diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 71199c9b..3efd9af8 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -1,6 +1,5 @@ import AsyncStorage from '@react-native-community/async-storage'; import {useFocusEffect, useNavigation} from '@react-navigation/native'; -import FindFriendsBlueIcon from '../../assets/icons/findFriends/find-friends-blue-icon.svg'; import moment from 'moment'; import React, {useCallback, useEffect, useState} from 'react'; import { @@ -18,12 +17,10 @@ import {checkPermission} from 'react-native-contacts'; import {TouchableOpacity} from 'react-native-gesture-handler'; import {SafeAreaView} from 'react-native-safe-area-context'; import {useDispatch, useSelector} from 'react-redux'; -import {PrivateAccountsPrompt} from '../../components/notifications/NotificationPrompts'; +import FindFriendsBlueIcon from '../../assets/icons/findFriends/find-friends-blue-icon.svg'; import {TabsGradient} from '../../components'; -import { - InviteFriendsPrompt, - Notification, -} from '../../components/notifications'; +import {Notification} from '../../components/notifications'; +import {PrivateAccountsPrompt} from '../../components/notifications/NotificationPrompts'; import { loadUserNotifications, updateNewNotificationReceived, diff --git a/src/screens/onboarding/OnboardingStepThree.tsx b/src/screens/onboarding/OnboardingStepThree.tsx index 5cf7993e..638f0889 100644 --- a/src/screens/onboarding/OnboardingStepThree.tsx +++ b/src/screens/onboarding/OnboardingStepThree.tsx @@ -61,7 +61,7 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ route, navigation, }) => { - const {userId, username} = route.params; + const {userId} = route.params; const [form, setForm] = React.useState<FormType>({ smallPic: '', university: UniversityType.Empty, @@ -135,7 +135,7 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ }; const handleClassYearUpdate = (value: string) => { - const classYear = Number.parseInt(value); + const classYear = parseInt(value, 10); setForm({ ...form, classYear, diff --git a/src/screens/onboarding/PasswordResetRequest.tsx b/src/screens/onboarding/PasswordResetRequest.tsx index 8a891bbb..8f987721 100644 --- a/src/screens/onboarding/PasswordResetRequest.tsx +++ b/src/screens/onboarding/PasswordResetRequest.tsx @@ -21,7 +21,7 @@ import { import {emailRegex, usernameRegex} from '../../constants'; import {OnboardingStackParams} from '../../routes'; import {handlePasswordResetRequest} from '../../services'; -import {BackgroundGradientType, VerificationScreenType} from '../../types'; +import {BackgroundGradientType} from '../../types'; type PasswordResetRequestRouteProp = RouteProp< OnboardingStackParams, diff --git a/src/screens/onboarding/legacy/ProfileOnboarding.tsx b/src/screens/onboarding/legacy/ProfileOnboarding.tsx index bf0863dc..e994c1e6 100644 --- a/src/screens/onboarding/legacy/ProfileOnboarding.tsx +++ b/src/screens/onboarding/legacy/ProfileOnboarding.tsx @@ -242,7 +242,7 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({ }; const handleClassYearUpdate = (value: string) => { - const classYear = Number.parseInt(value); + const classYear = parseInt(value, 10); setForm({ ...form, classYear, diff --git a/src/screens/onboarding/legacy/SocialMedia.tsx b/src/screens/onboarding/legacy/SocialMedia.tsx index db24830a..1f98401b 100644 --- a/src/screens/onboarding/legacy/SocialMedia.tsx +++ b/src/screens/onboarding/legacy/SocialMedia.tsx @@ -17,11 +17,7 @@ import { } from '../../../components'; import {SOCIAL_LIST} from '../../../constants'; import {OnboardingStackParams} from '../../../routes'; -import { - BackgroundGradientType, - CategorySelectionScreenType, - LinkerType, -} from '../../../types'; +import {BackgroundGradientType, LinkerType} from '../../../types'; /** * Social Media Screen for displaying social media linkers @@ -64,7 +60,6 @@ const SocialMedia: React.FC<SocialMediaProps> = ({route, navigation}) => { const handleNext = () => { navigation.navigate('CategorySelection', { - screenType: CategorySelectionScreenType.Onboarding, user: {userId: userId, username: username}, newCustomCategory: undefined, }); diff --git a/src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx b/src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx index 72bbec63..ad517814 100644 --- a/src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx +++ b/src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx @@ -1,5 +1,5 @@ import {StackNavigationProp} from '@react-navigation/stack'; -import * as React from 'react'; +import React from 'react'; import { KeyboardAvoidingView, Linking, diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx index 282857d6..156ee41c 100644 --- a/src/screens/profile/CaptionScreen.tsx +++ b/src/screens/profile/CaptionScreen.tsx @@ -49,8 +49,8 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => { const [caption, setCaption] = useState(''); const [loading, setLoading] = useState(false); - const handleCaptionUpdate = (caption: string) => { - setCaption(caption); + const handleCaptionUpdate = (newCaption: string) => { + setCaption(newCaption); }; const navigateToProfile = () => { @@ -63,6 +63,9 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => { const handleShare = async () => { setLoading(true); + if (!image.filename) { + return; + } postMoment(image.filename, image.path, caption, title, userId).then( (data) => { setLoading(false); @@ -88,7 +91,7 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => { <TouchableWithoutFeedback onPress={Keyboard.dismiss}> <KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} - style={{flex: 1}}> + style={styles.flex}> <View style={styles.contentContainer}> <View style={styles.buttonsContainer}> <Button @@ -157,6 +160,9 @@ const styles = StyleSheet.create({ paddingVertical: '1%', height: 60, }, + flex: { + flex: 1, + }, }); export default CaptionScreen; diff --git a/src/screens/profile/EditProfile.tsx b/src/screens/profile/EditProfile.tsx index 8b658043..26802e45 100644 --- a/src/screens/profile/EditProfile.tsx +++ b/src/screens/profile/EditProfile.tsx @@ -199,12 +199,12 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { /* * Handles changes to the website field value and verifies the input by updating state and running a validation function. */ - const handleWebsiteUpdate = (website: string) => { - website = website.trim(); - let isValidWebsite: boolean = websiteRegex.test(website); + const handleWebsiteUpdate = (newWebsite: string) => { + newWebsite = newWebsite.trim(); + let isValidWebsite: boolean = websiteRegex.test(newWebsite); setForm({ ...form, - website, + website: newWebsite, isValidWebsite, }); }; @@ -212,27 +212,27 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { /* * Handles changes to the bio field value and verifies the input by updating state and running a validation function. */ - const handleBioUpdate = (bio: string) => { - let isValidBio: boolean = bioRegex.test(bio); + const handleBioUpdate = (newBio: string) => { + let isValidBio: boolean = bioRegex.test(newBio); setForm({ ...form, - bio, + bio: newBio, isValidBio, }); }; - const handleGenderUpdate = (gender: string) => { - if (gender === 'custom') { - setForm({...form, gender}); + const handleGenderUpdate = (newGender: string) => { + if (newGender === 'custom') { + setForm({...form, gender: newGender}); setIsCustomGender(true); - } else if (gender === null) { + } else if (newGender === null) { // not doing anything will make the picker "bounce back" } else { setIsCustomGender(false); let isValidGender: boolean = true; setForm({ ...form, - gender, + gender: newGender, isValidGender, }); } @@ -267,7 +267,7 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { }; const handleClassYearUpdate = (value: string) => { - const classYear = Number.parseInt(value); + const classYear = parseInt(value, 10); setForm({ ...form, classYear, @@ -383,8 +383,8 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { headerRight: () => ( <Button title={'Save'} - buttonStyle={{backgroundColor: 'transparent', marginRight: 15}} - titleStyle={{fontWeight: 'bold'}} + buttonStyle={styles.headerRightButton} + titleStyle={styles.boldFont} onPress={() => { setLoading(true); handleSubmit().then(() => setLoading(false)); @@ -409,22 +409,13 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { alwaysBounceVertical contentContainerStyle={{paddingBottom: SCREEN_HEIGHT / 15}}> <StatusBar barStyle="light-content" translucent={false} /> - <View - style={{ - position: 'relative', - alignSelf: 'center', - }}> + <View style={styles.relativeCenter}> <View> <View style={styles.profile}> <LargeProfilePic /> <SmallProfilePic /> </View> - <View - style={{ - position: 'relative', - width: 280, - alignSelf: 'center', - }}> + <View style={styles.relativeCenterWithWidth}> <TaggInput accessibilityHint="Enter a website." accessibilityLabel="Website input field." @@ -540,7 +531,7 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { <SocialIcon social={'TikTok'} style={styles.icon} - screenType={ScreenType.Profile} + whiteRing={undefined} /> <View style={styles.taggInput}> <TaggInput @@ -631,20 +622,6 @@ const styles = StyleSheet.create({ width: 110, borderRadius: 55, }, - submitBtn: { - backgroundColor: '#8F01FF', - justifyContent: 'center', - alignItems: 'center', - width: 150, - height: 40, - borderRadius: 5, - marginTop: '5%', - }, - submitBtnLabel: { - fontSize: 16, - fontWeight: '500', - color: '#fff', - }, customGenderInput: { width: '100%', height: 40, @@ -666,7 +643,26 @@ const styles = StyleSheet.create({ aspectRatio: 1, flex: 1, }, - taggInput: {flex: 6.5, marginLeft: '3%'}, + taggInput: { + flex: 6.5, + marginLeft: '3%', + }, + headerRightButton: { + backgroundColor: 'transparent', + marginRight: 15, + }, + boldFont: { + fontWeight: 'bold', + }, + relativeCenter: { + position: 'relative', + alignSelf: 'center', + }, + relativeCenterWithWidth: { + position: 'relative', + width: 280, + alignSelf: 'center', + }, }); export default EditProfile; diff --git a/src/screens/profile/FriendsListScreen.tsx b/src/screens/profile/FriendsListScreen.tsx index 886ab9c4..1d10bc86 100644 --- a/src/screens/profile/FriendsListScreen.tsx +++ b/src/screens/profile/FriendsListScreen.tsx @@ -1,12 +1,6 @@ import {RouteProp} from '@react-navigation/native'; import React from 'react'; -import { - SafeAreaView, - ScrollView, - StatusBar, - StyleSheet, - View, -} from 'react-native'; +import {SafeAreaView, ScrollView, StatusBar, StyleSheet} from 'react-native'; import {useSelector} from 'react-redux'; import {Friends, TabsGradient} from '../../components'; import {MainStackParams} from '../../routes'; @@ -24,9 +18,9 @@ interface FriendsListScreenProps { const FriendsListScreen: React.FC<FriendsListScreenProps> = ({route}) => { const {userXId, screenType} = route.params; - const {friends} = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.friends); + const {friends} = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.friends, + ); return ( <> diff --git a/src/screens/profile/SocialMediaTaggs.tsx b/src/screens/profile/SocialMediaTaggs.tsx index 466ba509..9186f187 100644 --- a/src/screens/profile/SocialMediaTaggs.tsx +++ b/src/screens/profile/SocialMediaTaggs.tsx @@ -3,6 +3,7 @@ import {StackNavigationProp} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import {ScrollView, StatusBar, StyleSheet, View} from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; +import {useSelector} from 'react-redux'; import { AvatarTitle, SocialMediaInfo, @@ -10,26 +11,17 @@ import { TaggPost, TwitterTaggPost, } from '../../components'; +import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator'; import {AVATAR_GRADIENT} from '../../constants'; -import {ProfileStackParams} from '../../routes'; -import { - SimplePostType, - TwitterPostType, - SocialAccountType, - ScreenType, -} from '../../types'; -import {AvatarHeaderHeight, SCREEN_HEIGHT} from '../../utils'; -import {useSelector} from 'react-redux'; +import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootReducer'; -import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator'; +import {SimplePostType, SocialAccountType, TwitterPostType} from '../../types'; +import {AvatarHeaderHeight, SCREEN_HEIGHT} from '../../utils'; -type SocialMediaTaggsRouteProp = RouteProp< - ProfileStackParams, - 'SocialMediaTaggs' ->; +type SocialMediaTaggsRouteProp = RouteProp<MainStackParams, 'SocialMediaTaggs'>; type SocialMediaTaggsNavigationProp = StackNavigationProp< - ProfileStackParams, + MainStackParams, 'SocialMediaTaggs' >; @@ -49,13 +41,13 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({ const { avatar, profile: {name}, - } = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.user); + } = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.user, + ); - const {socialAccounts} = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.socialAccounts); + const {socialAccounts} = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.socialAccounts, + ); useEffect(() => { const currentSocialData = {...socialAccounts[socialMediaType]}; @@ -67,7 +59,7 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({ useEffect(() => { navigation.setOptions({ headerTitle: () => { - return <AvatarTitle avatar={avatar} />; + return <AvatarTitle avatar={avatar ?? null} />; }, }); }, [avatar, navigation]); @@ -114,7 +106,7 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({ <TabsGradient /> </View> ) : ( - <TaggLoadingIndicator color="white" /> + <TaggLoadingIndicator /> )} </LinearGradient> ); diff --git a/src/screens/search/RequestContactsAccess.tsx b/src/screens/search/RequestContactsAccess.tsx index f5d2de1a..4b583349 100644 --- a/src/screens/search/RequestContactsAccess.tsx +++ b/src/screens/search/RequestContactsAccess.tsx @@ -60,7 +60,7 @@ const RequestContactsAccess: React.FC = () => { useAngle={true} angle={154.72} angleCenter={{x: 0.5, y: 0.5}} - style={{flex: 1}}> + style={styles.flex}> <SafeAreaView> <View style={{height: SCREEN_HEIGHT}}> <Animated.ScrollView @@ -201,5 +201,8 @@ const styles = StyleSheet.create({ lineHeight: normalize(20), color: '#fff', }, + flex: { + flex: 1, + }, }); export default RequestContactsAccess; diff --git a/src/screens/suggestedPeople/SPBody.tsx b/src/screens/suggestedPeople/SPBody.tsx index fa69d812..c22f8143 100644 --- a/src/screens/suggestedPeople/SPBody.tsx +++ b/src/screens/suggestedPeople/SPBody.tsx @@ -14,7 +14,6 @@ import { UniversityBadge, } from '../../types'; import {isIPhoneX, normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; -import {useSharedValue} from 'react-native-reanimated'; interface SPBodyProps { item: SuggestedPeopleDataType; diff --git a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx index d6812f41..388a1ba7 100644 --- a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx +++ b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx @@ -24,7 +24,6 @@ import SPBody from './SPBody'; const SuggestedPeopleScreen: React.FC = () => { const navigation = useNavigation(); - const state: RootState = useStore().getState(); const dispatch = useDispatch(); const screenType = ScreenType.SuggestedPeople; const {suggested_people_linked} = useSelector( @@ -35,6 +34,7 @@ const SuggestedPeopleScreen: React.FC = () => { ); const {suggestedPeopleImage} = useSelector((state: RootState) => state.user); const [people, setPeople] = useState<SuggestedPeopleDataType[]>([]); + const state: RootState = useStore().getState(); const [displayedUser, setDisplayedUser] = useState<SuggestedPeopleDataType>(); const [page, setPage] = useState(0); const [refreshing, setRefreshing] = useState(false); |
