Renders the native picker component on iOS and Android.
Replacing Component: React Native Picker
Contents:
- Picker with Icon
- Picker with Icon Style
- Placeholder Picker
- Placeholder Picker without Note
- Picker Text and Item Style
- Picker with Custom Back Button
- Picker with Custom Header
Regular Syntax
{% codetabs name="React Native", type="js" -%}import React, { Component } from "react"; import { Container, Header, Content, Picker, Form } from "native-base";
export default class PickerExample extends Component { constructor(props) { super(props); this.state = { selected: "key1" }; } onValueChange(value: string) { this.setState({ selected: value }); } render() { return (
<Picker note mode="dropdown" {% raw %}style={{ width: 120 }}{% endraw %} selectedValue={this.state.selected} onValueChange={this.onValueChange.bind(this)} > <Picker.Item label="Wallet" value="key0" /> <Picker.Item label="ATM Card" value="key1" /> <Picker.Item label="Debit Card" value="key2" /> <Picker.Item label="Credit Card" value="key3" /> <Picker.Item label="Net Banking" value="key4" /> ); } } {%- language name="Vue Native", type="vue" -%} <script> import { Picker } from "native-base"; export default { components: { Item: Picker.Item }, data: function() { return { selected: "key1" }; }, methods: { onValueChange: function(value) { this.selected = value; } } }; </script>{%- endcodetabs %}
Configuration
| Property | Default | Option | Description |
|---|---|---|---|
| renderHeader | - | - | Makes component that appears as header of the Picker, comes with a backAction prop to close the picker. |
| headerStyle | - | - | Custom style for header (iOS) |
| iosHeader | - | - | Custom text for the header title (iOS) |
| headerBackButtonText | - | - | Custom text for the header back button (iOS) |
| headerBackButtonTextStyle | - | - | Custom text style for the header back button< (iOS)/td> |
| headerTitleStyle | - | - | Custom title style for the header title (iOS) |
| iosIcon | - | - | Icon with picker dropdown (iOS) |
| placeholder | - | - | Placeholder for Picker component (iOS) |
| placeholderStyle | - | - | Custom style for placeholder text (iOS) |
| placeholderIconColor | - | - | Set placeholder icon color (iOS) |
| itemStyle | - | - | Style of items in Picker (iOS) |
| itemTextStyle | - | - | Text style of item component in Picker (iOS) |
| textStyle | - | - | Text style of header (iOS) |
| supportedOrientations | - | Portrait, Landscape, Landscape-left, Landscape-right | Allows the modal to rotate to any of the specified orientations |
| enabled | - | boolean | Enable / disable Picker button |
Note: Styling Picker is restricted to the style props provided in the table. NativeBase Picker wont support its styling to work out of the box. But one can always style the components as per requirements.


