From bae0136cb1939302b758249a1978251bd37aaee8 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 20 Apr 2021 17:16:46 -0400 Subject: linted --- src/components/common/AcceptDeclineButtons.tsx | 8 ++------ src/components/common/FriendsButton.tsx | 9 ++++++--- src/components/common/TaggPrompt.tsx | 14 ++++++-------- src/components/messages/TypingIndicator.tsx | 3 ++- src/components/moments/MomentPostHeader.tsx | 2 +- src/components/notifications/Notification.tsx | 1 - src/components/profile/ProfileMoreInfoDrawer.tsx | 6 ++---- src/components/profile/ProfilePreview.tsx | 1 - src/components/search/SearchResultList.tsx | 3 ++- src/components/suggestedPeople/SPTaggsBar.tsx | 2 -- src/routes/Routes.tsx | 3 +-- src/screens/badge/BadgeItem.tsx | 8 +++++--- 12 files changed, 27 insertions(+), 33 deletions(-) (limited to 'src') 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>; } const AcceptDeclineButtons: React.FC = ({ - 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 = ({ }) => { 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 = ({ } }; + const topPadding = {paddingTop: noPadding ? 0 : SCREEN_HEIGHT / 10}; + const bottomPadding = {paddingBottom: noPadding ? 0 : SCREEN_HEIGHT / 50}; + return ( - + {messageHeader} {messageBody} 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 = () => { ); @@ -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 = ({ }) => { 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 = (props) => { {notification_type === 'FRD_REQ' && ( 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 = (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 = (showBorder: Boolean) => { const SearchResultList: React.FC = ({results}) => { const [showEmptyView, setshowEmptyView] = useState(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 = ({results}) => { ) : ( 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 = ({ 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 = ({ useAngle={true} angle={136.69} style={styles.border}> - onSelection(title)} - style={{alignSelf: 'center', marginTop: 3}}> + onSelection(title)} style={button}>