Closed shamar-morrison closed 1 year ago
Please let me know your package version
"react-native-dropdown-select-list": "^2.0.2"
I'm seeing this behaviour also.
"react-native-dropdown-select-list": "^2.0.4"
In this section:
React.useEffect(() => {
if(!_firstRender && defaultOption && oldOption.current != defaultOption.key ){
// oldOption.current != null
oldOption.current = defaultOption.key
setSelected(defaultOption.key);
setSelectedVal(defaultOption.value);
}
if(defaultOption && _firstRender && defaultOption.key != undefined){
oldOption.current = defaultOption.key
setSelected(defaultOption.key);
setSelectedVal(defaultOption.value);
}
},[defaultOption])
I think you should remove the call to setSelected. They are not respecting the save
property either.
thank RadAd this fixed the issue
Has been fixed in new version, please wait for update
Hello there,
When this component is initially mounted the
setSelected
function is executed. Is this how it is supposed to behave?I believe the
setSelected
function should only execute whenever the user selects a new option from the dropdown since this function is currently the only way to get the selected value. Having it run on mount leads to some nasty bugs.Thank you!