diff options
-rw-r--r-- | src/components/comments/ZoomInCropper.tsx | 37 | ||||
-rw-r--r-- | src/components/moments/MomentCommentPreview.tsx | 8 | ||||
-rw-r--r-- | src/components/moments/MomentPost.tsx | 1 | ||||
-rw-r--r-- | src/screens/moments/TagFriendsScreen.tsx | 2 |
4 files changed, 18 insertions, 30 deletions
diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx index 79047b41..4b35464c 100644 --- a/src/components/comments/ZoomInCropper.tsx +++ b/src/components/comments/ZoomInCropper.tsx @@ -1,22 +1,14 @@ import {RouteProp} from '@react-navigation/core'; -import {useFocusEffect} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; -import React, {useCallback, useEffect, useState} from 'react'; -import { - Dimensions, - Image, - StyleSheet, - TouchableOpacity, - View, -} from 'react-native'; +import {default as React, useEffect, useState} from 'react'; +import {Image, StyleSheet, TouchableOpacity} from 'react-native'; import {normalize} from 'react-native-elements'; import ImageZoom, {IOnMove} from 'react-native-image-pan-zoom'; +import PhotoManipulator from 'react-native-photo-manipulator'; import CloseIcon from '../../assets/ionicons/close-outline.svg'; import {MainStackParams} from '../../routes'; import {HeaderHeight, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; -import {LoadingIndicator, TaggSquareButton} from '../common'; -import PhotoManipulator from 'react-native-photo-manipulator'; -import {trackPromise} from 'react-promise-tracker'; +import {TaggSquareButton} from '../common'; type ZoomInCropperRouteProps = RouteProp<MainStackParams, 'ZoomInCropper'>; type ZoomInCropperNavigationProps = StackNavigationProp< @@ -35,18 +27,11 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({ const {screenType, title, image} = route.params; const [aspectRatio, setAspectRatio] = useState<number>(1); - useFocusEffect( - useCallback(() => { - navigation.dangerouslyGetParent()?.setOptions({ - tabBarVisible: false, - }); - return () => { - navigation.dangerouslyGetParent()?.setOptions({ - tabBarVisible: true, - }); - }; - }, [navigation]), - ); + useEffect(() => { + navigation.dangerouslyGetParent()?.setOptions({ + tabBarVisible: false, + }); + }, []); useEffect(() => { if (image.sourceURL) { @@ -132,8 +117,8 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({ </TouchableOpacity> <ImageZoom style={{backgroundColor: 'black'}} - cropWidth={Dimensions.get('window').width} - cropHeight={Dimensions.get('window').height} + cropWidth={SCREEN_WIDTH} + cropHeight={SCREEN_HEIGHT} imageWidth={SCREEN_WIDTH} imageHeight={SCREEN_WIDTH / aspectRatio} onMove={onMove}> diff --git a/src/components/moments/MomentCommentPreview.tsx b/src/components/moments/MomentCommentPreview.tsx index e53ed258..232568f1 100644 --- a/src/components/moments/MomentCommentPreview.tsx +++ b/src/components/moments/MomentCommentPreview.tsx @@ -23,7 +23,9 @@ const MomentCommentPreview: React.FC<MomentCommentPreviewProps> = ({ const navigation = useNavigation(); const state = useStore().getState(); const commentCountText = - commentsCount === 0 ? 'No Comments' : commentsCount + ' comments'; + !commentsCount || commentsCount === 0 + ? 'No Comments' + : commentsCount + ' comments'; return ( <TouchableOpacity @@ -35,7 +37,7 @@ const MomentCommentPreview: React.FC<MomentCommentPreviewProps> = ({ }) }> <Text style={styles.whiteBold}>{commentCountText}</Text> - {commentPreview !== null && ( + {commentPreview && ( <View style={styles.previewContainer}> <Image source={{ @@ -50,7 +52,7 @@ const MomentCommentPreview: React.FC<MomentCommentPreviewProps> = ({ {renderTextWithMentions({ value: commentPreview.comment, styles: styles.normalFont, - partTypes: mentionPartTypes('white'), + partTypes: mentionPartTypes('white', 'comment'), onPress: (user: UserType) => navigateToProfile( state, diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx index 0f105c0d..1a0dc981 100644 --- a/src/components/moments/MomentPost.tsx +++ b/src/components/moments/MomentPost.tsx @@ -264,6 +264,7 @@ const MomentPost: React.FC<MomentPostProps> = ({ }, ]} resizeMode={'cover'} + ref={imageRef} /> <View style={{ diff --git a/src/screens/moments/TagFriendsScreen.tsx b/src/screens/moments/TagFriendsScreen.tsx index 6956dc0d..570c3776 100644 --- a/src/screens/moments/TagFriendsScreen.tsx +++ b/src/screens/moments/TagFriendsScreen.tsx @@ -86,7 +86,7 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => { ref={imageRef} style={styles.image} source={{uri: imagePath}} - resizeMode={'contain'} + resizeMode={'cover'} /> </TouchableWithoutFeedback> {tags.length !== 0 && ( |