its a simple question, i just dont understand why i get "is not a function of a lot of ref functions.
i declare use ref variable like so:
const massageTypeRef = useRef();Now I have Text component at the top of the page: Choose type: 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={() => massageTypeRef.current.scrollIntoView()}/// here i dont know why i get is not a function pass icon="arrow-up" buttonStyle={styles.problembutton} textStyle={styles.problembuttontext} />
i tried a lot of methods like:
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)
i build a snack in expo to show what i want to do, for some reason there is work perfect, and when i do the same thing in my projects it give me message "is not a function...." heres the snack https://snack.expo.io/OYWlNQwP4
here link to my github component and project: https://github.com/roeigr7/LIOR/blob/main/src/screens/MeetingPickerScreen.js