This is happening in the SINGLE case. #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is happening in the SINGLE case. This bug after these operations are OnClick and Onleave, it clears the text automatically. This solved. At the same time,
( https://www.npmjs.com/package/react-native-searchable-dropdown )
You have to change on documentation for single .
The onItemSelect event need to change. This was 'single'.
The user can write directly.
To catch this need to change the OnTextChange event.
I hope I can help you
<SearchableDropdown
onItemSelect={(item) => {
let items = this.state.selectedItems;
items[0].id = item.id
items[0].name = item.name
this.setState({ selectedItems: items });
}}
containerStyle={{ padding: 5 }}
onRemoveItem={(item, index) => {
const items = this.state.selectedItems.filter((sitem) => sitem.id !== item.id);
this.setState({ selectedItems: items });
}}
itemStyle={{
padding: 10,
marginTop: 2,
backgroundColor: '#ddd',
borderColor: '#bbb',
borderWidth: 1,
borderRadius: 5,
}}
itemTextStyle={{ color: '#222' }}
itemsContainerStyle={{ maxHeight: 140 }}
items={items}
resetValue={false}
textInputProps={
{
placeholder: "placeholder",
underlineColorAndroid: "transparent",
style: {
padding: 12,
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 5,
},
onTextChange: text => {
var item = this.state.selectedItems
item[0].name = text
this.setState({ selectedItems: item })
}
}
}
listProps={
{
nestedScrollEnabled: true,
}
}
/>