aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/GradientProgressBar.tsx
blob: 2f7f0431291ba2dd9d9c3f3fb0f271dfb63808d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React, {FC} from 'react';
import {StyleSheet, View, ViewProps} from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import {
  TAGG_LIGHT_BLUE_2,
  TAGG_LIGHT_BLUE_3,
  TAGG_PURPLE,
} from '../../constants';
import {normalize} from '../../utils';

interface GradientProgressBarProps extends ViewProps {
  progress: number;
}

const GradientProgressBar: FC<GradientProgressBarProps> = ({
  style,
  progress,
}) => {
  return (
    <LinearGradient
      style={[styles.bar, style]}
      useAngle={true}
      colors={[TAGG_PURPLE, TAGG_LIGHT_BLUE_2]}>
      <View style={[styles.blank, {width: `${(1 - progress) * 100}%`}]} />
    </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;