
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
react-native-select-multiple
Advanced tools
A customiseable ListView that allows you to select multiple rows
A customiseable FlatList that allows you to select multiple rows.
npm install react-native-select-multiple
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
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>
)
}
}
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 |
Feel free to dive in! Open an issue or submit PRs.
ISC © TABLEFLIP
A (╯°□°)╯︵TABLEFLIP side project.
FAQs
A customiseable ListView that allows you to select multiple rows
The npm package react-native-select-multiple receives a total of 1,206 weekly downloads. As such, react-native-select-multiple popularity was classified as popular.
We found that react-native-select-multiple demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.