Phillips Hue dimming slider
npm install react-native-expandable-slider
View Online Demo Snack
If you place this component inside ScrollView, please set canCancelContentTouches={false}
for ScrollView container
import ExpandableSlider from 'react-native-expandable-slider';
function Example() {
return (
<ExpandableSlider
min={800}
max={20000}
value={value}
onSlide={handleValueChange}
heightRef={heightRef}
style={styles.slider}
/>
);
}
interface ExpandableSliderProps {
/**
* Size of the slider indicator (px)
*
* @type {number}
*/
indicatorSize?: number;
/**
* Min value the slider will emit
*
* @type {number}
*/
min?: number;
/**
* Max value the slider will emit
*
* @type {number}
*/
max?: number;
/**
* Current value to display
*
* @type {number}
*/
value?: number;
/**
* The slider outer style
*
* @type {StyleProp<ViewStyle>}
*/
style?: ViewProps['style'];
/**
* Trigger a haptic response when user touch the slider
*
* @type {boolean}
*/
useHapticResponse?: boolean;
/**
* A mutable ref object of type number,
* let the slider know how wide it will expand
*/
heightRef?: MutableRefObject<number>;
/**
* Emit new value while sliding
*
* @type {(value: number) => (void | Promise<void>)}
*/
onSlide?: OnSliderChange;
/**
* Emit new value when sliding completed
*
* @type {(value: number) => (void | Promise<void>)}
*/
onSlideCompleted?: OnSliderChange;
/**
* Velocity of the slider animation
*/
slidingVelocity?: number;
/**
* Slider's height animated duration
*/
heightAnimatedDuration?: number;
}
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT