React Native Pro Picker
React Native Pro Picker gives you the option to have an ActionSheet-based picker in iOS while maintaining the basic one for android and the web.
You can install react-native-pro-picker by running the following command
npm install react-native-pro-picker
- Add the following import statement:
import { ProPicker, ProPickerOption } from 'react-native-pro-picker';
- Add some options:
let options : ProPickerOption[] = [
{
id: 1,
value: "js",
label: "JavaScript"
},
{
id: 2,
value: "ts",
label: "Typescript"
},
{
id: 3,
value: "kt",
label: "Kotlin"
},
];
- Add the component:
<ProPicker items={options} onItemSelected={(item) => {
// Use the selected item.
}}/>
- Customize your picker with the customization options.
Attribute | Description | Type |
---|---|---|
items | The options to select from. Should be of type ProPickerOption | ProPickerOption[] |
onItemSelected | Callback for when the user selects an item. | () => void |
Attribute | Description | Type | Default Value |
---|---|---|---|
placeholder | Picker Placeholder | string | Select... |
cancelText (iOS only) | Picker cancel button label for iOS Action Sheet | string | Cancel |
enabled | Enables/Disables the picker | boolean | true |
backgroundColor | Background color for the picker's main layout | string | #FFFFFF |
fontColor | Font color for the picker's main layout | string | #000000 |
iosArrowTintColor | Tint color for the iOS Arrow Icon in the picker's main layout | string | #0451E4 |
iosBorderColor | Border color for the iOS picker's main layout | string | #000000 |
Try it on your device, by scanning this QR on the Expo Go app:
(QR not showing? Visit the Expo Project Page)
If you want me to improve this package, feel free to reach out to me, and I'll gladly update it.
Agustin Mareque |
MIT