1/** 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 * 7 * @format 8 */ 9 10import type * as React from 'react'; 11import {Constructor} from '../../../types/private/Utilities'; 12import {ImageURISource} from '../../Image/ImageSource'; 13import {NativeMethods} from '../../../types/public/ReactNativeTypes'; 14import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet'; 15import {ViewStyle} from '../../StyleSheet/StyleSheetTypes'; 16import {ViewProps} from '../View/ViewPropTypes'; 17 18export interface SliderPropsAndroid extends ViewProps { 19 /** 20 * Color of the foreground switch grip. 21 */ 22 thumbTintColor?: ColorValue | undefined; 23} 24 25export interface SliderPropsIOS extends ViewProps { 26 /** 27 * Assigns a maximum track image. Only static images are supported. 28 * The leftmost pixel of the image will be stretched to fill the track. 29 */ 30 maximumTrackImage?: ImageURISource | undefined; 31 32 /** 33 * Assigns a minimum track image. Only static images are supported. 34 * The rightmost pixel of the image will be stretched to fill the track. 35 */ 36 minimumTrackImage?: ImageURISource | undefined; 37 38 /** 39 * Sets an image for the thumb. Only static images are supported. 40 */ 41 thumbImage?: ImageURISource | undefined; 42 43 /** 44 * Assigns a single image for the track. Only static images 45 * are supported. The center pixel of the image will be stretched 46 * to fill the track. 47 */ 48 trackImage?: ImageURISource | undefined; 49} 50 51export interface SliderProps extends SliderPropsIOS, SliderPropsAndroid { 52 /** 53 * If true the user won't be able to move the slider. 54 * Default value is false. 55 */ 56 disabled?: boolean | undefined; 57 58 /** 59 * The color used for the track to the right of the button. 60 * Overrides the default blue gradient image. 61 */ 62 maximumTrackTintColor?: ColorValue | undefined; 63 64 /** 65 * Initial maximum value of the slider. Default value is 1. 66 */ 67 maximumValue?: number | undefined; 68 69 /** 70 * The color used for the track to the left of the button. 71 * Overrides the default blue gradient image. 72 */ 73 minimumTrackTintColor?: ColorValue | undefined; 74 75 /** 76 * Initial minimum value of the slider. Default value is 0. 77 */ 78 minimumValue?: number | undefined; 79 80 /** 81 * Callback called when the user finishes changing the value (e.g. when the slider is released). 82 */ 83 onSlidingComplete?: ((value: number) => void) | undefined; 84 85 /** 86 * Callback continuously called while the user is dragging the slider. 87 */ 88 onValueChange?: ((value: number) => void) | undefined; 89 90 /** 91 * Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0. 92 */ 93 step?: number | undefined; 94 95 /** 96 * Used to style and layout the Slider. See StyleSheet.js for more info. 97 */ 98 style?: StyleProp<ViewStyle> | undefined; 99 100 /** 101 * Used to locate this view in UI automation tests. 102 */ 103 testID?: string | undefined; 104 105 /** 106 * Initial value of the slider. The value should be between minimumValue 107 * and maximumValue, which default to 0 and 1 respectively. 108 * Default value is 0. 109 * This is not a controlled component, you don't need to update 110 * the value during dragging. 111 */ 112 value?: number | undefined; 113} 114 115/** 116 * A component used to select a single value from a range of values. 117 */ 118declare class SliderComponent extends React.Component<SliderProps> {} 119declare const SliderBase: Constructor<NativeMethods> & typeof SliderComponent; 120/** 121 * Slider has been extracted from react-native core and will be removed in a future release. 122 * It can now be installed and imported from `@react-native-community/slider` instead of 'react-native'. 123 * @see https://github.com/callstack/react-native-slider 124 * @deprecated 125 */ 126export class Slider extends SliderBase {} 127/** SliderIOS has been removed from react-native. 128 * It can now be installed and imported from `@react-native-community/slider` instead of 'react-native'. 129 * @see https://github.com/callstack/react-native-slider 130 * @deprecated 131 */ 132export type SliderIOS = Slider; 133