Scroll 滚动时反应本机隐藏导航栏

Scroll 滚动时反应本机隐藏导航栏,scroll,react-native,navbar,Scroll,React Native,Navbar,我正在使用react native navigation flux navigation library, 我试图实现当向下滚动时导航栏将消失。 有可能做到这一点吗 感谢您尝试使用动画,并在向上滚动时将导航栏高度设置为零,在向下滚动时将默认高度设置为零 class MyAwesomeComponent extends Component { constructor(props) { super(props); this.height = new Animated.V

我正在使用react native navigation flux navigation library, 我试图实现当向下滚动时导航栏将消失。 有可能做到这一点吗


感谢您尝试使用动画,并在向上滚动时将导航栏高度设置为零,在向下滚动时将默认高度设置为零

 class MyAwesomeComponent extends Component {

   constructor(props) {
     super(props);
     this.height = new Animated.Value(100);
   }

   _setAnimation(enable) {
     Animated.timing(this.height, {
       duration: 400,
       toValue: enable? 100 : 0
     }).start()
   } 

   render() {
     return (
       <Animated.View style={{ height: this.height }}/>
     );
  }

}
类MyAwesomeComponent扩展组件{
建造师(道具){
超级(道具);
this.height=新的动画.Value(100);
}
_设置动画(启用){
动画。计时(此高度{
持续时间:400,
toValue:启用?100:0
}).start()
} 
render(){
返回(
);
}
}

欢迎来到StackOverflow!请提供您的尝试的详细信息,以便我们能够尝试解决您的问题,并解释您自己的尝试失败的原因-这样您就可以学到一些对您未来发展有用的东西,并获得这个问题的答案。