From 6861a152418eec8de18255949b2b302883a73be6 Mon Sep 17 00:00:00 2001 From: Benkhebbab Anthony Date: Mon, 19 Dec 2016 11:25:31 +0100 Subject: [PATCH 1/2] Allow to render falsy childs in MenuOptions Updated .gitignore for JetBrains IDE's --- .gitignore | 1 + src/menu/makeMenuOptions.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 64b4cb1..de24f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ lib/ +.idea node_modules/ npm-debug.log diff --git a/src/menu/makeMenuOptions.js b/src/menu/makeMenuOptions.js index 520602a..d7023d5 100644 --- a/src/menu/makeMenuOptions.js +++ b/src/menu/makeMenuOptions.js @@ -1,3 +1,5 @@ +const isClonable = (element) => !!element; + module.exports = (React, ReactNative, { styles }) => { const { TouchableWithoutFeedback, View } = ReactNative; @@ -10,9 +12,13 @@ module.exports = (React, ReactNative, { styles }) => { return ( - { React.Children.map(this.props.children, (x) => ( - React.cloneElement(x, {onPress: this.onSelect}) - )) } + { React.Children.map(this.props.children, (x) => { + // If the children is a falsy value (for IIFE in the render method for example) + // It should just ignore it instead of throwing an exception. + return isClonable(x) + ? React.cloneElement(x, {onPress: this.onSelect}) + : false; + })} ); From af86e456ff9cb851963dd13592d9a7bc783469cd Mon Sep 17 00:00:00 2001 From: Benkhebbab Anthony Date: Mon, 19 Dec 2016 11:26:39 +0100 Subject: [PATCH 2/2] Updated the command to make integration tests --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b648edb..187edd6 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ npm run test:unit Make sure you have a connected android device. You find list devices using `adb devices`. ``` -npm run test:integration +npm run test:feature:suite ``` ## Contributing