File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,10 @@ export interface SliderProps extends AccessibilityProps {
139
139
* Whether to use the new Slider implementation using Reanimated
140
140
*/
141
141
migrate ?: boolean ;
142
+ /**
143
+ * Control the throttle time of the onValueChange and onRangeChange callbacks
144
+ */
145
+ throttleTime ?: number ;
142
146
}
143
147
144
148
type Props = SliderProps & ForwardRefInjectedProps < SliderRef > ;
@@ -188,7 +192,8 @@ const Slider = React.memo((props: Props) => {
188
192
useGap = true ,
189
193
accessible = true ,
190
194
testID,
191
- enableThumbShadow = true
195
+ enableThumbShadow = true ,
196
+ throttleTime = 200
192
197
} = themeProps ;
193
198
194
199
const accessibilityProps = useMemo ( ( ) => {
@@ -277,11 +282,11 @@ const Slider = React.memo((props: Props) => {
277
282
} else {
278
283
didValueUpdate . current = false ;
279
284
}
280
- } , 200 ) , [ onValueChange ] ) ;
285
+ } , throttleTime ) , [ onValueChange ] ) ;
281
286
282
287
const onRangeChangeThrottled = useCallback ( _ . throttle ( ( min , max ) => {
283
288
onRangeChange ?.( { min, max} ) ;
284
- } , 100 ) , [ onRangeChange ] ) ;
289
+ } , throttleTime ) , [ onRangeChange ] ) ;
285
290
286
291
useAnimatedReaction ( ( ) => {
287
292
return Math . round ( defaultThumbOffset . value ) ;
Original file line number Diff line number Diff line change 91
91
"type" : " boolean" ,
92
92
"description" : " If true the component will have accessibility features enabled"
93
93
},
94
+ {
95
+ "name" : " throttleTime" ,
96
+ "type" : " number" ,
97
+ "description" : " Control the throttle time of the onValueChange and onRangeChange callbacks"
98
+ },
94
99
{"name" : " testID" , "type" : " string" , "description" : " The component test id" }
95
100
],
96
101
"snippet" : [
You can’t perform that action at this time.
0 commit comments