Socket
Socket
Sign inDemoInstall

react-native-multi-selectbox

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-multi-selectbox

React Native customized multi select for iOS/Android


Version published
Weekly downloads
720
increased by4.35%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-multi-selectbox

Renders the Picker/SelectBox/Dropdown with common styling for iOS/Android.

demo

Getting started

How to install:

npm install react-native-multi-selectbox

or

yarn add react-native-multi-selectbox

How to use ?


import React from 'react'
import { Text, View } from 'react-native'
import SelectBox from './lib'
import { xor } from 'lodash'

export default class App extends React.Component {
  state = {
    selectedLocations: {},
    selectedValues: [],
    locations: [
      { item: 'Afghanistan', id: 'AF' },
      { item: 'land Islands', id: 'AX' },
      { item: 'Albania', id: 'AL' },
      { item: 'Algeria', id: 'DZ' },
      { item: 'American Samoa', id: 'AS' },
      { item: 'AndorrA', id: 'AD' },
      { item: 'Angola', id: 'AO' },
      { item: 'Anguilla', id: 'AI' },
      { item: 'Antarctica', id: 'AQ' },
      { item: 'Antigua and Barbuda', id: 'AG' },
      { item: 'Argentina', id: 'AR' },
      { item: 'Armenia', id: 'AM' },
      { item: 'Aruba', id: 'AW' },
      { item: 'Australia', id: 'AU' },
      { item: 'Austria', id: 'AT' },
      { item: 'Azerbaijan', id: 'AZ' },
      { item: 'Bahamas', id: 'BS' },
      { item: 'Bahrain', id: 'BH' },
      { item: 'Bangladesh', id: 'BD' },
      { item: 'Barbados', id: 'BB' }
    ]
  }
  render() {
    const { locations, selectedLocations, selectedValues } = this.state
    return (
      <View style={{ margin: 30 }}>
        <View style={{ width: '100%', alignItems: 'center' }}>
          <Text style={{ fontSize: 30, paddingBottom: 20 }}>Demos</Text>
        </View>
        <Text style={{ fontSize: 20, paddingBottom: 10 }}>Select Demo</Text>
        <SelectBox
          label="Select"
          options={locations}
          value={selectedLocations}
          onChange={val => this.setState({ selectedLocations: val })}
          hideInputFilter={false}
        />
        <View style={{ height: 40 }}></View>
        <Text style={{ fontSize: 20, paddingBottom: 10 }}>MultiSelect Demo</Text>
        <SelectBox
          label="Select Groups"
          options={locations}
          selectedValues={selectedValues}
          onMultiSelect={item => {
            this.setState({ selectedValues: xor(selectedValues, [item]) })
          }}
          onTapClose={val => this.setState({ selectedValues: xor(selectedValues, [val]) })}
          isMulti
        />
      </View>
    )
  }
}


PropTypeDefault Value
labelStringLabel
inputPlaceholderstringLabel
widthstring"100%"
viewMarginstring"0px"
isMultibooleanfalse
hideInputFilterbooleantrue
selectedValuesarray[]
valuearray[]
selectIconcomponent<Icon name={'downArrow'} />
labelStylestyle objectDefault style
containerStylestyle objectDefault style
inputFilterContainerStylestyle objectDefault style
inputFilterStylestyle objectDefault style
optionsLabelStylestyle objectDefault style
optionContainerStylestyle objectDefault style
multiOptionContainerStylestyle objectDefault style
multiOptionsLabelStylestyle objectDefault style
multiListEmptyLabelStylestyle objectDefault style
listEmptyLabelStylestyle objectDefault style
selectedItemStylestyle objectDefault style
optionsarray[{ item: 'Afghanistan', id: 'AF' },{ item: 'land Islands', id: 'AX' },{ item: 'Albania', id: 'AL' },{ item: 'Algeria', id: 'DZ' },{ item: 'American Samoa', id: 'AS' },{ item: 'AndorrA', id: 'AD' },{ item: 'Angola', id: 'AO' },{ item: 'Anguilla', id: 'AI' },{ item: 'Antarctica', id: 'AQ' },{ item: 'Antigua and Barbuda', id: 'AG' },{ item: 'Argentina', id: 'AR' },{ item: 'Armenia', id: 'AM' },{ item: 'Aruba', id: 'AW' },{ item: 'Australia', id: 'AU' },{ item: 'Austria', id: 'AT' },{ item: 'Azerbaijan', id: 'AZ' },{ item: 'Bahamas', id: 'BS' },{ item: 'Bahrain', id: 'BH' },{ item: 'Bangladesh', id: 'BD' },{ item: 'Barbados', id: 'BB' }]

Want to contribute?

Checkout to develop branch and create a new branch & submit a PR

Issues or feature ?

You can submit a request on https://github.com/sauzy34/react-native-multi-selectbox/issues

Support & Share

Star the repository

Keywords

FAQs

Package last updated on 02 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc