New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-select-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22K
decreased by-40.19%
Maintainers
1
Weekly downloads
 
Created
Source

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

Demo

Code provided in Examples folder.

Screenshot1.gif Screenshot2.gif

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
	}}
/>

Props

Methods


data

array of data that will be represented in dropdown 'can be array of objects

TypeRequired
arrayYes

onSelect

function recieves selected item and its index in data array

TypeRequired
functionYes

defaultButtonText

default button text when no item is selected

TypeRequired
StringNo

buttonTextAfterSelection

function recieves selected item and its index, this function should return a string that will be represented in button after item is selected

TypeRequired
functionYes "unless you customized button using renderCustomizedButtonChild"

rowTextForSelection

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

TypeRequired
functionYes "unless you customized button using renderCustomizedRowChild"

defaultValue

default selected item in dropdown ( check examples in Demo1)

TypeRequired
anyNo

defaultValueByIndex

default selected item index

TypeRequired
integerNo

disabled

disable dropdown

TypeRequired
booleanNo

buttonStyle

style object for button

TypeRequired
objectYes

buttonTextStyle

style object for button text

TypeRequired
objectNo

renderCustomizedButtonChild

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
TypeRequired
functionNo

renderDropdownIcon

function that should return a React component for dropdown icon

TypeRequired
functionNo

dropdownIconPosition

dropdown icon position "left" || "right"

TypeRequired
stringNo

statusBarTranslucent

required to set true when statusbar is translucent (android only)

TypeRequired
booleanNo

dropdownStyle

style object for dropdown view

TypeRequired
objectNo

rowStyle

style object for row

TypeRequired
objectYes

rowTextStyle

style object for row text

TypeRequired
objectNo

renderCustomizedRowChild

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
TypeRequired
functionNo

MethodDescription
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.

License

MIT

Keywords

FAQs

Package last updated on 09 Oct 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc