xuho / react-native-select-two

Component like Select2 on web for React Native
MIT License
82 stars 70 forks source link

Data from remote server #25

Open huicha opened 4 years ago

huicha commented 4 years ago

It's possible to use data from remote server? I am only see examples with mockData and works fine, but if I want to assign data from graphql object the selection it ins't work. I see the attribute checked it isn't setted.

I am wrong ?

k2an commented 2 years ago

I use axios for consuming API. like this;

<Select2

                            isSelectSingle
                            style={{ borderRadius: 5 }}
                            colorTheme="blue"
                            popupTitle="My list"
                            title="TITLE"
                            data={this.state.dataFromServer}
                            onSelect={(data) => {
                                //  console.log(data);
                                this.handleGetId(data)
                            }}
                            onRemoveItem={(data) => {
                                this.setState({ selectedVal: null });
                            }}
                        />