react-native-swiper
react-native-swiper copied to clipboard
Can not update call state in onIndexChanged callback
Hello I got an error when I updated my State on the callback of my function onIndexChanged. "Warning: Cannot update a component from inside the function body of a different component."
while they fix the problem, that work for me:
const updateIndex = useCallback((res) => { setTimeout(() => { setCurrentIndex(res); }, 50); }, []);
wrap the state update inside a timeout :S
Hello. Any other alternatives how to get current index while we wait for the fix?
Any updates?
same issue. any other solution?
Any update on this? I'm also getting this warning.
... still ?
Nothing? 😢