1
1
import { PureComponent , ReactElement , ElementRef } from 'react' ;
2
- import { Animated , StyleProp , ViewStyle , PanResponderGestureState , GestureResponderEvent , LayoutChangeEvent , AccessibilityActionEvent , AccessibilityRole , View as RNView } from 'react-native' ;
2
+ import { Animated , StyleProp , ViewStyle , PanResponderGestureState , GestureResponderEvent , LayoutChangeEvent , AccessibilityActionEvent , AccessibilityRole , View as RNView , ViewProps } from 'react-native' ;
3
3
export declare type SliderOnValueChange = ( value : number ) => void ;
4
4
export declare type SliderProps = {
5
5
/**
6
- * Initial value
7
- */
6
+ * Initial value
7
+ */
8
8
value ?: number ;
9
9
/**
10
- * Minimum value
11
- */
10
+ * Minimum value
11
+ */
12
12
minimumValue ?: number ;
13
13
/**
14
- * Maximum value
15
- */
14
+ * Maximum value
15
+ */
16
16
maximumValue ?: number ;
17
17
/**
18
- * Step value of the slider. The value should be between 0 and (maximumValue - minimumValue)
19
- */
18
+ * Step value of the slider. The value should be between 0 and (maximumValue - minimumValue)
19
+ */
20
20
step ?: number ;
21
21
/**
22
- * The color used for the track from minimum value to current value
23
- */
22
+ * The color used for the track from minimum value to current value
23
+ */
24
24
minimumTrackTintColor ?: string ;
25
25
/**
26
- * The track color
27
- */
26
+ * The track color
27
+ */
28
28
maximumTrackTintColor ?: string ;
29
29
/**
30
- * Custom render instead of rendering the track
31
- */
30
+ * Custom render instead of rendering the track
31
+ */
32
32
renderTrack ?: ( ) => ReactElement | ReactElement [ ] ;
33
33
/**
34
- * Thumb color
35
- */
34
+ * Thumb color
35
+ */
36
36
thumbTintColor ?: string ;
37
37
/**
38
- * Callback for onValueChange
39
- */
38
+ * Callback for onValueChange
39
+ */
40
40
onValueChange ?: SliderOnValueChange ;
41
41
/**
42
- * Callback that notifies about slider seeking is started
43
- */
42
+ * Callback that notifies about slider seeking is started
43
+ */
44
44
onSeekStart ?: ( ) => void ;
45
45
/**
46
- * Callback that notifies about slider seeking is finished
47
- */
46
+ * Callback that notifies about slider seeking is finished
47
+ */
48
48
onSeekEnd ?: ( ) => void ;
49
49
/**
50
- * The container style
51
- */
50
+ * The container style
51
+ */
52
52
containerStyle ?: StyleProp < ViewStyle > ;
53
53
/**
54
- * The track style
55
- */
54
+ * The track style
55
+ */
56
56
trackStyle ?: StyleProp < ViewStyle > ;
57
57
/**
58
- * The thumb style
59
- */
58
+ * The thumb style
59
+ */
60
60
thumbStyle ?: ViewStyle ;
61
61
/**
62
- * The active (during press) thumb style
63
- */
62
+ * Defines how far a touch event can start away from the thumb.
63
+ */
64
+ thumbHitSlop ?: ViewProps [ 'hitSlop' ] ;
65
+ /**
66
+ * The active (during press) thumb style
67
+ */
64
68
activeThumbStyle ?: ViewStyle ;
65
69
/**
66
- * If true the Slider will not change it's style on press
67
- */
70
+ * If true the Slider will not change it's style on press
71
+ */
68
72
disableActiveStyling ?: boolean ;
69
73
/**
70
- * If true the Slider will be disabled and will appear in disabled color
71
- */
74
+ * If true the Slider will be disabled and will appear in disabled color
75
+ */
72
76
disabled ?: boolean ;
73
77
/**
74
- * If true the component will have accessibility features enabled
75
- */
78
+ * If true the component will have accessibility features enabled
79
+ */
76
80
accessible ?: boolean ;
77
81
/**
78
82
* The slider's test identifier
79
83
*/
80
84
testID ?: string ;
81
85
} & typeof defaultProps ;
82
- interface SliderState {
86
+ interface State {
83
87
containerSize : Measurements ;
84
88
trackSize : Measurements ;
85
89
thumbSize : Measurements ;
@@ -96,19 +100,31 @@ declare const defaultProps: {
96
100
minimumValue : number ;
97
101
maximumValue : number ;
98
102
step : number ;
103
+ thumbHitSlop : {
104
+ top : number ;
105
+ bottom : number ;
106
+ left : number ;
107
+ right : number ;
108
+ } ;
99
109
} ;
100
110
/**
101
111
* @description : A Slider component
102
112
* @example : https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/SliderScreen.tsx
103
113
* @gif : https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Slider/Slider.gif?raw=true
104
114
*/
105
- export default class Slider extends PureComponent < SliderProps , SliderState > {
115
+ export default class Slider extends PureComponent < SliderProps , State > {
106
116
static displayName : string ;
107
117
static defaultProps : {
108
118
value : number ;
109
119
minimumValue : number ;
110
120
maximumValue : number ;
111
121
step : number ;
122
+ thumbHitSlop : {
123
+ top : number ;
124
+ bottom : number ;
125
+ left : number ;
126
+ right : number ;
127
+ } ;
112
128
} ;
113
129
private thumb ;
114
130
private _thumbStyles ;
@@ -137,7 +153,7 @@ export default class Slider extends PureComponent<SliderProps, SliderState> {
137
153
label : string ;
138
154
} [ ] ;
139
155
} ;
140
- componentDidUpdate ( prevProps : SliderProps , prevState : SliderState ) : void ;
156
+ componentDidUpdate ( prevProps : SliderProps , prevState : State ) : void ;
141
157
componentDidMount ( ) : void ;
142
158
componentWillUnmount ( ) : void ;
143
159
handleMoveShouldSetPanResponder : ( ) => boolean ;
@@ -170,12 +186,6 @@ export default class Slider extends PureComponent<SliderProps, SliderState> {
170
186
handleTrackPress : ( event : GestureResponderEvent ) => void ;
171
187
handleMeasure : ( name : MeasuredVariableName , { nativeEvent } : LayoutChangeEvent ) => void ;
172
188
onAccessibilityAction : ( event : AccessibilityActionEvent ) => void ;
173
- thumbHitSlop : {
174
- top : number ;
175
- bottom : number ;
176
- left : number ;
177
- right : number ;
178
- } ;
179
189
renderThumb : ( ) => JSX . Element ;
180
190
render ( ) : JSX . Element ;
181
191
}
0 commit comments