How can I reset the ScrollView to the top of it each time I navigate to the screen where said ScrollView is located? (I'm using react-navigation v4).
I've seen a post where the solution implies the use of:
import { useIsFocused } from "@react-navigation/native";
and then use a hook:
const isFocused = useIsFocused();
useEffect(() => {
if (isFocused) {
scrollViewRef.current?.scrollTo(0, 0, true);
}
}, [isFocused]);
However, since I'm using v4, that option is not available for my project. What can I do?