From 9b4ba92df514ca8c5c92c4f9279144e2c9d49e36 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> Date: Wed, 11 Nov 2020 11:13:48 -0800 Subject: [TMA-383] Added report button moment (#114) * Added button on individual moment page to report an issue * Report issue button disappears when clicked on and reappears when alert is closed * Small change * Moved sendReport() to a ReportingService * following user's report button now appears * Update ReportingService.ts Added alert * Added back report button * moved button back to the bottom * Small change Co-authored-by: Ashm Walia Co-authored-by: Husam Salhab <47015061+hsalhab@users.noreply.github.com> --- src/components/moments/Moment.tsx | 6 +++++- src/components/moments/MomentTile.tsx | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/components') diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 1ec5511e..f905bfe3 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -61,7 +61,11 @@ const Moment: React.FC = ({title, images, isProfileView}) => { style={styles.scrollContainer}> {images && images.map((imageObj: MomentType) => ( - + ))} {(images === undefined || images.length === 0) && !isProfileView && ( navigateToImagePicker()}> diff --git a/src/components/moments/MomentTile.tsx b/src/components/moments/MomentTile.tsx index 1d483875..787957e0 100644 --- a/src/components/moments/MomentTile.tsx +++ b/src/components/moments/MomentTile.tsx @@ -2,17 +2,25 @@ import {useNavigation} from '@react-navigation/native'; import React from 'react'; import {StyleSheet, View, Image, TouchableOpacity} from 'react-native'; import {MomentType} from 'src/types'; +import {ProfileContext} from '../../routes'; interface MomentTileProps { moment: MomentType; + isProfileView: boolean; } -const MomentTile: React.FC = ({moment}) => { +const MomentTile: React.FC = ({moment, isProfileView}) => { const navigation = useNavigation(); + + //Username is needed by the IndividualMoment screen + const { + user: {username}, + } = React.useContext(ProfileContext); + const {path_hash} = moment; return ( { - navigation.push('IndividualMoment', {moment}); + navigation.push('IndividualMoment', {moment, isProfileView, username}); }}> -- cgit v1.2.3-70-g09d2