diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/comments/CommentTile.tsx | 6 | ||||
-rw-r--r-- | src/components/common/AcceptDeclineButtons.tsx | 8 | ||||
-rw-r--r-- | src/components/common/AvatarTitle.tsx | 2 | ||||
-rw-r--r-- | src/components/common/FriendsButton.tsx | 9 | ||||
-rw-r--r-- | src/components/common/TaggLoadingIndicator.tsx | 2 | ||||
-rw-r--r-- | src/components/common/TaggPrompt.tsx | 14 | ||||
-rw-r--r-- | src/components/messages/ChatInput.tsx | 59 | ||||
-rw-r--r-- | src/components/messages/TypingIndicator.tsx | 3 | ||||
-rw-r--r-- | src/components/moments/MomentPostHeader.tsx | 2 | ||||
-rw-r--r-- | src/components/profile/Friends.tsx | 4 | ||||
-rw-r--r-- | src/components/profile/ProfileMoreInfoDrawer.tsx | 6 | ||||
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 1 | ||||
-rw-r--r-- | src/components/profile/PublicProfile.tsx | 16 | ||||
-rw-r--r-- | src/components/search/SearchResultList.tsx | 3 | ||||
-rw-r--r-- | src/components/suggestedPeople/SPTaggsBar.tsx | 5 | ||||
-rw-r--r-- | src/components/taggs/TwitterTaggPost.tsx | 17 |
16 files changed, 69 insertions, 88 deletions
diff --git a/src/components/comments/CommentTile.tsx b/src/components/comments/CommentTile.tsx index be113523..34eef418 100644 --- a/src/components/comments/CommentTile.tsx +++ b/src/components/comments/CommentTile.tsx @@ -108,7 +108,7 @@ const CommentTile: React.FC<CommentTileProps> = ({ ? `Replies (${comment_object.replies_count})` : 'Replies'; - const renderRightAction = (text: string, color: string, progress) => { + const renderRightAction = (text: string, color: string) => { const pressHandler = async () => { swipeRef.current?.close(); const success = await deleteComment(comment_object.comment_id, isThread); @@ -130,10 +130,10 @@ const CommentTile: React.FC<CommentTileProps> = ({ ); }; - const renderRightActions = (progress: Animated.AnimatedInterpolation) => + const renderRightActions = (_: Animated.AnimatedInterpolation) => canDelete ? ( <View style={styles.swipeActions}> - {renderRightAction('Delete', '#c42634', progress)} + {renderRightAction('Delete', '#c42634')} </View> ) : ( <Fragment /> 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/AvatarTitle.tsx b/src/components/common/AvatarTitle.tsx index a38f46fa..81351327 100644 --- a/src/components/common/AvatarTitle.tsx +++ b/src/components/common/AvatarTitle.tsx @@ -8,7 +8,7 @@ type AvatarTitleProps = { }; const AvatarTitle: React.FC<AvatarTitleProps> = ({avatar}) => { return ( - <View style={[styles.container]}> + <View style={styles.container}> <LinearGradient colors={[TAGGS_GRADIENT.start, TAGGS_GRADIENT.end]} useAngle={true} 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/TaggLoadingIndicator.tsx b/src/components/common/TaggLoadingIndicator.tsx index 91c68622..a829cb6f 100644 --- a/src/components/common/TaggLoadingIndicator.tsx +++ b/src/components/common/TaggLoadingIndicator.tsx @@ -3,7 +3,7 @@ import {Image, StyleSheet, View} from 'react-native'; import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; interface TaggLoadingIndicatorProps { - fullscreen: boolean; + fullscreen?: boolean; } const TaggLoadingIndicator: React.FC<TaggLoadingIndicatorProps> = ({ 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/ChatInput.tsx b/src/components/messages/ChatInput.tsx index 005d4401..bde5fc12 100644 --- a/src/components/messages/ChatInput.tsx +++ b/src/components/messages/ChatInput.tsx @@ -1,12 +1,10 @@ import React from 'react'; import {Image, StyleSheet, View} from 'react-native'; import {TouchableOpacity} from 'react-native-gesture-handler'; -import ImagePicker from 'react-native-image-crop-picker'; import {useStore} from 'react-redux'; import { AutoCompleteInput, MessageInputProps, - useAttachmentPickerContext, useMessageInputContext, } from 'stream-chat-react-native'; import {RootState} from '../../store/rootReducer'; @@ -35,35 +33,35 @@ const ChatInput: React.FC< > = () => { const state: RootState = useStore().getState(); const avatar = state.user.avatar; - const {sendMessage, text, setText, uploadNewImage} = useMessageInputContext(); - const { - setSelectedImages, - selectedImages, - openPicker, - } = useAttachmentPickerContext(); + const {sendMessage, text, setText} = useMessageInputContext(); + // const { + // setSelectedImages, + // selectedImages, + // openPicker, + // } = useAttachmentPickerContext(); - const selectImage = () => { - ImagePicker.openPicker({ - cropping: true, - freeStyleCropEnabled: true, - mediaType: 'photo', - multiple: true, - // includeBase64: true, - }) - .then((pictures) => { - pictures.map((pic) => - uploadNewImage({ - width: pic.width, - height: pic.height, - source: 'picker', - uri: 'ph://' + pic.localIdentifier, - }), - ); - }) - .catch((error) => { - console.log(error); - }); - }; + // const selectImage = () => { + // ImagePicker.openPicker({ + // cropping: true, + // freeStyleCropEnabled: true, + // mediaType: 'photo', + // multiple: true, + // // includeBase64: true, + // }) + // .then((pictures) => { + // pictures.map((pic) => + // uploadNewImage({ + // width: pic.width, + // height: pic.height, + // source: 'picker', + // uri: 'ph://' + pic.localIdentifier, + // }), + // ); + // }) + // .catch((error) => { + // console.log(error); + // }); + // }; return ( <View style={styles.container}> @@ -139,7 +137,6 @@ const styles = StyleSheet.create({ marginRight: 10, width: 100, alignSelf: 'flex-end', - // borderWidth: 1, }, }); 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/profile/Friends.tsx b/src/components/profile/Friends.tsx index b754b71a..a7a06567 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -1,4 +1,3 @@ -import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import {ScrollView, StyleSheet, Text, View} from 'react-native'; import {checkPermission} from 'react-native-contacts'; @@ -21,14 +20,13 @@ import {ProfilePreview} from '../profile'; interface FriendsProps { result: Array<ProfilePreviewType>; screenType: ScreenType; - userId: string; + userId: string | undefined; } const Friends: React.FC<FriendsProps> = ({result, screenType, userId}) => { const state: RootState = useStore().getState(); const dispatch = useDispatch(); const {user: loggedInUser = NO_USER} = state.user; - const navigation = useNavigation(); const [usersFromContacts, setUsersFromContacts] = useState< ProfilePreviewType[] >([]); 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/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx index d2ee8626..b8920351 100644 --- a/src/components/profile/PublicProfile.tsx +++ b/src/components/profile/PublicProfile.tsx @@ -15,17 +15,9 @@ import { deleteUserMomentsForCategory, updateMomentCategories, } from '../../store/actions'; -import { - EMPTY_MOMENTS_LIST, - NO_PROFILE, - NO_USER, -} from '../../store/initialStates'; +import {EMPTY_MOMENTS_LIST, NO_PROFILE} from '../../store/initialStates'; import {RootState} from '../../store/rootreducer'; -import { - CategorySelectionScreenType, - ContentProps, - MomentType, -} from '../../types'; +import {ContentProps, MomentType} from '../../types'; import {moveCategory, normalize, SCREEN_HEIGHT} from '../../utils'; import {TaggPrompt} from '../common'; import {Moment} from '../moments'; @@ -52,10 +44,6 @@ const PublicProfile: React.FC<ContentProps> = ({ userXId ? state.userX[screenType][userXId] : state.momentCategories, ); - const {user: loggedInUser = NO_USER} = useSelector( - (state: RootState) => state.user, - ); - const navigation = useNavigation(); /** 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..3ab33da1 100644 --- a/src/components/suggestedPeople/SPTaggsBar.tsx +++ b/src/components/suggestedPeople/SPTaggsBar.tsx @@ -1,13 +1,12 @@ import React, {useEffect, useState} from 'react'; import {StyleSheet} from 'react-native'; import Animated from 'react-native-reanimated'; -import {useDispatch, useSelector, useStore} from 'react-redux'; +import {useDispatch, useSelector} from 'react-redux'; import {INTEGRATED_SOCIAL_LIST, SOCIAL_LIST} from '../../constants'; import {getLinkedSocials} from '../../services'; import {loadIndividualSocial, updateSocial} from '../../store/actions'; import {RootState} from '../../store/rootReducer'; import {ScreenType} from '../../types'; -import {canViewProfile} from '../../utils'; import Tagg from '../taggs/Tagg'; const {View, ScrollView} = Animated; @@ -26,8 +25,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/components/taggs/TwitterTaggPost.tsx b/src/components/taggs/TwitterTaggPost.tsx index b2889e3e..0a6f53d8 100644 --- a/src/components/taggs/TwitterTaggPost.tsx +++ b/src/components/taggs/TwitterTaggPost.tsx @@ -1,12 +1,17 @@ import React from 'react'; -import { Image, Linking, StyleSheet, View } from 'react-native'; -import { Text } from 'react-native-animatable'; +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, TAGG_LIGHT_BLUE_2 } from '../../constants'; -import { TwitterPostType } from '../../types'; -import { handleOpenSocialUrlOnBrowser, SCREEN_WIDTH } from '../../utils'; -import { DateLabel, PostCarousel } from '../common'; +import { + AVATAR_DIM, + TAGGS_GRADIENT, + TAGG_LIGHT_BLUE, + TAGG_LIGHT_BLUE_2, +} from '../../constants'; +import {TwitterPostType} from '../../types'; +import {handleOpenSocialUrlOnBrowser, SCREEN_WIDTH} from '../../utils'; +import {DateLabel, PostCarousel} from '../common'; interface TwitterTaggPostProps { ownerHandle: string; |