SwipeNav
SwipeNav shows and hides headers and footer on scroll
import { SwipeNav } from 'material-bread';
Component #
SwipeNav
wraps your content with a ScrollView
and hides the header or footer. The header hides on scroll down and shows on scroll up while the footer hides on scroll up and shows on scroll down. You can also pass in a custom scroll componnt like a FlatList
for more control.Live Editing
class Demo extends React.Component { constructor(props) { super(props) } render() { return ( <View style={{ height: '100%', maxWidth: 500, overflowY: 'hidden' }}> <SwipeNav header={ <Appbar barType={'normal'} color={'#009688'} navigation={'menu'} title={'News'} actionItems={[{ name: 'more-vert' }]} /> } scrollViewStyle={{ height: 500 }}> <BodyContent /> </SwipeNav> </View> ); } }
Usage #
import React from 'react';
import { View, Text } from 'react-native';
import { SwipeNav, Appbar, Button } from 'material-bread';
class Demo extends React.Component {
constructor(props) {
super(props)
}
render() {
return (
<View>
<SwipeNav
header={
<Appbar
barType={'normal'}
color={'#009688'}
navigation={'menu'}
title={'News'}
actionItems={[{ name: 'more-vert' }]}
/>
}>
<View>
<Text>Content</Text>
</View>
</SwipeNav>
</View>
);
}
}
Props #
Name
Description
Type
Default
header
Header component that renders above the content
node
headerContainerStyle
Styles container around header
object
footer
Footer component that renders below the content
node
footerContainerStyle
Styles container around footer
object
scrollComponent
Custom scroll component
node
scrollViewProps
Props spread onto the scrollview
object
scrollViewStyle
Styles scrollview
object
style
Styles root element
object
Demos #
You can see even more examples in the Storybook environment.