diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-20 17:16:46 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-04-20 17:21:46 -0400 |
commit | bae0136cb1939302b758249a1978251bd37aaee8 (patch) | |
tree | 8788895fe72bef062a4de3b3b8e245d091dc3c1f | |
parent | 5ff7cab4bd36337b2c86e3d4915a6fc3ceef1ddb (diff) |
linted
-rw-r--r-- | src/components/common/AcceptDeclineButtons.tsx | 8 | ||||
-rw-r--r-- | src/components/common/FriendsButton.tsx | 9 | ||||
-rw-r--r-- | src/components/common/TaggPrompt.tsx | 14 | ||||
-rw-r--r-- | src/components/messages/TypingIndicator.tsx | 3 | ||||
-rw-r--r-- | src/components/moments/MomentPostHeader.tsx | 2 | ||||
-rw-r--r-- | src/components/notifications/Notification.tsx | 1 | ||||
-rw-r--r-- | src/components/profile/ProfileMoreInfoDrawer.tsx | 6 | ||||
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 1 | ||||
-rw-r--r-- | src/components/search/SearchResultList.tsx | 3 | ||||
-rw-r--r-- | src/components/suggestedPeople/SPTaggsBar.tsx | 2 | ||||
-rw-r--r-- | src/routes/Routes.tsx | 3 | ||||
-rw-r--r-- | src/screens/badge/BadgeItem.tsx | 8 |
12 files changed, 27 insertions, 33 deletions
diff --git a/src/components/common/AcceptDeclineButtons.tsx b/src/components/common/AcceptDeclineButtons.tsx index 7bb62fd4..fd42f2f5 100644 --- a/src/components/common/AcceptDeclineButtons.tsx +++ b/src/components/common/AcceptDeclineButtons.tsx @@ -1,19 +1,15 @@ import React from 'react'; import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'; -import {TAGG_LIGHT_BLUE} from '../../constants'; -import {ProfilePreviewType} from '../../types'; -import {SCREEN_WIDTH} from '../../utils'; import {TouchableOpacity} from 'react-native-gesture-handler'; -import {normalize} from '../../utils'; +import {TAGG_LIGHT_BLUE} from '../../constants'; +import {normalize, SCREEN_WIDTH} from '../../utils'; interface AcceptDeclineButtonsProps { - requester: ProfilePreviewType; onAccept: () => void; onReject: () => void; externalStyles?: Record<string, StyleProp<ViewStyle>>; } const AcceptDeclineButtons: React.FC<AcceptDeclineButtonsProps> = ({ - requester, onAccept, onReject, externalStyles, diff --git a/src/components/common/FriendsButton.tsx b/src/components/common/FriendsButton.tsx index 6ddad93f..ae901229 100644 --- a/src/components/common/FriendsButton.tsx +++ b/src/components/common/FriendsButton.tsx @@ -31,9 +31,12 @@ const FriendsButton: React.FC<FriendsButtonProps> = ({ }) => { const dispatch = useDispatch(); - const {user = NO_USER, profile = NO_PROFILE} = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.user); + const { + user = NO_USER, + profile = NO_PROFILE, + } = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.user, + ); const {user: loggedInUser = NO_USER} = useSelector( (state: RootState) => state.user, diff --git a/src/components/common/TaggPrompt.tsx b/src/components/common/TaggPrompt.tsx index 5e125d00..6b59d4a5 100644 --- a/src/components/common/TaggPrompt.tsx +++ b/src/components/common/TaggPrompt.tsx @@ -1,8 +1,8 @@ -import * as React from 'react'; +import React from 'react'; import {StyleSheet, Text, TouchableOpacity} from 'react-native'; import {Image, View} from 'react-native-animatable'; import CloseIcon from '../../assets/ionicons/close-outline.svg'; -import {isIPhoneX, normalize, SCREEN_HEIGHT} from '../../utils'; +import {normalize, SCREEN_HEIGHT} from '../../utils'; type TaggPromptProps = { messageHeader: string; @@ -39,13 +39,11 @@ const TaggPrompt: React.FC<TaggPromptProps> = ({ } }; + const topPadding = {paddingTop: noPadding ? 0 : SCREEN_HEIGHT / 10}; + const bottomPadding = {paddingBottom: noPadding ? 0 : SCREEN_HEIGHT / 50}; + return ( - <View - style={[ - styles.container, - {paddingTop: noPadding ? 0 : SCREEN_HEIGHT / 10}, - {paddingBottom: noPadding ? 0 : SCREEN_HEIGHT / 50}, - ]}> + <View style={[styles.container, topPadding, bottomPadding]}> <Image style={styles.icon} source={logo()} /> <Text style={styles.header}>{messageHeader}</Text> <Text style={styles.subtext}>{messageBody}</Text> diff --git a/src/components/messages/TypingIndicator.tsx b/src/components/messages/TypingIndicator.tsx index be7141a2..b7c33567 100644 --- a/src/components/messages/TypingIndicator.tsx +++ b/src/components/messages/TypingIndicator.tsx @@ -7,7 +7,7 @@ const TypingIndicator: React.FC = () => { <View style={styles.typingIndicatorContainer}> <Image source={require('../../assets/gifs/loading-animation.gif')} - style={{width: 88, height: 49}} + style={styles.image} /> </View> ); @@ -25,6 +25,7 @@ const styles = StyleSheet.create({ justifyContent: 'center', alignItems: 'center', }, + image: {width: 88, height: 49}, }); export default TypingIndicator; diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index ff324c4a..8cf509ab 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -31,11 +31,11 @@ const MomentPostHeader: React.FC<MomentPostHeaderProps> = ({ }) => { const [drawerVisible, setDrawerVisible] = useState(false); const dispatch = useDispatch(); - const state: RootState = useStore().getState(); const navigation = useNavigation(); const {userId: loggedInUserId, username: loggedInUserName} = useSelector( (state: RootState) => state.user.user, ); + const state: RootState = useStore().getState(); const isOwnProfile = loggedInUserName === username; const navigateToProfile = async () => { if (userXId && !userXInStore(state, screenType, userXId)) { diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index 8e008cf9..87309c53 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -244,7 +244,6 @@ const Notification: React.FC<NotificationProps> = (props) => { {notification_type === 'FRD_REQ' && ( <View style={styles.buttonsContainer}> <AcceptDeclineButtons - requester={{id, username, first_name, last_name}} onAccept={handleAcceptRequest} onReject={handleDeclineFriendRequest} /> diff --git a/src/components/profile/ProfileMoreInfoDrawer.tsx b/src/components/profile/ProfileMoreInfoDrawer.tsx index 67e59747..ecc45211 100644 --- a/src/components/profile/ProfileMoreInfoDrawer.tsx +++ b/src/components/profile/ProfileMoreInfoDrawer.tsx @@ -1,10 +1,9 @@ import {useNavigation} from '@react-navigation/native'; import React from 'react'; -import {Alert, Image, StyleSheet, TouchableOpacity} from 'react-native'; +import {Image, StyleSheet, TouchableOpacity} from 'react-native'; import {useSelector} from 'react-redux'; import MoreIcon from '../../assets/icons/more_horiz-24px.svg'; import {TAGG_DARK_BLUE, TAGG_LIGHT_BLUE} from '../../constants'; -import {ERROR_ATTEMPT_EDIT_SP} from '../../constants/strings'; import {RootState} from '../../store/rootreducer'; import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; import {GenericMoreInfoDrawer} from '../common'; @@ -23,8 +22,7 @@ const ProfileMoreInfoDrawer: React.FC<ProfileMoreInfoDrawerProps> = (props) => { const {setIsOpen, userXId, isBlocked, handleBlockUnblock, userXName} = props; const { user: {userId, username}, - profile, - } = useSelector((state: RootState) => state?.user); + } = useSelector((state: RootState) => state.user); const isOwnProfile = !userXId || userXName === username; const goToEditProfile = () => { diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 9afb4aba..bea989d9 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -1,4 +1,3 @@ -import AsyncStorage from '@react-native-community/async-storage'; import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import { diff --git a/src/components/search/SearchResultList.tsx b/src/components/search/SearchResultList.tsx index a32760e1..dab447fb 100644 --- a/src/components/search/SearchResultList.tsx +++ b/src/components/search/SearchResultList.tsx @@ -32,6 +32,7 @@ const sectionHeader: React.FC<Boolean> = (showBorder: Boolean) => { const SearchResultList: React.FC<SearchResultsProps> = ({results}) => { const [showEmptyView, setshowEmptyView] = useState<boolean>(false); const {user: loggedInUser} = useSelector((state: RootState) => state.user); + const tabBarHeight = useBottomTabBarHeight(); useEffect(() => { if (results && results.length > 0) { @@ -50,7 +51,7 @@ const SearchResultList: React.FC<SearchResultsProps> = ({results}) => { ) : ( <SectionList onScrollBeginDrag={Keyboard.dismiss} - contentContainerStyle={[{paddingBottom: useBottomTabBarHeight()}]} + contentContainerStyle={[{paddingBottom: tabBarHeight}]} sections={results} keyExtractor={(item, index) => item.id + index} renderItem={({item}) => { diff --git a/src/components/suggestedPeople/SPTaggsBar.tsx b/src/components/suggestedPeople/SPTaggsBar.tsx index 29c58cce..6fe8cef4 100644 --- a/src/components/suggestedPeople/SPTaggsBar.tsx +++ b/src/components/suggestedPeople/SPTaggsBar.tsx @@ -26,8 +26,6 @@ const TaggsBar: React.FC<TaggsBarProps> = ({ const {user} = useSelector((state: RootState) => userXId ? state.userX[screenType][userXId] : state.user, ); - const state: RootState = useStore().getState(); - const allowTaggsNavigation = canViewProfile(state, userXId, screenType); const dispatch = useDispatch(); diff --git a/src/routes/Routes.tsx b/src/routes/Routes.tsx index 04c081da..6fc766ab 100644 --- a/src/routes/Routes.tsx +++ b/src/routes/Routes.tsx @@ -1,4 +1,3 @@ -import AsyncStorage from '@react-native-community/async-storage'; import messaging from '@react-native-firebase/messaging'; import React, {useContext, useEffect, useState} from 'react'; import DeviceInfo from 'react-native-device-info'; @@ -11,7 +10,7 @@ import { updateNewVersionAvailable, } from '../store/actions'; import {RootState} from '../store/rootReducer'; -import {userLogin, connectChatAccount} from '../utils'; +import {connectChatAccount, userLogin} from '../utils'; import Onboarding from './onboarding'; import NavigationBar from './tabs'; diff --git a/src/screens/badge/BadgeItem.tsx b/src/screens/badge/BadgeItem.tsx index 3141e662..1994ce2a 100644 --- a/src/screens/badge/BadgeItem.tsx +++ b/src/screens/badge/BadgeItem.tsx @@ -32,9 +32,7 @@ const BadgeItem: React.FC<BadgeItemProps> = ({ useAngle={true} angle={136.69} style={styles.border}> - <TouchableOpacity - onPress={() => onSelection(title)} - style={{alignSelf: 'center', marginTop: 3}}> + <TouchableOpacity onPress={() => onSelection(title)} style={button}> <LinearGradient colors={index === 0 ? BADGE_GRADIENT_FIRST : BADGE_GRADIENT_REST} // BACKGROUND_GRADIENT_MAP @@ -96,6 +94,10 @@ const styles = StyleSheet.create({ color: 'white', marginHorizontal: '2%', }, + button: { + alignSelf: 'center', + marginTop: 3, + }, }); export default BadgeItem; |