Skip to content

Latest commit

 

History

History
executable file
·
97 lines (91 loc) · 3.41 KB

Picker.md

File metadata and controls

executable file
·
97 lines (91 loc) · 3.41 KB

Picker

Renders the native picker component on iOS and Android.
Replacing Component: React Native <Picker> For Android use this 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 = {
            selectedItem: undefined,
            selected1: 'key1',
            results: {
                items: []
            }
        }
    }
    onValueChange (value: string) {
        this.setState({
            selected1 : value
        });
    }
    render() {
        return (
            <Container>
                <Content>
                    <Picker
                        supportedOrientations={['portrait','landscape']}
                        iosHeader="Select one"
                        mode="dropdown"
                        selectedValue={this.state.selected1}
                        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
renderHeader (iOS only) - - Takes component that appears as header of the Picker, comes with a backAction prop to close the picker. Like renderHeader={(backAction) =>{ // BODY }
textStyle (iOS only) - - Text style of header.
itemStyle (iOS only) - - Style of items in the Picker
itemTextStyle (iOS only) - - Text style of item component
supportedOrientations - Potrait, Landscape, Landscape-left, Landscape-right Allows the modal to be rotated to any of the specified orientations