# Migrate from react-native-dropdown-picker

> Switch from react-native-dropdown-picker to Patine UI: Select with no open state to manage, search, multi-select chips, groups and server search, as a dropdown or a bottom sheet.

# Migrate from `react-native-dropdown-picker`

`Select` keeps its own open state, so `open`, `setOpen` and `setItems` go away, and `onValueChange` gets the new value rather than an updater. It opens as a dropdown on the web and a bottom sheet on phones, where a dropdown is cramped; set `presentation="dropdown"` to keep the dropdown everywhere.

```diff
- import DropDownPicker from 'react-native-dropdown-picker';
+ import { Select } from 'patine-ui';

- const [open, setOpen] = useState(false);
  const [value, setValue] = useState(null);
- const [items, setItems] = useState([
-   { label: 'Apple', value: 'apple' },
-   { label: 'Banana', value: 'banana' },
- ]);
-
- <DropDownPicker open={open} value={value} items={items} setOpen={setOpen} setValue={setValue} setItems={setItems} />
+ <Select
+   options={[{ label: 'Apple', value: 'apple' }, { label: 'Banana', value: 'banana' }]}
+   value={value}
+   onValueChange={setValue}
+ />
```

| react-native-dropdown-picker | Patine UI |
| --- | --- |
| `items` + `setItems` | `options` (adds `description`, `icon`, `group`, `keywords`) |
| `value` + `setValue` | `value` + `onValueChange(value, option)` |
| `open` + `setOpen` | not needed; or keep them as `open` + `onOpenChange` |
| `onChangeValue` | `onValueChange` |
| `multiple` | `multiple` (selected items show as removable chips) |
| `min` / `max` | `maxSelected`; check a minimum in your form |
| `searchable` | `searchable` (on by default past 8 options) |
| `searchPlaceholder` | `searchPlaceholder` |
| `onChangeSearchText` + `disableLocalSearch` + `loading` | `onSearchChange` + `loading`, or `loadOptions(query)` that returns a promise |
| `placeholder` | `placeholder` |
| `disabled` | `disabled` |
| `listMode="MODAL"` | `presentation="modal"` |
| `listMode="FLATLIST"` / `"SCROLLVIEW"` | `presentation="dropdown"` |
| `renderListItem` | `renderOption({ option, selected, disabled, theme })` |
| `addCustomItem` | `onCreate(text)`: add the option to `options` and return it to select it ([create new options](../../components/select#create-new-options)) |

See [Select](../../components/select) for groups, icons and render props, and [server search](/examples/server-search).

See [all migration guides](./index.mdx) for other libraries, and [Comparison](../comparison.mdx) for when another library is the better choice.
