-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.android.js
71 lines (64 loc) · 1.72 KB
/
index.android.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
67
68
69
70
71
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity
} from 'react-native';
import MultiSliders from './MultiSlider'
class MultiSlider extends Component {
constructor(props) {
super(props);
this.state = {
leftValue: 0,
rightValue: 0.5,
};
}
render() {
return (
<View style = {{flex: 1, backgroundColor: 'white'}}>
<View style = {styles.container}>
<MultiSliders
ref = {(ms) => {this._ms = ms }}
trackWidth = {300}
defaultTrackColor = {'#e3e3e3'}
leftThumbColor = {'red'}
rightThumbColor = {'blue'}
rangeColor = {'pink'}
leftValue = {this.state.leftValue}
rightValue = {this.state.rightValue}
onLeftValueChange = {(leftValue) => this.setState({leftValue})}
onRightValueChange = {(rightValue) => this.setState({rightValue})}
/>
</View>
<TouchableOpacity onPress = {() => this.onPress(true)}>
<View style = {styles.button}>
<Text>Click to disable</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress = {() => this.onPress(false)}>
<View style = {styles.button}>
<Text>Click to able</Text>
</View>
</TouchableOpacity>
</View>
);
}
onPress(flag) {
this._ms.setDisable(flag)
}
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
marginTop: 50,
},
button: {
alignItems: 'center',
padding: 20,
marginHorizontal: 10,
marginVertical: 5,
}
});
AppRegistry.registerComponent('MultiSlider', () => MultiSlider);