import {useNavigation} from '@react-navigation/native'; import React from 'react'; import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native'; import {Text} from 'react-native-animatable'; import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler'; import LinearGradient from 'react-native-linear-gradient'; import DeleteIcon from '../../assets/icons/delete-logo.svg'; import DownIcon from '../../assets/icons/down_icon.svg'; import BigPlusIcon from '../../assets/icons/plus-icon-white.svg'; import UpIcon from '../../assets/icons/up_icon.svg'; import {TAGG_LIGHT_BLUE} from '../../constants'; import {MomentType, ScreenType} from '../../types'; import {normalize, SCREEN_WIDTH} from '../../utils'; import MomentTile from './MomentTile'; interface MomentProps { title: string; images: MomentType[] | undefined; userXId: string | undefined; screenType: ScreenType; handleMomentCategoryDelete: (_: string) => void; shouldAllowDeletion: boolean; showUpButton: boolean; showDownButton: boolean; move?: (direction: 'up' | 'down', title: string) => void; externalStyles?: Record>; } const Moment: React.FC = ({ title, images, userXId, screenType, handleMomentCategoryDelete, shouldAllowDeletion, showUpButton, showDownButton, move, externalStyles, }) => { const navigation = useNavigation(); return ( {title} {!userXId && ( {showUpButton && move && ( move('up', title)} color={TAGG_LIGHT_BLUE} style={styles.horizontalMargin} /> )} {showDownButton && move && ( move('down', title)} color={TAGG_LIGHT_BLUE} style={styles.horizontalMargin} /> )} )} {!userXId && ( {shouldAllowDeletion && ( handleMomentCategoryDelete(title)} width={19} height={19} style={[styles.horizontalMargin, styles.deleButtonAdjustment]} /> )} )} {images && images.map((imageObj: MomentType) => ( ))} {(images === undefined || images.length === 0) && !userXId && ( navigation.navigate('CameraScreen', { screenType: ScreenType.Profile, selectedCategory: title, }) }> Add a moment of your {title?.toLowerCase()}! )} ); }; const styles = StyleSheet.create({ container: { flex: 1, flexDirection: 'column', backgroundColor: '#eee', }, header: { flex: 1, padding: '3%', backgroundColor: 'white', flexDirection: 'row', alignItems: 'center', }, titleText: { fontSize: normalize(16), fontWeight: 'bold', color: TAGG_LIGHT_BLUE, maxWidth: '70%', }, scrollContainer: { height: SCREEN_WIDTH / 3.25, backgroundColor: '#eee', }, defaultImage: { aspectRatio: 1, height: '100%', alignItems: 'center', justifyContent: 'center', flexDirection: 'column', }, defaultImageText: { fontSize: 14, paddingTop: 10, color: 'white', fontWeight: 'bold', width: '80%', textAlign: 'center', }, buttonsContainer: { flexDirection: 'row', flex: 1, justifyContent: 'space-between', minWidth: 50, alignItems: 'center', }, row: {flexDirection: 'row'}, horizontalMargin: {marginHorizontal: 4}, deleButtonAdjustment: {top: 2}, }); export default Moment;