Socket
Socket
Sign inDemoInstall

react-native-multi-selectbox

Package Overview
Dependencies
527
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-multi-selectbox

Platform independent (Android / iOS) Selectbox | Picker | Multi-select | Multi-picker. The idea is to bring out the common user-interface & user-experience on both platforms.


Version published
Weekly downloads
664
decreased by-6.21%
Maintainers
1
Install size
23.4 kB
Created
Weekly downloads
 

Readme

Source

react-native-multi-selectbox

npm version npm downloads

Platform independent (Android / iOS) Selectbox | Picker | Multi-select | Multi-picker. The idea is to bring out the common user-interface & user-experience on both platforms.

demo

Getting started

How to install 🎹

npm install react-native-multi-selectbox

or

yarn add react-native-multi-selectbox

Usage 𖣠

import React, { useState } from 'react'
import { Text, View } from 'react-native'
import SelectBox from 'react-native-multi-selectbox'
import { xorBy } from 'lodash'

// Options data must contain 'item' & 'id' keys

const K_OPTIONS = [
  {
    item: 'Juventus',
    id: 'JUVE',
  },
  {
    item: 'Real Madrid',
    id: 'RM',
  },
  {
    item: 'Barcelona',
    id: 'BR',
  },
  {
    item: 'PSG',
    id: 'PSG',
  },
  {
    item: 'FC Bayern Munich',
    id: 'FBM',
  },
  {
    item: 'Manchester United FC',
    id: 'MUN',
  },
  {
    item: 'Manchester City FC',
    id: 'MCI',
  },
  {
    item: 'Everton FC',
    id: 'EVE',
  },
  {
    item: 'Tottenham Hotspur FC',
    id: 'TOT',
  },
  {
    item: 'Chelsea FC',
    id: 'CHE',
  },
  {
    item: 'Liverpool FC',
    id: 'LIV',
  },
  {
    item: 'Arsenal FC',
    id: 'ARS',
  },

  {
    item: 'Leicester City FC',
    id: 'LEI',
  },
]

function App() {
  const [selectedTeam, setSelectedTeam] = useState({})
  const [selectedTeams, setSelectedTeams] = useState([])
  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 single"
        options={K_OPTIONS}
        value={selectedTeam}
        onChange={onChange()}
        hideInputFilter={false}
      />
      <View style={{ height: 40 }} />
      <Text style={{ fontSize: 20, paddingBottom: 10 }}>MultiSelect Demo</Text>
      <SelectBox
        label="Select multiple"
        options={K_OPTIONS}
        selectedValues={selectedTeams}
        onMultiSelect={onMultiChange()}
        onTapClose={onMultiChange()}
        isMulti
      />
    </View>
  )

  function onMultiChange() {
    return (item) => setSelectedTeams(xorBy(selectedTeams, [item], 'id'))
  }

  function onChange() {
    return (val) => setSelectedTeam(val)
  }
}

export default App


PropTypeDefault Value
labelStringLabel
inputPlaceholderstringLabel
listEmptyTextString"No results found"
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
searchInputPropsobjectDefault props
multiSelectInputFieldPropsobjectDefault props
listOptionPropsobjectDefault props
arrowIconColorcolor stringDefault primary color
searchIconColorcolor stringDefault primary color
toggleIconColorcolor stringDefault primary color
optionsarray[{ item: 'Juventus', id: 'JUVE'},{ item: 'Real Madrid', id: 'RM'},{ item: 'Barcelona', id: 'BR'},{ item: 'PSG', id: 'PSG'},{ item: 'FC Bayern Munich', id: 'FBM'}]

Want to be a contributor? 👷🏼‍♂️👷🏼‍♀️

Check-in develop branch and submit a new pull-request

Issues or feature request? ✍🏼

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

Support & Share 💆🏼‍♂️

Please star the repository on Github to enhance the reach to more developers.

Keywords

FAQs

Last updated on 21 Apr 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc