aboutsummaryrefslogtreecommitdiff
path: root/src/components/common
diff options
context:
space:
mode:
authorShravya Ramesh <37447613+shravyaramesh@users.noreply.github.com>2021-07-23 16:01:16 -0700
committerGitHub <noreply@github.com>2021-07-23 16:01:16 -0700
commit93b0bdb6d5d3070ece012626f9d9d6634f0eb0d8 (patch)
treede1aab12445184023db6b7f1e5dce94e8416d233 /src/components/common
parent6fcfb36b37dd51d3e9d5baf025b896cc6f6045ee (diff)
parent2f64db843b80229d08f8f0ae7e1d80b24ac38c12 (diff)
Merge branch 'master' into tma936-pause-video
Diffstat (limited to 'src/components/common')
-rw-r--r--src/components/common/GradientProgressBar.tsx48
-rw-r--r--src/components/common/index.ts1
2 files changed, 49 insertions, 0 deletions
diff --git a/src/components/common/GradientProgressBar.tsx b/src/components/common/GradientProgressBar.tsx
new file mode 100644
index 00000000..fc62bd3c
--- /dev/null
+++ b/src/components/common/GradientProgressBar.tsx
@@ -0,0 +1,48 @@
+import React, {FC} from 'react';
+import {StyleSheet, ViewProps, ViewStyle} from 'react-native';
+import LinearGradient from 'react-native-linear-gradient';
+import Animated, {useAnimatedStyle} from 'react-native-reanimated';
+import {
+ TAGG_LIGHT_BLUE_2,
+ TAGG_LIGHT_BLUE_3,
+ TAGG_PURPLE,
+} from '../../constants';
+import {normalize} from '../../utils';
+
+interface GradientProgressBarProps extends ViewProps {
+ progress: Animated.SharedValue<number>;
+}
+
+const GradientProgressBar: FC<GradientProgressBarProps> = ({
+ style,
+ progress,
+}) => {
+ const animatedProgressStyle = useAnimatedStyle<ViewStyle>(() => ({
+ width: `${(1 - progress.value) * 100}%`,
+ }));
+ return (
+ <LinearGradient
+ style={[styles.bar, style]}
+ useAngle={true}
+ colors={[TAGG_PURPLE, TAGG_LIGHT_BLUE_2]}>
+ <Animated.View style={[styles.blank, animatedProgressStyle]} />
+ </LinearGradient>
+ );
+};
+const styles = StyleSheet.create({
+ container: {
+ borderRadius: 6.5,
+ },
+ bar: {
+ height: normalize(10),
+ borderRadius: 6.5,
+ },
+ blank: {
+ alignSelf: 'flex-end',
+ height: normalize(10),
+ width: '80%',
+ backgroundColor: TAGG_LIGHT_BLUE_3,
+ },
+});
+
+export default GradientProgressBar;
diff --git a/src/components/common/index.ts b/src/components/common/index.ts
index 4f5c0232..5edbb3ad 100644
--- a/src/components/common/index.ts
+++ b/src/components/common/index.ts
@@ -29,3 +29,4 @@ export {default as TaggUserRowCell} from './TaggUserRowCell';
export {default as LikeButton} from './LikeButton';
export {default as TaggUserSelectionCell} from './TaggUserSelectionCell';
export {default as MomentTags} from './MomentTags';
+export {default as GradientProgressBar} from './GradientProgressBar';