zyslife / react-native-head-tab-view

Add collapsible headers to your tab-view components.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

makeScrollTrans只调用一次

hcy1996 opened this issue · comments

Describe the bug

makeScrollTrans问题:
只初始化时调用了一次,
想问下如何实时获取滚动的高度?

Expected behavior

Package versions

  • React:16.8.6
  • React Native:0.60.5
  • React-Native-Gesture-Handler:1.4.1

用的是react-native-head-tab-view3.0.5的版本

@hcy1996 是只会调一次,会返回给你一个动画对象,你监听这个对象就能获取高度了

@zyslife I'm using latest version which work with reanimated v2
"react-native-head-tab-view": "^4.0.0-rc.13",
"react-native-tab-view-collapsible-header": "^2.0.1",

At makeScrollTrans, the value just able to get once time, it's 0 at initial.

makeScrollTrans?: (scrollValue: Reanimated2.SharedValue<number>) => void;

It's a bug right?
How to get changed value when scrolling the screen? Thanks!

For v3 I can get changed value by listen on the Animated.Value.

@phamhungvn did you figure it out

@phamhungvn did you figure it out

@leorod90 Not yet. I keep use old version v3 instead of upgrading to v4

@phamhungvn @leorod90 You can look at this example.
You can use the useDerivedValue function of Reanimated2.Do what you want by listening for changes in the animation value.