React-native-Dropdown-Picker para o formulário React Native
import React, { useState } from 'react';
import SelectPicker from 'react-native-form-select-picker'; // Import the package
//...
const options = ["Apple", "Banana", "Orange"];
const YourComponent = ({ /* your props */ }) => {
const [selected, setSelected] = useState();
return (
//...
<SelectPicker
onValueChange={(value) => {
// Do anything you want with the value.
// For example, save in state.
setSelected(value);
}}
selected={selected}
>
{Object.values(options).map((val, index) => (
<SelectPicker.Item label={val} value={val} key={index} />
))}
</SelectPicker>
//...
)
}
Vivacious Vole