1.7.0 • Published 6 years ago

react-native-chooser v1.7.0

Weekly downloads
156
License
MIT
Repository
github
Last release
6 years ago

React Native Chooser

Simple DropDown menu for React Native App! Your Select Tag for React Native. Fully Customizable too.

Introduction

React Native Chooser is simple, customizable and easy to use dropdown in React Native. It has been tested on both Android and IOS and works like a charm.

Installation

npm i react-native-chooser --save

Usage

import React, { Component } from 'react';
import {Select, Option} from "react-native-chooser";

import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

export default class AwesomeProject extends Component {

  constructor(props) {
    super(props);
    this.state = {value : "Select Me Please"}
  }
  onSelect(value, label) {
    this.setState({value : value});
  }

  render() {
    return (
      <View style={styles.container}>
        <Select
            onSelect = {this.onSelect.bind(this)}
            defaultText  = {this.state.value}
            style = {{borderWidth : 1, borderColor : "green"}}
            textStyle = {{}}
            backdropStyle  = {{backgroundColor : "#d3d5d6"}}
            optionListStyle = {{backgroundColor : "#F5FCFF"}}
          >
          <Option value = {{name : "azhar"}}>Azhar</Option>
          <Option value = "johnceena">Johnceena</Option>
          <Option value = "undertaker">Undertaker</Option>
          <Option value = "Daniel">Daniel</Option>
          <Option value = "Roman">Roman</Option>
          <Option value = "Stonecold">Stonecold</Option>
          <Option value = "Rock">Rock</Option>
          <Option value = "Sheild">Sheild</Option>
          <Option value = "Orton">Orton</Option>

        </Select>
      </View>
    );
  }
}

Props

Props for Select

Prop NameData TypeDefault ValuesDescription
onSelectfunctionnullfunction that executes on selection of an option
defaultTextstringClick To SelectText to show as default text
styleobjectnullTo style the select box.
backdropStyleobjectnullTo style the overlay
textStyleobjectnullTo style the text shown in the box
optionListStyleobjectnullTo style the selection box
transparentbooleanfalseTo set the transparent prop on Modal
animationTypestring"none"To set the animationType prop on Modal
indicatorstring"none", "up" or "down""none"To enable an indicator arrow
indicatorColorstring"black"The color of the indicator arrow
indicatorSizenumber10The size of the indicator arrow
indicatorStyleobjectnullTo style the indicator arrow
indicatorIconreact elementnullShow the indicator icon
selectedstringnullGive it same value as you give to Option
selectedStyleobjectnullApply styles to the selected Option

Functions for Select

Function NameDescription
setSelectedText(text)Set default text in the select option, often used to reset text.

Props for Option

Prop NameData TypeDefault ValuesDescription
styleobjectnullTo style each option
styleTextobjectnullTo style the text shown in the option

Demo

IOS and Android:

Contributions

Your contributions and suggestions are heartily♡ welcome. (✿◠‿◠)

1.7.0

6 years ago

1.6.3

7 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago