Giter Site home page Giter Site logo

react-native-select-two's Introduction

react-native-select-two

Component like Select2 on web for React Native

Single select

Add it to your project

  1. Insall package
    • Using NPM npm install react-native-select-two
    • or:
    • Using Yarn yarn add react-native-select-two
  2. Install React Native Modal dependence
  • Using NPM npm install react-native-modal
  • or -Using Yarn yarn add react-native-modal
  1. Import package import Select2 from 'react-native-select-two';

Usage

import React, { Component } from "react"
import { View, Text, StyleSheet } from "react-native"
import Select2 from "react-native-select-two"

const mockData = [
  { id: 1, name: "React Native Developer", checked: true }, // set default checked for render option item
  { id: 2, name: "Android Developer" },
  { id: 3, name: "iOS Developer" }
]

// create a component
class CreateNewAppointment extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Select2
          isSelectSingle
          style={{ borderRadius: 5 }}
          colorTheme="blue"
          popupTitle="Select item"
          title="Select item"
          data={mockData}
          onSelect={data => {
            this.setState({ data })
          }}
          onRemoveItem={data => {
            this.setState({ data })
          }}
        />
      </View>
    )
  }
}

Multiple select

Multiple select

Properties

Property name Type Default Description
style Object none Custom style for component
title String none String display when you don't select any item
data Array *required Datasource of list options: an array of objects (each object have name and id property)
onSelect Function none The callback function trigger after you press select button
onRemoveItem Function none The callback function trigger after you press tags to remove them
popupTitle String none Title of modal select item
colorTheme string/color #16a45f Color for componet
isSelectSingle Bool false Selelect only one option
showSearchBox Bool true Show or hide search field
cancelButtonText string Hủy Cancel button text title
selectButtonText String Chọn Select button text title
searchPlaceHolderText String Nhập vào từ khóa Placeholder text for search field
listEmptyTitle String Không tìm thấy lựa chọn phù hợp Title to show when there's no item to be render
defaultFontName String none Set custom font for all component
selectedTitlteStyle Object none Set custom style for display selected title text
buttonTextStyle Object none Set custom button text style
buttonStyle Object none Set custom button style

MIT Licensed

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.