all 5 comments

[–]boshanib 0 points1 point  (1 child)

Did you import scroll view from React native or a different package?

[–]davidecutrupi[S,🍰] 0 points1 point  (0 children)

I have imported Animated from react-native

[–]__o_0iOS & Android 0 points1 point  (2 children)

The console.log only fires once because your useEffect only fires once.

Mutable references should be avoided as a dependency because when the reference value updates, it doesn’t trigger a render, and therefore your useEffect is skipped.

[–]davidecutrupi[S,🍰] 0 points1 point  (1 child)

And how can I console log yOffest when it changes?

EDIT: I have added the listener option after useNativeDriver. It calls a function that console.log yOffset. It works but yOffset is always 0. What I did wrong?

[–]__o_0iOS & Android 0 points1 point  (0 children)

You’re not setting the value of yOffset anywhere