const handleNext = () => { const nextIndex = currentIndex + 1; if (nextIndex < pagesData.length) { // Only proceed to the next slide if it exists // You can update currentIndex or perform any other action setCurrentIndex(nextIndex); // Scroll to the next index flatListRef.current.scrollToIndex({ index: nextIndex, animated: true }); } else { // Handle reaching the end of the onboarding slides // You can navigate to the next screen or perform any other action } };