123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- const React = require('react');
- const { Component } = require('react');
-
- const { StyleSheet, ScrollView, View, Button } = require('react-native');
-
- const Navigation = require('react-native-navigation');
- const testIDs = require('../testIDs');
-
- class ScrollViewScreen extends Component {
- static get navigationOptions() {
- return {
- topBar: {
- title: 'Collapse',
- textColor: 'black',
- textFontSize: 16,
- drawUnder: true,
- translucent: false
- }
- };
- }
-
- constructor(props) {
- super(props);
- this.state = {
- topBarHideOnScroll: false
- };
- this.onClickToggleTopBarHideOnScroll = this.onClickToggleTopBarHideOnScroll.bind(this);
- }
-
- render() {
- return (
- <View>
- <ScrollView testID={testIDs.SCROLLVIEW_ELEMENT} contentContainerStyle={styles.contentContainer}>
- <View>
- <Button title="Toggle Top Bar Hide On Scroll" testID={testIDs.TOGGLE_TOP_BAR_HIDE_ON_SCROLL} onPress={this.onClickToggleTopBarHideOnScroll} />
- </View>
- </ScrollView>
- </View>
- );
- }
-
- onClickToggleTopBarHideOnScroll() {
- this.setState({
- topBarHideOnScroll: !this.state.topBarHideOnScroll
- });
- }
-
- componentDidUpdate() {
- Navigation.setOptions(this.props.containerId, {
- topBar: {
- drawUnder: true,
- hideOnScroll: this.state.topBarHideOnScroll
- }
- });
- }
- }
-
- module.exports = ScrollViewScreen;
-
- const styles = StyleSheet.create({
- contentContainer: {
- alignItems: 'center',
- backgroundColor: 'green',
- paddingTop: 200,
- height: 1200
- }
- });
-
|