Closed siskut closed 5 years ago
@siskut You have fixed array of items in your state, you should not use fetchDataUrl
, just pass data={this.state.items}
as described here
i've tried that. But a new warning says 'TypeError:undefined is not an object (evaluating 'valueExtractor(item).toLowerCase')'
Yey! It's fixed. The solution is {this.state.items} into a variabel. Thankyou!
Hi,
I am using your package and so happy it's working. But when i changed the value of fetchDataUrl, like this:
<Autocomplete style={styles.input} scrollToInput={ev => {}} handleSelectItem={(item, id) => this.handleSelectItem(item, id)} onDropdownClose={() => {}} onDropdownShow={() => {}} fetchDataUrl={this.state.people} minimumCharactersCount={1} highlightText valueExtractor={item => item.name} rightContent rightTextExtractor={item => item.id} /> the warning show
this is the function to get people from my api async function getPeopleFromServer(){ try{ let response = await fetch('http://localhost:3000/people/all'); let responseJson = response.json(); return responseJson; } catch(error){ console.log('Error is: ', error); } }
my state people contains like below
[ { id: '123a', name: 'James' }, { id: 456'b', name: 'George' }, { id: '789c', name: 'Edward' }, { id: '00d', name: 'Jhon' } ]
Do you know what happen? I am so pleasure for your help.