My App has
return(
<ScrollView style={{ backgroundColor: "#262423", flex: 1 }} scrollsToTop={true}>
...my ScrollView
</ScrollView>
)
but when I tap on the Status Bar of my iOS device, the ScrollView doesn't scroll to the top.
Try Like this
import { useRef } from 'react';
const scrollRef = useRef();
const onPressTouch = () => {
scrollRef.current?.scrollTo({
y: 0,
animated: true,
});
}
<ScrollView ref={scrollRef}>
...your elements
</ScrollView>
<TouchableOpacity onPress={onPressTouch}></TouchableOpacity>