Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

added renderFooter in DrawerNavigation #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/drawer/ExNavigationDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Props = {
navigatorUID: string,
initialItem: string,
renderHeader: () => React.Element<any>,
renderFooter: () => React.Element<any>,
renderNavigationView: () => React.Element<any>,
drawerBackgroundColor: string,
drawerWidth: 300,
Expand Down Expand Up @@ -97,6 +98,9 @@ class ExNavigationDrawer extends PureComponent<any, Props, State> {
renderHeader() {
return null;
},
renderFooter() {
return null;
},
};

static contextTypes = {
Expand Down Expand Up @@ -141,6 +145,7 @@ class ExNavigationDrawer extends PureComponent<any, Props, State> {
const drawerLayoutProps = {
children: this.renderContent(),
renderHeader: this.props.renderHeader,
renderFooter: this.props.renderFooter,
selectedItem: navigationState.routes[navigationState.index].key,
items: this.state.drawerItems,
drawerBackgroundColor: this.props.drawerBackgroundColor,
Expand Down
5 changes: 5 additions & 0 deletions src/drawer/ExNavigationDrawerLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import TouchableNativeFeedbackSafe from '@exponent/react-native-touchable-native

type Props = {
renderHeader: () => React.Element<any>,
renderFooter: () => React.Element<any>,
width: number,
children: React.Element<any>,
drawerBackgroundColor: string,
Expand Down Expand Up @@ -68,6 +69,10 @@ export default class ExNavigationDrawerLayout extends React.Component {
<ScrollView contentContainerStyle={styles.navigationViewScrollableContentContainer}>
{this._renderDrawerItems()}
</ScrollView>

<View>
{this.props.renderFooter()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if this can/should be inside the scrollview

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my case footer was supposed to be fixed at the bottom of the drawer. Besides I think that if you want to add something to the scrollview maybe you should use a proposed DrawerNavigationChild in #251, am I right?

</View>
</View>
);
}
Expand Down