import React, { useContext, useMemo } from 'react';
import clsx from 'clsx';
import ActionBarContext from './ActionBarContext';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';

var ActionBar = function ActionBar(props) {
  var _useContext = useContext(ConfigProviderContext),
      prefixCls = _useContext.prefixCls,
      createNamespace = _useContext.createNamespace;

  var _createNamespace = createNamespace('action-bar', prefixCls),
      bem = _createNamespace[0];

  var children = useMemo(function () {
    return React.Children.toArray(props.children);
  }, [props.children]);
  return /*#__PURE__*/React.createElement(ActionBarContext.Provider, {
    value: {
      parent: {
        children: children
      }
    }
  }, /*#__PURE__*/React.createElement("div", {
    className: clsx(props.className, bem(), {
      'rv-safe-area-bottom': props.safeAreaInsetBottom
    }),
    style: props.style
  }, React.Children.toArray(props.children).filter(Boolean).map(function (child, index) {
    return /*#__PURE__*/React.cloneElement(child, {
      index: index
    });
  })));
};

ActionBar.defaultProps = {
  safeAreaInsetBottom: true
};
export default ActionBar;