Code Monkey home page Code Monkey logo

react-native-prefix-picker's Introduction

React Native Prefix Picker Build Status react-native-prefix-picker Codacy Badge npm version

A simple iOS and Android picker for React Native

Introduction

React Native Prefix Picker is simple, customizable and easy to use Picker in React Native. Works with both Android and IOS.

NEW VERSION

Now the prefixs are preloaded

Installation

npm i react-native-prefix-picker --save

Demo

Usage

import React, {
  Component,
  View,
  Text,
} from 'react-native';
import { Select, Picker } from 'react-native-prefix-picker';

class Login extends Component {

  constructor(props) {
    super(props);
    this.state = {
      prefix: '',
    };
  }

  render() {
    return (
      <View
        style={{
          flex: 1,
          backgroundColor: 'white',
          marginTop: 80,
          padding: 20,
        }}
      >
        <Select
          ref="SELECT1"
          pickerRef={() => this.refs.picker}
          width={60}
          height={45}
          style={{
            marginRight: 10,
            padding: 6,
          }}
          styleText={{
            color: '#333333',
            fontSize: 20,
            fontFamily: 'Avenir-Roman',
          }}
          selected={this.state.prefix}
        />
        <Text
          style={{
            fontSize: 20,
            textAlign: 'center',
            margin: 10,
            color: '#f87f1d',
          }}
        >
          TEST
        </Text>
        <Picker
          ref={'picker'}
          selectedValue={'IT'}
          onSubmit={(option) => {
            this.setState({
              prefix: option,
            });
          }}
        />
      </View>
    );
  }
}

export default Login;

Configuration

Select:
Property Type Default Description
width number 200 Width of the selection
height number 40 Height of the selection
pickerRef function required Reference to to display the selection menu
selected string required The value to be displayed.
style object Custom styles to be applied if supplied
styleText object Custom styles to be applied if supplied
disabled bool false If true, disable all interactions for this component.
Picker:
Property Type Default Description
buttonColor string #007AFF Custom styles to be applied if supplied.
selectedValue string null The default value.
itemStyle object Custom styles to be applied if supplied.
onSubmit function required function will be called when item button is pressed
transparent bool false Transparent style for Modal

react-native-prefix-picker's People

Contributors

sarovin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.