sohobloo / react-native-modal-dropdown

A react-native dropdown/picker/selector component for both Android & iOS.
MIT License
1.19k stars 478 forks source link

Fix displaying defaultValue and defaultIndex when data was async provided #194

Closed helenmak closed 5 years ago

helenmak commented 6 years ago

@sohobloo This PR will resolves issues like #181. As you wrote, "If the displayed value is one of the options of the dropdown, you can call select(idx) of your dropdown reference. If not, you have to give a defaultValue and select(-1)".

After this changes, there will be no need to do things like manually call select(id) in order to set a default Value to dropdown.

fungilation commented 5 years ago

I've tested this, but unfortunately issue like #181 remain. I update props to my render() inside which is a <ModalDropdown> component, props which are passed to defaultValue and defaultIndex. Even though I see the props update, the rendered <ModalDropdown> doesn't change.

I also tried updating what's selected by something like this.refs.SearchTypeDropdown.select(dropdownIndex), it won't update what's rendered either, even though I see internal state of ModalDropdown is changed.

helenmak commented 5 years ago

@fungilation I have just checked it again, and it works as expected. Can you provide an example of your code?

vonwao commented 5 years ago

I'm still having this issue. Workarounds?

Subway19 commented 4 years ago

This is still an issue. Component doesn't update on change of props, no ComponentDidUpdate in source code. Please re-check

+1 @fungilation