UNPKG

react-native-a11y-slider

Version:

An accessible range slider that supports assistive devices like screen readers

76 lines (75 loc) 2.01 kB
import type { AccessibilityProps, StyleProp, ViewStyle, TextStyle } from "react-native"; /** * The type of slider this is. */ export declare enum SliderType { /** The slider ony has one marker thumb and is defining a single value */ SINGLE = 0, /** The slider has two marker thumbs and defines a min and max value */ RANGE = 1 } /** * Defines the type of marker thumb. * Either the lower value or the upper value in the range. */ export declare enum MarkerType { LOWER = 0, UPPER = 1 } /** * The slider position value */ export type SliderValue = number | string; /** * A position on the slider scale that the marker can stop at */ export type SliderStop = { index: number; value: SliderValue; /** Pixel position for the lower thumb marker */ px: number; /** Pixel position for the upper thumb marker */ pxInverse: number; }; /** * The min/max pixel values that the slider can pan. */ export type PanBoundaries = { min: number; max: number; }; /** * The optional function that can be called to set the accessibility values on the slider marker. */ export type setA11yMarkerPropsFunction = (args: setA11yMarkerPropsFunctionArgs) => AccessibilityProps; export type setA11yMarkerPropsFunctionArgs = { /** The marker type. Either the lower value or the upper value. */ markerType: MarkerType; /** The current marker value */ value: SliderValue; /** The minimum value this marker can be */ minValue?: SliderValue; /** The maximum value this marker can be */ maxValue?: SliderValue; }; /** * Custom marker component props */ export type MarkerProps = { type: MarkerType; markerCount: number; position: SliderStop; selected: boolean; color?: string; }; /** * Custom label component props */ export type LabelProps = { type: MarkerType; markerCount: number; position: SliderStop; selected: boolean; style?: StyleProp<ViewStyle>; textStyle?: StyleProp<TextStyle>; };