Open eddietex opened 6 years ago
I'm still having this issue. Workarounds?
You can add the following to ModalDropdown
componentDidUpdate(prevProps, prevState) {
if (this.props.defaultValue !== prevProps.defaultValue) {
this.setState({buttonText: this.props.defaultValue})
}
}
This is still an issue. Component doesn't update on change of props, no ComponentDidUpdate in source code. Please re-check
I'm setting the defaultValue and defaultIndex props like this:
and the initial states like so:
And at some point, when some data is feetched, the states are updated. When this happens, defaultIndex is updated properly according to the component's state, but for some reason the defaultValue doesn't change when the component gets re-rendered, only when onSelect is triggered.
If you see the image below, the orange color is the style of a selected item, and even though the defaultIndex was updated, the defaultValue is still the same as it was when it was first rendered.