forked from steveliles/react-native-circular-slider-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CircularSliderApp.js
66 lines (62 loc) · 1.4 KB
/
CircularSliderApp.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
65
66
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import CircularSlider from './CircularSlider'
class CircularSliderApp extends Component {
constructor(props){
super(props)
this.state = {
slider1: 270,
slider2: 180
}
}
render() {
return (
<View style={styles.root}>
<View style={styles.container}>
<View style={styles.slider1}>
<CircularSlider width={200} height={200} meterColor='#0cd' textColor='#fff'
value={this.state.slider1} onValueChange={(value)=>this.setState({slider1:value})}/>
</View>
<View style={styles.slider2}>
<CircularSlider width={150} height={150} meterColor='#ffa' textColor='#000'
value={this.state.slider2} onValueChange={(value)=>this.setState({slider2:value})}/>
</View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
root: {
flex:1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
},
container: {
position: 'relative',
width: 200,
height: 200
},
slider1: {
position: 'absolute',
top: 0,
left: 0
},
slider2: {
position: 'absolute',
top: 25,
left: 25
}
});
export default CircularSliderApp