-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathApp.tsx
114 lines (111 loc) · 2.97 KB
/
App.tsx
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import * as React from 'react';
import { StyleSheet, View, Text, SafeAreaView, ScrollView } from 'react-native';
import RangeSlider from '@jesster2k10/react-native-range-slider';
export default function App() {
const onChange = (min: number, max: number) => {
console.log('Max: ', max);
console.log('Min: ', min);
};
return (
<SafeAreaView style={styles.container}>
<ScrollView style={styles.container}>
<View>
<Text style={styles.title}>Basic Slider</Text>
<RangeSlider
min={0}
max={100}
onChange={onChange}
selectedMinimum={20}
selectedMaximum={40}
style={styles.slider}
/>
</View>
<View>
<Text style={styles.title}>Custom Font Slider</Text>
<RangeSlider
min={0}
max={100}
tintColor="#cc3956"
tintColorBetweenHandles="#cc3956"
handleColor="#cc3956"
maxLabelFont="AvenirNext-Bold"
minLabelFont="AvenirNext-Regular"
minLabelFontSize={15}
maxLabelFontSize={15}
onChange={onChange}
selectedMinimum={20}
selectedMaximum={40}
style={styles.slider}
/>
</View>
<View>
<Text style={styles.title}>Prefixed Slider</Text>
<RangeSlider
min={0}
max={100}
prefix="$"
onChange={onChange}
selectedMinimum={20}
selectedMaximum={40}
style={styles.slider}
/>
</View>
<View>
<Text style={styles.title}>Suffixed Slider</Text>
<RangeSlider
min={0}
max={100}
suffix=" US$"
onChange={onChange}
selectedMinimum={20}
selectedMaximum={40}
style={styles.slider}
/>
</View>
<View>
<Text style={styles.title}>Simple Slider (Range Disabled)</Text>
<RangeSlider
type="slider"
min={0}
max={100}
onChange={onChange}
selectedMinimum={20}
selectedMaximum={40}
style={styles.slider}
/>
</View>
<View>
<Text style={styles.title}>Customized Handle</Text>
<RangeSlider
type="slider"
min={0}
max={100}
handleDiameter={30}
handleBorderWidth={5}
handleBorderColor="#00000"
onChange={onChange}
selectedMinimum={20}
selectedMaximum={40}
style={styles.slider}
/>
</View>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
paddingTop: 25,
},
title: {
marginLeft: 15,
marginBottom: 15,
textAlign: 'left',
fontWeight: 'bold',
},
slider: {
marginBottom: 15,
},
});