-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I'm trying to implement an autocomplete, preferably using the ModalDropdown, although FlatDropdown may also be acceptable if it makes a difference. This is wrapped in react-hook-form for control/validation, but I don't think that's the problem.
In the code below...
listValues is an array of objects with value/label attributes as per the examples.
Everything works ok, except:
- If I set the (initial) value to something (one of the "value" strings in the listValues object), then the item DOES seem to be pre-selected in the resulting dropdown, however the TextInput (in which the autocomplete occurs does NOT show the relevant label, and is instead blank.
- Furthermore, when the modal is opened (with the pre-selected option), there is no way to "confirm" the option and get the label to show in the TextInput. I am forced to pick another one, and then go back in again and select the first.
How can I get the relevant label to show in the TextInput when the value has been preset?
<Autocomplete
label={label}
value={value}
onBlur={onBlur} //part of react-hook-form management
onChange={onChange} //part of react-hook-form management
style={styles.input}
error={hasError} //part of react-hook-form management
options={listValues}
right={undefined} //just to kill the right icon
/>
Goostavo
Metadata
Metadata
Assignees
Labels
No labels