I'm trying to hide the navbar (NavigatorIOS) when scrolling down. How can I achieve that ?
Thanks
Thanks to @Vincent I managed to make similar, simple code to AMScrollingnavbar in react native .. (P.S: it has a glitch but I'm satisfied with overall result)
import React, { Component } from 'react';
import { Text, View, ScrollView, Animated } from 'react-native';
import NavigationBar from 'react-native-navbar';
const AnimatedNavigationBar = Animated.createAnimatedComponent(NavigationBar);
export default class BasicListView extends Component {
state = { isNavBarHidden: false, height: new Animated.Value(64) };
setAnimation(disable) {
Animated.timing(this.state.height, {
duration: 100,
toValue: disable ? 0 : 64
}).start()
};
handleScroll(event) {
this.setAnimation((event.nativeEvent.contentOffset.y > 64));
this.setState({ isNavBarHidden: !this.state.isNavBarHidden });
}
render() {
return (
<View style={{ flex: 1 }} >
<AnimatedNavigationBar style={{ backgroundColor: 'red', height: this.state.height }} />
<ScrollView scrollEventThrottle={16} onScroll={this.handleScroll.bind(this)}>
<View style={{ height: 200 }}><Text>Test</Text></View>
<View style={{ height: 200 }}><Text>Test</Text></View>
<View style={{ height: 200 }}><Text>Test</Text></View>
<View style={{ height: 200 }}><Text>Test</Text></View>
<View style={{ height: 200 }}><Text>Test</Text></View>
</ScrollView>
</View>
);
}
}