Skip to content

Latest commit

 

History

History
211 lines (203 loc) · 6.15 KB

Picker.md

File metadata and controls

211 lines (203 loc) · 6.15 KB

picker-def-headref

Picker

Renders the native picker component on iOS and Android.
Replacing Component: React Native Picker

Preview ios picker-def-headref Preview android picker-def-headref

Contents:

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
iosHeader - - Custom text for the header title
headerBackButtonText - - Custom text for the header back button
headerBackButtonTextStyle - - Custom text style for the header back button
headerTitleStyle - - Custom title style for the header title
iosIcon - - Icon with picker dropdown
placeholder - - Placeholder for Picker component
placeholderStyle - - Custom style for placeholder text (iOS)
placeholderIconColor - - Set placeholder icon color (iOS)
itemStyle - - Style of items in Picker
itemTextStyle - - Text style of item component in Picker
textStyle - - Text style of header
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.