-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Leslie edited this page May 27, 2025
·
6 revisions
All example code is written in TypeScript.
Import the Selector component and Data type.
import Selector, { Data } from 'react-native-dropdown-selector';Define your Data array. The label field is required for each entry, but priority and data are optional.
const data: Data[] = [
{ label: 'Item 1' },
{ label: 'Item 2', data: { additionalParam: 'value' } },
{ label: 'Item 3', priority: true },
];Create a function that will be called every time an item gets selected. The parameter data is the item that was selected.
const onDataSelect = (data: Data) => {
// Do something
};Add a Selector component to your view using the previously created array and function.
<>
<Selector.Select data={data} onSelect={onDataSelect} />
{/* or use the MultiSelect component */}
<Selector.MultiSelect data={data} onSelect={onMultiDataSelect} />
</>That's it! Run your app to see the selector in action.