its a simple question, i just dont find the method that can handle this.
i declare use ref variable like so:
const massageTypeRef = useRef();
Now I have Text component at the top of the page:
<Text ref={massageTypeRef} style={styles.massagetitle}> Choose type: </Text>
3.and i have another button in the bottom , i want when the button clicked, take the user all the way up to the Text component. in my bottom button i have:
<AnimatedButton
onPress={() => console.log(massageTypeRef.current}/// here i dont know what i need to
pass
icon="arrow-up"
buttonStyle={styles.problembutton}
textStyle={styles.problembuttontext}
/>
i tried:
onPress={() =>
massageTypeRef.current.scrollIntoView({
behavior: "smooth",
})
and:
onPress={() =>
massageTypeRef.current.scrollTo()
})
but i always get: TypeError: massageTypeRef.current.scrollIntoView is not a function. (In 'massageTypeRef.current.scrollIntoView()', 'massageTypeRef.current.scrollIntoView' is undefined)