

A highly customized dropdown,select,picker menu for react native
source link: https://reactnativeexample.com/a-highly-customized-dropdown-select-picker-menu-for-react-native/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

react-native-select-dropdown
react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.
Installation
# Using npm
npm install react-native-select-dropdown
# Using yarn
yarn add react-native-select-dropdown
Code provided in Examples folder.
Usage
import SelectDropdown from 'react-native-select-dropdown'
...
const countries = ["Egypt", "Canada", "Australia", "Ireland"]
...
<SelectDropdown
data={countries}
onSelect={(selectedItem, index) => {
console.log(selectedItem, index)
}}
buttonTextAfterSelection={(selectedItem, index) => {
// text represented after item is selected
// if data array is an array of objects then return selectedItem.property to render after item is selected
return selectedItem
}}
rowTextForSelection={(item, index) => {
// text represented for each item in dropdown
// if data array is an array of objects then return item.property to represent item in dropdown
return item
}}
/>
array of data that will be represented in dropdown 'can be array of objects
Type Required array YesonSelect
callback function recieves selected item and its index in data array
Type Required function YesdefaultButtonText
default button text when no item is selected
Type Required String NobuttonTextAfterSelection
callback function recieves selected item and its index, this function should return a string that will be represented in button after item is selected
Type Required function Yes "unless you customized button using renderCustomizedButtonChild"rowTextForSelection
callback function recieves item and index for each row in dropdown, this function shoud return a string that will be represented in each row in dropdown
Type Required function Yes "unless you customized button using renderCustomizedRowChild"defaultValue
default selected item in dropdown ( check examples in Demo1)
Type Required any NodefaultValueByIndex
default selected item index
Type Required integer Nodisabled
disable dropdown
Type Required boolean NobuttonStyle
style object for button
Type Required object YesbuttonTextStyle
style object for button text
Type Required object NorenderCustomizedButtonChild
callback function recieves selected item and its index, this function should return a React component as a child for dropdown button buttonStyle
should be used for parent button view style.
# check examples folder to make things clear
Type Required function NorenderDropdownIcon
function that should return a React component for dropdown icon
Type Required function NodropdownIconPosition
dropdown icon position "left" || "right"
Type Required string NostatusBarTranslucent
required to set true when statusbar is translucent (android only)
dropdownStyle
style object for dropdown view
Type Required object NorowStyle
style object for row
Type Required object YesrowTextStyle
style object for row text
Type Required object NorenderCustomizedRowChild
callback function recieves item and its index, this function should return React component as a child for customized row rowStyle
should be used for parent row view style.
# check examples folder to make things clear
Type Required function NoMethod Description
reset()
Remove selection & reset it to display defaultButtonText
check https://github.com/AdelRedaa97/react-native-select-dropdown/pull/1#issuecomment-818307624.
openDropdown()
Open the dropdown.
closeDropdown()
Close the dropdown.
GitHub
Recommend
-
58
sharingan-rn-modal-dropdown A simple and customizable react-native dropdown created using react-native-modal and react-native-paper. Features Single, Group, and Multiselect Dropdowns Follows Material Des...
-
38
Country A searchable dropdown component to select a country code with react native ...
-
6
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.
-
11
react-native-element-dropdown A react-native dropdown component easy to customize for both iOS and Android. Getting started npm install react-native-element-dropdown --save ya...
-
10
This tutorial will show you how to use react-select to create an async dropdown. I’m also utilising useState hooks to set and receive selected values, as well as Axios to retrieve data from the rest API. I have already...
-
6
🚩 React Native Easy Alert React Native Easy Alert Component. Watch on youtubeEasy Alert example app. React Native’s G...
-
8
React Native Actions Sheet Picker A React Native component that provides a filterable select dropdown/picker. Preview
-
3
🔛 React Native Custom Toggle Input 🟢 Customizable React Native Toggle Switch with easy to use props”
-
5
How to Create React Select Dropdown 350 views 9 months ago React If you require to visually perceive an example of re...
-
9
🚀 Simple Dropdown List – React Native 🚀 • No dependencies • Customizable
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK