aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Kim <brian@tagg.id>2021-06-19 01:59:15 +0900
committerBrian Kim <brian@tagg.id>2021-06-19 01:59:15 +0900
commit75b3f820d05efe419b864a1e830d97dd9741b45b (patch)
tree8ab6310a1317d15c096523e6d0fa89e8743ff189
parent9967cc8954f0e45403ad743cda0774897c56ff08 (diff)
parentea562eff372995cf8f2cfc389d979452a3885c52 (diff)
Merge branch 'image-cropper' of github-brian-tagg:shravyaramesh/Frontend into image-cropper
-rw-r--r--src/components/moments/MomentPost.tsx85
1 files changed, 57 insertions, 28 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index 8a3cfacb..427ef09a 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -8,6 +8,7 @@ import {
StyleSheet,
Text,
TouchableOpacity,
+ TouchableWithoutFeedback,
View,
} from 'react-native';
import Animated, {EasingNode} from 'react-native-reanimated';
@@ -36,6 +37,7 @@ import {
import {mentionPartTypes, renderTextWithMentions} from '../../utils/comments';
import {AddComment} from '../comments';
import CommentsCount from '../comments/CommentsCount';
+import {MomentTags} from '../common';
import {MomentMoreInfoDrawer, TaggAvatar} from '../profile';
interface MomentPostProps {
moment: MomentPostType;
@@ -206,28 +208,36 @@ const MomentPost: React.FC<MomentPostProps> = ({
);
}, [tags]);
- const MomentUserPreview = () => (
- <TouchableOpacity
- onPress={() =>
- navigateToProfile(state, dispatch, navigation, screenType, user)
- }
- style={styles.header}>
- <TaggAvatar
- style={styles.avatar}
- userXId={userXId}
- screenType={screenType}
- editable={false}
- />
- <Text style={styles.headerText}>{user.username}</Text>
- </TouchableOpacity>
+ const MomentPosterPreview = () => (
+ <View style={styles.momentPosterContainer}>
+ <TouchableOpacity
+ onPress={() =>
+ navigateToProfile(state, dispatch, navigation, screenType, user)
+ }
+ style={styles.header}>
+ <TaggAvatar
+ style={styles.avatar}
+ userXId={userXId}
+ screenType={screenType}
+ editable={false}
+ />
+ <Text style={styles.headerText}>{user.username}</Text>
+ </TouchableOpacity>
+ </View>
);
const TagsIcon = () => {
- return tags.length === 0 ? (
- <Image
- source={require('../../assets/icons/tag_indicate.png')}
- style={styles.tagIcon}
- />
+ return tags.length > 0 ? (
+ <TouchableWithoutFeedback
+ onPress={() => {
+ setVisible(!visible);
+ setFadeValue(new Animated.Value(0));
+ }}>
+ <Image
+ source={require('../../assets/icons/tag_indicate.png')}
+ style={styles.tagIcon}
+ />
+ </TouchableWithoutFeedback>
) : (
<React.Fragment />
);
@@ -254,6 +264,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
},
]}
resizeMode={'cover'}
+ ref={imageRef}
/>
<View
style={{
@@ -285,6 +296,26 @@ const MomentPost: React.FC<MomentPostProps> = ({
tags={tags}
/>
</View>
+ {visible && (
+ <Animated.View
+ style={[
+ {
+ opacity: fadeValue,
+ height: isFullScreen
+ ? SCREEN_HEIGHT
+ : SCREEN_WIDTH / aspectRatio,
+ width: SCREEN_WIDTH,
+ marginBottom: '3%',
+ },
+ ]}>
+ <MomentTags
+ editing={false}
+ tags={tags}
+ setTags={() => null}
+ imageRef={imageRef}
+ />
+ </Animated.View>
+ )}
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={-20}>
@@ -302,7 +333,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
}}>
<CommentsCount moment={moment} screenType={screenType} />
</View>
- <MomentUserPreview />
+ <MomentPosterPreview />
{!hideText && (
<>
{moment.caption !== '' &&
@@ -354,7 +385,6 @@ const MomentPost: React.FC<MomentPostProps> = ({
const styles = StyleSheet.create({
postHeader: {},
postContent: {
- // minHeight: SCREEN_HEIGHT * 0.8,
paddingBottom: normalize(20),
},
image: {
@@ -381,12 +411,6 @@ const styles = StyleSheet.create({
marginBottom: normalize(5),
width: SCREEN_WIDTH * 0.79,
},
- tapTag: {
- position: 'absolute',
- backgroundColor: 'red',
- width: 100,
- height: 100,
- },
tagIcon: {
width: normalize(30),
height: normalize(30),
@@ -404,12 +428,17 @@ const styles = StyleSheet.create({
fontWeight: 'bold',
color: 'white',
paddingHorizontal: '3%',
- flex: 1,
},
header: {
alignItems: 'center',
flexDirection: 'row',
marginBottom: normalize(15),
+ alignSelf: 'flex-start',
+ },
+ momentPosterContainer: {
+ flexDirection: 'column',
+ justifyContent: 'center',
+ alignItems: 'center',
},
});