diff --git a/doc/api.md b/doc/api.md
index 11d46e5..d5ac27e 100644
--- a/doc/api.md
+++ b/doc/api.md
@@ -162,6 +162,7 @@ Wrapper component of menu option.
|`value`|`Any`|Optional||Value of option|
|`text`|`String`|Optional||Text to be rendered. When this prop is provided, option's children won't be rendered|
|`disabled`|`Boolean`|Optional|`false`|Indicates if option can be pressed|
+|`disableTouchable`|`Boolean`|Optional|`false`|Disables Touchable wrapper (no on press effect and no onSelect execution)|
|`customStyles`|`Object`|Optional||Object defining wrapper, touchable and text styles|
### Events
diff --git a/src/MenuOption.js b/src/MenuOption.js
index d3954b2..481e912 100644
--- a/src/MenuOption.js
+++ b/src/MenuOption.js
@@ -16,7 +16,7 @@ export default class MenuOption extends Component {
}
render() {
- const { text, disabled, children, style, customStyles } = this.props;
+ const { text, disabled, disableTouchable, children, style, customStyles } = this.props;
if (text && React.Children.count(children) > 0) {
console.warn("MenuOption: Please don't use text property together with explicit children. Children are ignored.");
}
@@ -28,23 +28,32 @@ export default class MenuOption extends Component {
);
}
- const { Touchable, defaultTouchableProps } = makeTouchable(customStyles.OptionTouchableComponent);
- return (
- this._onSelect()}
- {...defaultTouchableProps}
- {...customStyles.optionTouchable}
- >
-
- {text ? {text} : children}
-
-
+ const rendered = (
+
+ {text ? {text} : children}
+
);
+ if (disableTouchable) {
+ return rendered;
+ }
+ else {
+ const { Touchable, defaultTouchableProps } = makeTouchable(customStyles.OptionTouchableComponent);
+ return (
+ this._onSelect()}
+ {...defaultTouchableProps}
+ {...customStyles.optionTouchable}
+ >
+ {rendered}
+
+ );
+ }
}
}
MenuOption.propTypes = {
disabled: PropTypes.bool,
+ disableTouchable: PropTypes.bool,
onSelect: PropTypes.func,
text: PropTypes.string,
value: PropTypes.any,
@@ -53,6 +62,7 @@ MenuOption.propTypes = {
MenuOption.defaultProps = {
disabled: false,
+ disableTouchable: false,
customStyles: {},
};