Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lib/
.idea
node_modules/
npm-debug.log

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions src/menu/makeMenuOptions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const isClonable = (element) => !!element;

module.exports = (React, ReactNative, { styles }) => {
const { TouchableWithoutFeedback, View } = ReactNative;

Expand All @@ -10,9 +12,13 @@ module.exports = (React, ReactNative, { styles }) => {
return (
<TouchableWithoutFeedback style={[styles.options, this.props.style]}>
<View>
{ 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;
})}
</View>
</TouchableWithoutFeedback>
);
Expand Down