This package was forked from https://github.com/AdelRedaa97/react-native-select-dropdown. Allow multiple select dropdown with search and custom styles.
npm install @duocvo/react-native-select-dropdownWhy the change? The new library is a complete rewrite using React Native Reanimated for better performance (60 FPS), improved hardware acceleration, and a more flexible API.
We highly recommend all users to migrate to the new package as this version will no longer receive updates or bug fixes.
This package was forked from https://github.com/AdelRedaa97/react-native-select-dropdown
Multiple select and autoFocus options was added.
#### # Using npm
``bash`
npm install @duocvo/react-native-select-dropdown
#### # Using yarn
`bash`
yarn add @duocvo/react-native-select-dropdown
#### Code provided in Examples folder.

``
import SelectDropdown from '@duocvo/react-native-select-dropdown'
...
const emojis = [
'happy',
'cool',
'lol',
'sad',
'cry',
'angry',
'confused',
'excited',
'kiss',
'devil',
'dead',
'wink',
'sick',
'frown',
];
...
onSelect={(selectedItem, index) => {
console.log(selectedItem, index);
}}
renderButtonMultiple={(selectedItems, isOpen) => {
return (
{selectedItems?.map(it => it.item).join(', ') || 'Select your mood'}
);
}}
multiple
renderItem={(item, index, isSelected) => {
return (
...styles.dropdownItemStyle,
...(isSelected && { backgroundColor: '#D2D9DF' }),
}}
>
{item}
);
}}
dropdownStyle={styles.dropdownMenuStyle}
/>
...
const styles = StyleSheet.create({
dropdownButtonStyle: {
width: 200,
height: 50,
backgroundColor: '#E9ECEF',
borderRadius: 12,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 12,
},
dropdownButtonTxtStyle: {
flex: 1,
fontSize: 18,
fontWeight: '500',
color: '#151E26',
},
dropdownMenuStyle: {
backgroundColor: '#E9ECEF',
borderRadius: 8,
},
dropdownItemStyle: {
width: '100%',
flexDirection: 'row',
paddingHorizontal: 12,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 8,
},
dropdownItemTxtStyle: {
flex: 1,
fontSize: 18,
fontWeight: '500',
color: '#151E26',
},
});
- multiple
- data
- onSelect
- disabled
- testID
- onFocus
- onBlur
- showsVerticalScrollIndicator
- search
- reset
- openDropdown
- closeDropdown
- selectIndex
---
Remove diacritics from search input text
| Type | Required |
| -------- | -------- |
| boolean | No |
---
Option focus input in search section
| Type | Required |
| -------- | -------- |
| boolean | No |
---
Enable multiple selection
| Type | Required |
| -------- | -------- |
| boolean | No |
---
function returns React component for the dropdown button when multiple true
| Type | Required |
| -------- | -------- |
| function | No |
---
array of data that will be represented in dropdown 'can be array of objects
| Type | Required |
| ----- | -------- |
| array | Yes |
---
function recieves selected item and its index in data array
| Type | Required |
| -------- | -------- |
| function | Yes |
---
function returns React component for the dropdown button
| Type | Required |
| -------- | -------- |
| function | Yes |
---
function returns React component for each dropdown item
| Type | Required |
| -------- | -------- |
| function | Yes |
---
default selected item in dropdown ( check examples in Demo1)
| Type | Required |
| ---- | -------- |
| any | No |
---
default selected item index
| Type | Required |
| ------- | -------- |
| integer | No |
---
disable dropdown
| Type | Required |
| ------- | -------- |
| boolean | No |
---
array of disabled items index
| Type | Required |
| ----- | -------- |
| array | No |
---
disable auto scroll to selected value
| Type | Required |
| ------- | -------- |
| boolean | No |
---
dropdown menu testID
| Type | Required |
| ------ | -------- |
| string | No |
---
function fires when dropdown is opened
| Type | Required |
| -------- | -------- |
| function | No |
---
function fires when dropdown is closed
| Type | Required |
| -------- | -------- |
| function | No |
---
function fires when dropdown scrolls to the end (for paginations)
| Type | Required |
| -------- | -------- |
| function | No |
---
required to set true when statusbar is translucent (android only)
| Type | Required |
| ------- | -------- |
| boolean | No |
---
style object for dropdown view
| Type | Required |
| ------ | -------- |
| object | No |
---
backdrop color when dropdown is opened
| Type | Required |
| ------ | -------- |
| string | No |
---
When true, shows a vertical scroll indicator.
| Type | Required |
| ------- | -------- |
| boolean | No |
---
enable search functionality
| Type | Required |
| ------- | -------- |
| boolean | No |
---
style object for search input
| Type | Required |
| ------ | -------- |
| object | No |
---
text color for search input
| Type | Required |
| ------ | -------- |
| string | No |
---
style object for search input text
| Type | Required |
| ------ | -------- |
| object | No |
---
placeholder text for search input
| Type | Required |
| ------ | -------- |
| string | No |
---
text color for search input placeholder
| Type | Required |
| ------ | -------- |
| string | No |
---
function returns React component for search input icon
| Type | Required |
| -------- | -------- |
| function | No |
---
function returns React component for search input icon
| Type | Required |
| -------- | -------- |
| function | No |
---
function callback when the search input text changes, this will automatically disable the dropdown's internal search to be implemented manually outside the component
| Type | Required |
| -------- | -------- |
| function | No |
---
| Method | Description |
| -------------------- | -------------------------------- |
| reset() | Remove selection & reset it |
| openDropdown() | Open the dropdown. |
| closeDropdown() | Close the dropdown. |
| selectIndex(index) | Select a specific item by index. |
---