diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/moments/MomentPost.tsx | 22 | ||||
-rw-r--r-- | src/components/moments/TaggedUsersDrawer.tsx | 112 | ||||
-rw-r--r-- | src/components/moments/index.ts | 1 |
3 files changed, 131 insertions, 4 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx index e789a9bf..5dba5e69 100644 --- a/src/components/moments/MomentPost.tsx +++ b/src/components/moments/MomentPost.tsx @@ -15,6 +15,7 @@ import { import Animated, {EasingNode} from 'react-native-reanimated'; import Video from 'react-native-video'; import {useDispatch, useSelector, useStore} from 'react-redux'; +import {TaggedUsersDrawer} from '.'; import {headerBarOptions} from '../../routes'; import {MomentContext} from '../../screens/profile/IndividualMoment'; import {deleteMomentTag, loadMomentTags} from '../../services'; @@ -61,6 +62,7 @@ const MomentPost: React.FC<MomentPostProps> = ({ const [tags, setTags] = useState<MomentTagType[]>([]); const [visible, setVisible] = useState(false); const [drawerVisible, setDrawerVisible] = useState(false); + const [taggedUsersVisible, setTaggedUsersVisible] = useState(false); const [hideText, setHideText] = useState(false); const [fadeValue, setFadeValue] = useState<Animated.Value<number>>( @@ -199,6 +201,11 @@ const MomentPost: React.FC<MomentPostProps> = ({ return ( <> <StatusBar barStyle={'light-content'} /> + <TaggedUsersDrawer + users={tags.map((tag) => tag.user)} + isOpen={taggedUsersVisible} + setIsOpen={setTaggedUsersVisible} + /> <View style={styles.mainContainer}> <View style={styles.imageContainer}> {isVideo ? ( @@ -249,6 +256,7 @@ const MomentPost: React.FC<MomentPostProps> = ({ </Animated.View> )} <TouchableWithoutFeedback + disabled={isVideo} onPress={() => { setVisible(!visible); setFadeValue(new Animated.Value(0)); @@ -276,10 +284,16 @@ const MomentPost: React.FC<MomentPostProps> = ({ keyboardVerticalOffset={-20}> <View style={styles.bottomContainer}> {tags.length > 0 && ( - <Image - source={require('../../assets/icons/tag_indicate.png')} - style={styles.tagIcon} - /> + <TouchableOpacity + disabled={!isVideo} + onPress={() => + setTaggedUsersVisible((prevState) => !prevState) + }> + <Image + source={require('../../assets/icons/tag_indicate.png')} + style={styles.tagIcon} + /> + </TouchableOpacity> )} <View style={styles.commentsCountContainer}> <CommentsCount diff --git a/src/components/moments/TaggedUsersDrawer.tsx b/src/components/moments/TaggedUsersDrawer.tsx new file mode 100644 index 00000000..86698d30 --- /dev/null +++ b/src/components/moments/TaggedUsersDrawer.tsx @@ -0,0 +1,112 @@ +import React from 'react'; +import { + ScrollView, + StyleSheet, + Text, + TouchableOpacity, + View, +} from 'react-native'; +import {BottomDrawer, ProfilePreview} from '..'; +import {ProfilePreviewType, ScreenType} from '../../types'; +import {isIPhoneX, normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; + +interface TaggedUsersDrawerProps { + users: ProfilePreviewType[]; + isOpen: boolean; + setIsOpen: (open: boolean) => void; +} +const TaggedUsersDrawer: React.FC<TaggedUsersDrawerProps> = ({ + users, + isOpen, + setIsOpen, +}) => { + return ( + <BottomDrawer + initialSnapPosition={isIPhoneX() ? '35%' : '40%'} + showHeader={false} + isOpen={isOpen} + setIsOpen={setIsOpen}> + <View style={styles.mainContainer}> + <View style={styles.headerContainer}> + <Text style={styles.title}>Tagged Friends</Text> + </View> + <View style={styles.scrollViewContainer}> + <ScrollView + contentContainerStyle={styles.scrollView} + horizontal + showsHorizontalScrollIndicator={false}> + {users.map((profilePreview) => ( + <ProfilePreview + previewType={'Suggested People Drawer'} + screenType={ScreenType.SuggestedPeople} + profilePreview={profilePreview} + setMFDrawer={setIsOpen} + /> + ))} + </ScrollView> + </View> + <TouchableOpacity + style={styles.cancelButton} + onPress={() => setIsOpen(false)}> + <Text style={styles.cancelButtonText}>Cancel</Text> + </TouchableOpacity> + </View> + </BottomDrawer> + ); +}; + +const styles = StyleSheet.create({ + mainContainer: { + flexDirection: 'column', + backgroundColor: '#f9f9f9', + width: SCREEN_WIDTH, + height: SCREEN_HEIGHT * 0.46, + borderTopRightRadius: normalize(13), + borderTopLeftRadius: normalize(13), + borderWidth: 0.5, + borderColor: '#fff', + }, + headerContainer: { + alignItems: 'center', + justifyContent: 'center', + paddingVertical: normalize(17), + shadowOffset: {width: 0, height: 2}, + shadowRadius: 3, + shadowColor: '#000', + shadowOpacity: 0.15, + backgroundColor: '#fff', + borderTopRightRadius: normalize(13), + borderTopLeftRadius: normalize(13), + }, + title: { + fontSize: normalize(18), + lineHeight: 20, + fontWeight: 'bold', + }, + scrollViewContainer: { + height: isIPhoneX() ? 153 : 135, + shadowColor: 'rgb(125, 125, 125)', + marginTop: '1%', + }, + scrollView: { + height: '95%', + padding: 0, + marginHorizontal: '5%', + }, + cancelButton: { + backgroundColor: '#F0F0F0', + height: 100, + flexDirection: 'row', + justifyContent: 'center', + }, + cancelButtonText: { + top: isIPhoneX() ? '6%' : '7%', + color: '#698DD3', + fontSize: normalize(16), + fontWeight: '700', + lineHeight: normalize(20), + letterSpacing: normalize(0.1), + }, +}); + +export default TaggedUsersDrawer; diff --git a/src/components/moments/index.ts b/src/components/moments/index.ts index cac2da2e..2cc4c9dd 100644 --- a/src/components/moments/index.ts +++ b/src/components/moments/index.ts @@ -3,3 +3,4 @@ export {default as CaptionScreenHeader} from './CaptionScreenHeader'; export {default as Moment} from './Moment'; export {default as TagFriendsFooter} from './TagFriendsFoooter'; export {default as MomentPost} from './MomentPost'; +export {default as TaggedUsersDrawer} from './TaggedUsersDrawer'; |