zyslife / react-native-head-tab-view

Add collapsible headers to your tab-view components.
434 stars 81 forks source link

makeScrollTrans只调用一次 #125

Open hcy1996 opened 2 years ago

hcy1996 commented 2 years ago

Describe the bug

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

Expected behavior

Package versions

hcy1996 commented 2 years ago

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

zyslife commented 2 years ago

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

phamhungvn commented 2 years ago

@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.

leorod90 commented 2 years ago

@phamhungvn did you figure it out

phamhungvn commented 2 years ago

@phamhungvn did you figure it out

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

zyslife commented 2 years ago

@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.