diff options
author | Ivan Chen <ivan@tagg.id> | 2021-07-20 18:51:17 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-07-20 18:51:17 -0400 |
commit | fbb9d410b4a525dd6f21d5de7e1e3844b6cf78a7 (patch) | |
tree | 3e9bea271b27050fce7c19c4d10211ec0accb243 | |
parent | 74c853034e893aeda18ee78f59e4539fba6d8fc0 (diff) |
Add state check
-rw-r--r-- | src/components/moments/MomentUploadProgressBar.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
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<MomentUploadProgressBarProps> = 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 ( <View style={styles.background}> |