import React from 'react';
import { View } from 'react-native';

const MenuOptions = ({ style, children, onSelect, customStyles }) => (
  <View style={[customStyles.optionsWrapper, style]}>
    {
      React.Children.map(children, c =>
        React.isValidElement(c) ?
          React.cloneElement(c, {
            onSelect: c.props.onSelect || onSelect,
            customStyles: Object.keys(c.props.customStyles || {}).length ? c.props.customStyles : customStyles
          }) : c
      )
    }
  </View>
);

MenuOptions.propTypes = {
  onSelect: React.PropTypes.func,
  customStyles: React.PropTypes.object,
  renderOptionsContainer: React.PropTypes.func,
  optionsContainerStyle: React.PropTypes.oneOfType([
    React.PropTypes.object,
    React.PropTypes.number,
  ]),
};

MenuOptions.defaultProps = {
  customStyles: {},
};

export default MenuOptions;

import React, { PropTypes } from 'react';
import { View } from 'react-native';

const MenuOptions = ({ style, children, onSelect, customStyles }) => (
  <View style={[customStyles.optionsWrapper, style]}>
    {
      React.Children.map(children, c =>
        React.isValidElement(c) ?
          React.cloneElement(c, {
            onSelect: c.props.onSelect || onSelect,
            customStyles: Object.keys(c.props.customStyles || {}).length ? c.props.customStyles : customStyles
          }) : c
      )
    }
  </View>
);

MenuOptions.propTypes = {
  onSelect: PropTypes.func,
  customStyles: PropTypes.object,
  renderOptionsContainer: PropTypes.func,
  optionsContainerStyle: PropTypes.oneOfType([
    PropTypes.object,
    PropTypes.number,
    PropTypes.array,
  ]),
};

MenuOptions.defaultProps = {
  customStyles: {},
};

export default MenuOptions;

Allow also array as style prop type