WheelPicker
A customizable WheelPicker component
(code example)
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β
activeTextColorβ
Text color for the focused row
string
alignβ
Align the content to center, right ot left
WheelPickerAlign
flatListPropsβ
Props to be sent to the FlatList.
FlatListProps
inactiveTextColorβ
Text color for other, non-focused rows
string
initialValueβ
Initial value (uncontrolled)
number | string
itemHeightβ
Height of each item in the WheelPicker
number
itemsβ
Data source for WheelPicker
WheelPickerItemProps[]
labelβ
Additional label to render next to the items text
string
labelPropsβ
Additional label's props
TextProps
labelStyleβ
Additional label's style
TextStyle
numberOfVisibleRowsβ
Number of rows visible
number
onChangeβ
Change item event callback
(item: string | number, index: number) => void
separatorsStyleβ
Extra style for the separators
ViewStyle
styleβ
height is computed according to itemHeight * numberOfVisibleRowsβ
Container's custom style
ViewStyle
testIDβ
test identifier
string
textStyleβ
Row text custom style
TextStyle