Closed lucyanddarlin closed 3 months ago
I found the solution:
In useSelectDropdown.js
, data should be used as a dependency of useEffect:
// default value by index added or changed
useEffect(() => {
// defaultValueByIndex may be equals zero
if (isExist(defaultValueByIndex)) {
if (data && isExist(data[defaultValueByIndex])) {
selectItem(defaultValueByIndex);
}
}
}, [JSON.stringify(defaultValueByIndex), data]); // data should be used as a dependency of useEffect
// default value added or changed
useEffect(() => {
// defaultValue may be equals zero
if (isExist(defaultValue)) {
if (data && findIndexInArr(defaultValue, data) >= 0) {
selectItem(findIndexInArr(defaultValue, data));
}
}
}, [JSON.stringify(defaultValue), data]); // data should be used as a dependency of useEffect
A lot of changes were made in v4.0, take a look here https://github.com/AdelRedaa97/react-native-select-dropdown?tab=readme-ov-file#-major-changes
Feel free to open the issue again if it still exists
The item in renderCustomizedButtonChild is always null when fetching data
Here is the link: https://snack.expo.dev/FcADoBbVx