-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathApp.js
64 lines (58 loc) · 1.59 KB
/
App.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* eslint-disable react-native/no-inline-styles */
import React, { useState } from 'react';
import { View, Text, Pressable } from 'react-native';
import { SegmentedArc } from '@shipt/segmented-arc-for-react-native';
const App = () => {
const [showArcRanges, setShowArcRanges] = useState(false);
const segments = [
{
scale: 0.25,
filledColor: '#FF746E',
emptyColor: '#F2F3F5',
data: { label: 'Red' },
},
{
scale: 0.25,
filledColor: '#F5E478',
emptyColor: '#F2F3F5',
data: { label: 'Yellow' },
},
{
scale: 0.25,
filledColor: '#78F5CA',
emptyColor: '#F2F3F5',
data: { label: 'Green' },
},
{
scale: 0.25,
filledColor: '#6E73FF',
emptyColor: '#F2F3F5',
data: { label: 'Blue' },
},
];
const ranges = ['10', '20', '30', '40', '50'];
const _handlePress = () => {
setShowArcRanges(!showArcRanges);
};
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<SegmentedArc
segments={segments}
fillValue={70}
isAnimated={true}
animationDelay={1000}
showArcRanges={showArcRanges}
ranges={ranges}>
{metaData => (
<Pressable onPress={_handlePress} style={{ alignItems: 'center' }}>
<Text style={{ fontSize: 16, paddingTop: 16 }}>
{metaData.lastFilledSegment.data.label}
</Text>
<Text style={{ lineHeight: 80, fontSize: 24 }}>More info</Text>
</Pressable>
)}
</SegmentedArc>
</View>
);
};
export default App;