Skip to content

Latest commit

 

History

History
executable file
·
108 lines (102 loc) · 3.27 KB

Picker.md

File metadata and controls

executable file
·
108 lines (102 loc) · 3.27 KB

Picker

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

Preview ios Picker Preview android Picker

Syntax

import React, { Component } from 'react';
import { Container, Content, Picker } from 'native-base';
const Item = Picker.Item;
export default class PickerExample extends Component {
  constructor(props) {
    super(props);
    this.state = {
      selected: 'key1',
      results: {
        items: []
      }
    }
  }
  onValueChange (value: string) {
    this.setState({
      selected : value
    });
  }
  render() {
    return (
      <Container>
        <Content>
          <Picker
            supportedOrientations={['portrait','landscape']}
            iosHeader="Select one"
            headerBackButtonText="Go Back"
            mode="dropdown"
            selectedValue={this.state.selected}
            onValueChange={this.onValueChange.bind(this)}>
            <Item label="Wallet" value="key0" />
            <Item label="ATM Card" value="key1" />
            <Item label="Credit Card" value="key2" />
            <Item label="Debit Card" value="key3" />
         </Picker>
        </Content>
      </Container>
    );
  }
}

Configuration

Property Default Option Description
headerComponent - - Takes component that appears as header of the Picker
textStyle - - Text style of header
itemStyle - - Style of items in the Picker
itemTextStyle - - Text style of item component in Picker
supportedOrientations - Portrait, Landscape, Landscape-left, Landscape-right Allows the modal to be rotated to any of the specified orientations
headerBackButtonText "Back" user-defined text Used for custom backButton text
placeholder - Strings Pass placeholder for Picker component