From 6c17a1b13912b3e52ae4301d5a4b0ce50ba5d31d Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 22 Jul 2021 18:54:37 -0400 Subject: Style error and done state --- src/assets/images/green-check.png | Bin 0 -> 116479 bytes src/assets/images/white-x.png | Bin 0 -> 111493 bytes src/components/moments/MomentUploadProgressBar.tsx | 71 +++++++++++++++++---- 3 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 src/assets/images/green-check.png create mode 100644 src/assets/images/white-x.png (limited to 'src') diff --git a/src/assets/images/green-check.png b/src/assets/images/green-check.png new file mode 100644 index 00000000..c8680c53 Binary files /dev/null and b/src/assets/images/green-check.png differ diff --git a/src/assets/images/white-x.png b/src/assets/images/white-x.png new file mode 100644 index 00000000..17f0c50a Binary files /dev/null and b/src/assets/images/white-x.png differ diff --git a/src/components/moments/MomentUploadProgressBar.tsx b/src/components/moments/MomentUploadProgressBar.tsx index afda16e2..0c93ea95 100644 --- a/src/components/moments/MomentUploadProgressBar.tsx +++ b/src/components/moments/MomentUploadProgressBar.tsx @@ -1,5 +1,5 @@ import React, {useEffect} from 'react'; -import {StyleSheet, Text} from 'react-native'; +import {Image, StyleSheet, Text} from 'react-native'; import {View} from 'react-native-animatable'; import { cancelAnimation, @@ -7,7 +7,6 @@ import { useSharedValue, withTiming, } from 'react-native-reanimated'; -import {SafeAreaView} from 'react-native-safe-area-context'; import {useDispatch, useSelector} from 'react-redux'; import {checkMomentUploadFinished} from '../../services'; import {loadUserMoments} from '../../store/actions'; @@ -111,11 +110,16 @@ const MomentUploadProgressBar: React.FC = }, [momentUploadProgressBar?.status]); useEffect(() => { - if (momentUploadProgressBar?.status === MomentUploadStatusType.Done) { + if ( + momentUploadProgressBar?.status === MomentUploadStatusType.Done || + momentUploadProgressBar?.status === MomentUploadStatusType.Error + ) { progress.value = 0; // clear this component after a duration setTimeout(() => { - dispatch(loadUserMoments(loggedInUserId)); + if (momentUploadProgressBar?.status === MomentUploadStatusType.Done) { + dispatch(loadUserMoments(loggedInUserId)); + } dispatch({ type: setMomentUploadProgressBar.type, payload: { @@ -131,8 +135,14 @@ const MomentUploadProgressBar: React.FC = } return ( - - + + {showLoading && ( <> Uploading Moment... @@ -140,12 +150,28 @@ const MomentUploadProgressBar: React.FC = )} {momentUploadProgressBar.status === MomentUploadStatusType.Done && ( - Done + + + + Beautiful, the Moment was uploaded successfully! + + )} {momentUploadProgressBar.status === MomentUploadStatusType.Error && ( - Error + + + + Unable to upload Moment. Please retry + + )} - + ); }; @@ -154,24 +180,45 @@ const styles = StyleSheet.create({ background: { position: 'absolute', zIndex: 999, - height: StatusBarHeight + 100, + height: StatusBarHeight + normalize(84), backgroundColor: 'white', width: '100%', alignItems: 'center', }, container: { - justifyContent: 'space-evenly', - height: '100%', + justifyContent: 'center', + marginTop: StatusBarHeight, + height: normalize(84), }, text: { fontSize: normalize(14), fontWeight: 'bold', lineHeight: 17, marginVertical: 12, + width: '80%', }, bar: { width: SCREEN_WIDTH * 0.9, }, + redBackground: { + backgroundColor: '#EA574C', + }, + row: { + flexDirection: 'row', + alignItems: 'center', + }, + whiteText: { + color: 'white', + fontSize: normalize(14), + fontWeight: 'bold', + lineHeight: 17, + marginVertical: 12, + }, + x: { + width: normalize(26), + height: normalize(26), + marginRight: 10, + }, }); export default MomentUploadProgressBar; -- cgit v1.2.3-70-g09d2