WheelPicker
A customizable WheelPicker component
(code example)
note
When using Android by default the FlatList will have maxToRenderPerBatch
prop set to items.length
to solve FlatList bug on Android, you can override it by passing your own flatListProps
with maxToRenderPerBatch
prop.
See the RN FlatList issue for more info: https://github.com/facebook/react-native/issues/15990
#
Usage<WheelPicker items={[{label: 'Yes', value: 'yes'}, {label: 'No', value: 'no'}, {label: 'Maybe', value: 'maybe'}]} initialValue={'yes'} onChange={() => console.log('changed')}/>
#
API#
activeTextColorText color for the focused row
string
#
alignAlign the content to center, right ot left
WheelPickerAlign
#
flatListPropsProps to be sent to the FlatList.
FlatListProps
#
inactiveTextColorText color for other, non-focused rows
string
#
initialValueInitial value (uncontrolled)
number | string
#
itemHeightHeight of each item in the WheelPicker
number
#
itemsData source for WheelPicker
WheelPickerItemProps[]
#
labelAdditional label to render next to the items text
string
#
labelPropsAdditional label's props
TextProps
#
labelStyleAdditional label's style
TextStyle
#
numberOfVisibleRowsNumber of rows visible
number
#
onChangeChange item event callback
(item: string | number, index: number) => void
#
separatorsStyleExtra style for the separators
ViewStyle
#
style#
height is computed according to itemHeight * numberOfVisibleRowsContainer's custom style
ViewStyle
#
testIDtest identifier
string
#
textStyleRow text custom style
TextStyle