• Stars
    star
    190
  • Rank 203,739 (Top 5 %)
  • Language
    JavaScript
  • License
    ISC License
  • Created almost 8 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

☑️ A customiseable FlatList that allows you to select multiple rows

react-native-select-multiple

Build Status dependencies Status JavaScript Style Guide

A customiseable FlatList that allows you to select multiple rows.

select-multiple

Install

npm install react-native-select-multiple

Usage

import React, { Component } from 'react'
import { View } from 'react-native'
import SelectMultiple from 'react-native-select-multiple'

const fruits = ['Apples', 'Oranges', 'Pears']
// --- OR ---
// const fruits = [
//   { label: 'Apples', value: 'appls' },
//   { label: 'Oranges', value: 'orngs' },
//   { label: 'Pears', value: 'pears' }
// ]

class App extends Component {
  state = { selectedFruits: [] }

  onSelectionsChange = (selectedFruits) => {
    // selectedFruits is array of { label, value }
    this.setState({ selectedFruits })
  }

  render () {
    return (
      <View>
        <SelectMultiple
          items={fruits}
          selectedItems={this.state.selectedFruits}
          onSelectionsChange={this.onSelectionsChange} />
      </View>
    )
  }
}
export default App

Customize label

import React, { Component } from 'react'
import { View, Text, Image } from 'react-native'
import SelectMultiple from 'react-native-select-multiple'

const fruits = ['Apples', 'Oranges', 'Pears']
// --- OR ---
// const fruits = [
//   { label: 'Apples', value: 'appls' },
//   { label: 'Oranges', value: 'orngs' },
//   { label: 'Pears', value: 'pears' }
// ]

const renderLabel = (label, style) => {
  return (
    <View style={{flexDirection: 'row', alignItems: 'center'}}>
      <Image style={{width: 42, height: 42}} source={{uri: 'https://dummyimage.com/100x100/52c25a/fff&text=S'}} />
      <View style={{marginLeft: 10}}>
        <Text style={style}>{label}</Text>
      </View>
    </View>
  )
}

class App extends Component {
  state = { selectedFruits: [] }

  onSelectionsChange = (selectedFruits) => {
    // selectedFruits is array of { label, value }
    this.setState({ selectedFruits })
  }

  render () {
    return (
      <View>
        <SelectMultiple
          items={fruits}
          renderLabel={renderLabel}
          selectedItems={this.state.selectedFruits}
          onSelectionsChange={this.onSelectionsChange} />
      </View>
    )
  }
}

Properties

Prop Default Type Description
items - array All items available in the list (array of string or { label, value })
selectedItems [] array The currently selected items (array of string or { label, value })
onSelectionsChange - func Callback called when a user selects or de-selects an item, passed (selections, item)
keyExtractor index func keyExtractor for the FlatList
checkboxSource image object Image source for the checkbox (unchecked).
selectedCheckboxSource image object Image source for the checkbox (checked).
flatListProps {} object Additional props for the flat list
style default styles object Style for the FlatList container.
rowStyle default styles object Style for the row container.
checkboxStyle default styles object Style for the checkbox image.
labelStyle default styles object Style for the text label.
selectedRowStyle default styles object Style for the row container when selected.
selectedCheckboxStyle default styles object Style for the checkbox image when selected.
selectedLabelStyle default styles object Style for the text label when selected.
renderLabel null func Function for render label.
maxSelect null int Maximum number of selected items

Contribute

Feel free to dive in! Open an issue or submit PRs.

License

ISC © TABLEFLIP


A (╯°□°)╯︵TABLEFLIP side project.

More Repositories

1

guvnor

A node process manager that isn't spanners all the way down
JavaScript
426
star
2

nodebot-workshop

A nodeschool workshop on how to get your ardunio alive with johnny-five
JavaScript
207
star
3

react-native-toaster

Simple top-pop toast feedback messages for React Native, also Redux compatible
JavaScript
85
star
4

react-responsive-embed

⚛️ Embed iframes responsively
JavaScript
40
star
5

ipfs-fuse

Mount IPFS MFS as a FUSE volume using Node.js
JavaScript
39
star
6

ipfs-pubsub-chat-example

An example pubsub app that uses window.ipfs, provided by the IPFS Companion web extension
JavaScript
31
star
7

lasercat-workshop

A step by step guide to building your own internet controllable laser turret and cat dazzler...
JavaScript
28
star
8

postmsg-rpc

Tiny RPC over window.postMessage library
JavaScript
27
star
9

ipld-explorer-cli

🔎 Explore the IPLD directed acyclic graph with your keyboard
JavaScript
22
star
10

meteor-sass-bootstrap4

Meteor 1.3 + sass + bootstrap4 the npm way.
JavaScript
19
star
11

ipfs-peer-bw-example

A list of peers eating your bandwidth
JavaScript
18
star
12

ipfs-peer-map-example

A map of IPv4 IPFS peers that uses window.ipfs
JavaScript
17
star
13

mozjpeg-stream

🚿 The awesome JPEG minifying power of mozjpeg wrapped up as a `.pipe` friendly stream.
JavaScript
16
star
14

tableflip

How to (╯°□°)╯︵TABLEFLIP
12
star
15

git-days

📈 How many days did you work on that project?
JavaScript
12
star
16

react-native-meteor-oauth

Oauth2 login to a Meteor server in React Native
JavaScript
12
star
17

nodebots-library

The NodeBots Esoteric Hardware Library & Exchange Program
CSS
11
star
18

zonefile-pegjs

A PEG.js grammar for parsing zonefile DNS configuration
JavaScript
9
star
19

i18n-browserify

An example of i18n as a browserify transform
JavaScript
7
star
20

sandstorm-appstore

Appstore for Sandstorm.io
HTML
6
star
21

pull-postmsg-stream

A pull source and sink for pulling over postMessage
JavaScript
5
star
22

ipfs-friends

get by with a little help from your friends
JavaScript
5
star
23

share-via-ipfs

Share files with friends over IPFS
JavaScript
4
star
24

how-to

❓ How to TABLEFLIP and other stories
4
star
25

dnsify

Simplify your dns config
JavaScript
4
star
26

react-copy-text

Copy text to the clipboard like it's 1999
JavaScript
3
star
27

sumo

A johnny-five sumo-bot
JavaScript
3
star
28

slug-cli

Fix bad filenames with slugify
JavaScript
3
star
29

pull-file-reader

Read an HTML5 File object (from e.g. HTML5 drag and drops) as a pull stream source.
JavaScript
3
star
30

london-tensorflow

Intro slides for London TensorFlow
JavaScript
3
star
31

landexplorer

🗺 The land explorer frontend
JavaScript
3
star
32

raw-collections-example

Example methods which use Meteor's rawCollections capability
JavaScript
2
star
33

flow-router-patterns

Some useful patterns for working with Flow Router
JavaScript
2
star
34

tabs

🔨 TABLEFLIP Automated Build System
JavaScript
2
star
35

footballbot-workshop

A step by step guide to building your own footballbot
JavaScript
2
star
36

post

💌 The TABLEFLIP contact form handler
JavaScript
2
star
37

i18nify

Browserify transform for build time i18n using browserify
JavaScript
2
star
38

makelunch-infrastructure

🔪 💾 Ansible scripts for deploying makelunch
Nginx
2
star
39

apollo-next-example

An example app using apollo, next.js and some other things
JavaScript
2
star
40

react-data-dam

🌊 Holds back your data until you're ready to see the updates.
JavaScript
2
star
41

async-each-series-throttle

Iterate through items in series but throttle iteratee execution
JavaScript
2
star
42

resize-jpeg

🌈 Resize your jpeg and preserve it's original quality
JavaScript
2
star
43

react-provide

React Components for putting a value in context and fishing it out
JavaScript
2
star
44

brandnewweddings

💒 🤖 Website for brandnewweddings.co.uk
HTML
2
star
45

zonefile-parser

A zonefile dns configuration parser
JavaScript
2
star
46

meteor-tachyons

How to make the web look nice with Tachyons from the comfort of a Meteor.
HTML
2
star
47

make-dat-lunch

p2p lunch rota
JavaScript
2
star
48

podcasts

TABLEFLIP round the table - with a mic
1
star
49

interavatar

Claim back your identity from the hashy anonymity, add an avatar to your IPFS peer ID.
JavaScript
1
star
50

scrabble-score-keeper

Module for keeping track of scrabble scores
JavaScript
1
star
51

responsible

Dealing with images responsibly
JavaScript
1
star
52

tars

:shipit: TABLEFLIP Automated Release System
JavaScript
1
star
53

tableflip-www

🤖 ⤴️ The TABLEFLIP website
HTML
1
star
54

tutorwire

Find someone to help you learn
JavaScript
1
star
55

ipfs-gui-review-2018-q2

Highlights of the IPFS GUI work in Q2 2018.
HTML
1
star
56

lunchtray

🍴 Tray application for makelunch
JavaScript
1
star
57

ipfs-filexp

Web based file manager for use with IPFS.
JavaScript
1
star
58

smartsurvey-client

A simple JavaScript client to the SmartSurvey REST API
JavaScript
1
star
59

tune-infrastructure

🎺 💾 Infrastructure project for Tune
Nginx
1
star
60

joi-ipfs-config

Validate JS-IPFS config
JavaScript
1
star
61

tableflip-blog

📜 The TABLEFLIP blog
CSS
1
star
62

joi-multiaddr

Multiaddr validation with Joi
JavaScript
1
star
63

scrabble-score

Map words to their scrabble score
JavaScript
1
star
64

piggybacker

Async keyed job runner, piggyback on results from running jobs with the same key
JavaScript
1
star
65

meteor-near

Finding cities $near clicks with Meteor & Mongo
JavaScript
1
star
66

ssb-mongo-connect

Connect ssb messages to mongo collections.
JavaScript
1
star
67

react-native-uploadcare-image

Uploadcare image wrapper for react native
JavaScript
1
star
68

noisy-circles

Uses the webaudio API to react to sound input
JavaScript
1
star
69

meteor-popmotion

A 12kb JavaScript motion engine, packaged for Meteor
JavaScript
1
star
70

landexplorer-api

🗺️ A graphql api for the landexplorer data
Shell
1
star
71

meteor-method-promises

A simple example of using ES6 promises to handle async actions in Meteor methods
JavaScript
1
star
72

monitor-infrastructure

Infrastructure for the TABLEFLIP monitor
Nginx
1
star
73

chatbot

Mk 1 chatbot
JavaScript
1
star
74

ipld.io

Official website for IPLD
HTML
1
star
75

mem-storage-area

A WebExtension like StorageArea in memory
JavaScript
1
star
76

react-dropdown

A React dropdown menu with a fancy menu arrow and no dependencies
JavaScript
1
star