0.0.13 • Published 3 years ago

rn-dropdown-picker v0.0.13

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

Simple dropdown picker for react-native

example

Caution

The package is under development, do not use it for production.

Description

A simple searchable dropdown component for react-native. Components that I used had bugs when I tried to click on an option so I decided to create this component which uses absolute positioning to render the dropdown menu.

Usage

You have to insert <DropdownProvider /> in the top of your component hierarchy (e.g. <App />). Make sure there is no parent view up in the hierarchy so the dropdown can render itself relative to the app window. Specify the <DropdownExit /> component, this will render the dropdown menu. Your App.tsx should look like this:

<DropdownProvider>
  // Other components...
  <DropdownExit />
</DropdownProvider>

Props

NameDescriptionTypeDefaultRequired
optionsThe options for the component.Option[][]No
onOptionClickedThis callback fires when you select an option from the dropdown list(option: Option) => anyNo
placeholderDefault text to be shown to the user when no option is selected.string'Select an option'No
searchableSet this to true to enable searching among options in the dropdown menu.booleanfalseNo
searchablePlaceholderDefault text to be shown in the search input.string'Search for an item'No
onSearchThis callback is called when user types into the search input. You have handle option filtering for yourself if you pass this.(text: string) => anyNo
searchPlaheolderTextColorColor of the placeholder inside the search input.string?No
showIndicatorIconWether it should render indicator icon on the right to show dropdown state or not.booleantrueNo
indicatorIconA render prop to render custom indicator icon on the left.(isOpen: boolean) => JSX.ElementNo
leftIconForSelectedA render prop to render an icon on the left of the selected option.() => JSX.ElementNo
dropdownContainerStyleCustom style for the container view of the dropdown menu.StyleProp<ViewStyle>No
selectedContainerStyleCustom style for the <View /> that renders the selected optionStyleProp<ViewStyle>No
openSelectedContainerStyleAdditional custom style for the <View /> that renders the selected option when the dropdown is open.StyleProp<ViewStyle>No
0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago