Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is happening in the SINGLE case. #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sari1fatih
Copy link

@sari1fatih sari1fatih commented May 13, 2021

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,
}
}
/>

After these operations are OnClick and Onleave, it clears the text automatically. This solved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant