From dd30a4d69f8d7c7fe6003ce3f0c8ca095332f977 Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Wed, 2 Nov 2016 16:21:52 -0400 Subject: [PATCH 1/4] Ignore .idea directory from IntelliJ --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5f43176..4fb0a07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .exponent lib/ +.idea From 4cc76ec1973ae5fe60512560b5fb3540bf4b8d8e Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Wed, 2 Nov 2016 16:35:27 -0400 Subject: [PATCH 2/4] Accept a `disabled` prop for DrawerItems --- src/drawer/ExNavigationDrawerLayout.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/drawer/ExNavigationDrawerLayout.js b/src/drawer/ExNavigationDrawerLayout.js index b38d4b7..09b305a 100644 --- a/src/drawer/ExNavigationDrawerLayout.js +++ b/src/drawer/ExNavigationDrawerLayout.js @@ -76,13 +76,13 @@ export default class ExNavigationDrawerLayout extends React.Component { } return this.props.items.map((item, index) => { - let { renderIcon, renderTitle, renderRight } = item; + let { renderIcon, renderTitle, renderRight, disabled } = item; let isSelected = this.props.selectedItem === item.id; - const icon = renderIcon && renderIcon(isSelected); - const title = renderTitle && renderTitle(isSelected); - const rightElement = renderRight && renderRight(isSelected); + const icon = renderIcon && renderIcon(isSelected, disabled); + const title = renderTitle && renderTitle(isSelected, disabled); + const rightElement = renderRight && renderRight(isSelected, disabled); - if (item.showsTouches !== false) { + if (item.showsTouches !== false && !disabled) { return ( { this._handlePress(item); }} onLongPress={() => { this._handleLongPress(item); }}> From 2ce06c555a158b0d7934a94ff16dc473e128bde2 Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Wed, 2 Nov 2016 16:42:22 -0400 Subject: [PATCH 3/4] Add DrawerLayout link to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 52bfecb..bbec2fb 100644 --- a/README.md +++ b/README.md @@ -555,6 +555,8 @@ const styles = StyleSheet.create({ }); ``` +See [ExNavigationDrawerLayout](https://github.com/exponentjs/ex-navigation/blob/master/src/drawer/ExNavigationDrawerLayout.js) +to discover which props you can pass to `DrawerNavigationItem`. ### Integrate with your existing Redux store From 64da1191dce848aaef44fc1819853297aa80b4f4 Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Wed, 2 Nov 2016 16:45:06 -0400 Subject: [PATCH 4/4] Accept a `handlesDrawerToggle` prop for DrawerItems For items that will handle closing the drawer (or not) themselves after being pressed. --- src/drawer/ExNavigationDrawerLayout.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/drawer/ExNavigationDrawerLayout.js b/src/drawer/ExNavigationDrawerLayout.js index 09b305a..8b63343 100644 --- a/src/drawer/ExNavigationDrawerLayout.js +++ b/src/drawer/ExNavigationDrawerLayout.js @@ -133,7 +133,10 @@ export default class ExNavigationDrawerLayout extends React.Component { // _handlePress = (item: any) => { item.onPress(); - this._component.closeDrawer(); + + if (!item.handlesDrawerToggle) { + this._component.closeDrawer(); + } } _handleLongPress = (item: any) => { @@ -142,7 +145,10 @@ export default class ExNavigationDrawerLayout extends React.Component { } item.onLongPress(); - this._component.closeDrawer(); + + if (!item.handlesDrawerToggle) { + this._component.closeDrawer(); + } } }