我有一个动画视图,并且当backgroundColor更改时我想设置状态。
Below is the code for my Animated.View
.
headerBg = this.scroll.interpolate({
inputRange: [0, SCROLL_HEIGHT, SCROLL_HEIGHT],
outputRange: ["black", 'white'],
extrapolate: "clamp"
});
<Animated.View style={{position: "absolute", width: "100%", backgroundColor: this.headerBg}}>
</Animated.View>
My Animated.View
's background color changes as I scroll the view.
The moment my Animated.View
's background color changes, I want to setState. Is this possible?
我不想每次滚动时都获得y值,因为它会使动画非常缓慢。
任何建议或评论将非常有帮助。
提前致谢! :)