Socket
Socket
Sign inDemoInstall

@quanterdynamic/react-native-multiple-select

Package Overview
Dependencies
5
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @quanterdynamic/react-native-multiple-select

A customiseable ListView that allows you to select multiple rows


Version published
Maintainers
2
Install size
153 kB
Created

Readme

Source

react-native-multiple-select

A customiseable FlatList that allows you to select multiple rows with custom objects as you want.

Install

npm i @quanterdynamic/react-native-multiple-select

Usage



import React, { Component } from 'react';
import { View, Text } from 'react-native';
import SelectMultiple from '@quanterdynamic/react-native-multiple-select'


const renderLabel = (item) => {
  return (
    <View style={{ marginLeft: 5 }}>
       <Text style={[ { marginLeft: 0 }]}>Id #{item.id} </Text>
       <Text style={[ { marginLeft: 0 }]} >{item.name.firstName}</Text>
       <Text style={[ { marginLeft: 0 }]} >{item.name.lastName}</Text>
       <Text style={[ { marginLeft: 0, marginBottom: 0 }]} >Age {item.age}</Text>
    </View>
  )
}
//any form of array object
let people  = [
    {id : 1, name: {firstName : 'John' , lastName : 'Wick'}, age: '20' },
    {id : 2, name: {firstName : 'Amar',lastName : 'Kham'}, age: '18' },
    {id : 3, name: {firstName : 'Jenny' , lastName : 'Lopez'}, age: '23' }
  ]

class App extends Component {
  
  constructor(props) {
    super(props);
    this.state = {
      people: [],
      selectedPeople: [],
    };
  }

  componentDidMount (){
    this.setState({
      people : people 
    })
  }

  onSelectionsChange = (selectedPeople) => {
    this.setState({ selectedPeople })
  }


  render() {
    
    return (
      <View style={{flex : 1}}>
      
        <SelectMultiple
          items={people }
          renderLabel={renderLabel}
          selectedItems={this.state.selectedPeople}
          onSelectionsChange={this.onSelectionsChange} />
     
        </View>
    );
  }
 
}

export default App;

Keywords

FAQs

Last updated on 13 Jun 2019

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