From fbb9d410b4a525dd6f21d5de7e1e3844b6cf78a7 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 20 Jul 2021 18:51:17 -0400 Subject: Add state check --- src/components/moments/MomentUploadProgressBar.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentUploadProgressBar.tsx b/src/components/moments/MomentUploadProgressBar.tsx index 26c20a46..285f4e84 100644 --- a/src/components/moments/MomentUploadProgressBar.tsx +++ b/src/components/moments/MomentUploadProgressBar.tsx @@ -5,6 +5,7 @@ import {Easing, useSharedValue, withTiming} from 'react-native-reanimated'; import {SafeAreaView} from 'react-native-safe-area-context'; import {useSelector} from 'react-redux'; import {RootState} from '../../store/rootReducer'; +import {MomentUploadStatusType} from '../../types'; import {normalize, SCREEN_WIDTH, StatusBarHeight} from '../../utils'; import {GradientProgressBar} from '../common'; @@ -16,11 +17,13 @@ const MomentUploadProgressBar: React.FC = const progress = useSharedValue(0); useEffect(() => { - progress.value = withTiming(1, { - duration: 5000, - easing: Easing.linear, - }); - }, []); + if (momentUploadStatus === MomentUploadStatusType.Uploading) { + progress.value = withTiming(1, { + duration: 30 * 1000, + easing: Easing.out(Easing.quad), + }); + } + }, [momentUploadStatus]); return ( -- cgit v1.2.3-70-g09d2