"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ShareAction = ShareAction;
var _reactNative = require("react-native");
var _bottomSheetSlice = require("../../../core/stores/slices/bottomSheetSlice");
var _hooks = require("../../hooks");
var _enums = require("../../enums");
var _MenuAction = _interopRequireDefault(require("../MenuAction/MenuAction"));
var _icons = require("../../../core/assets/icons");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function ShareAction({
  link,
  pageId,
  componentId = _enums.ComponentID.WildCardComponent,
  onPress,
  dark
}) {
  const {
    closeBottomSheet
  } = (0, _bottomSheetSlice.useBottomSheet)();
  const {
    config,
    isExcluded
  } = (0, _hooks.useAmityElement)({
    pageId,
    componentId,
    elementId: _enums.ElementID.share_link
  });
  if (isExcluded) return null;
  return /*#__PURE__*/React.createElement(_MenuAction.default, {
    gap: "small",
    dark: dark,
    iconProps: {
      xml: (0, _icons.share)()
    },
    label: (config === null || config === void 0 ? void 0 : config.text) ?? 'Share to',
    onPress: () => {
      onPress ? onPress() : closeBottomSheet();
      _reactNative.Share.share({
        message: link
      });
    }
  });
}
//# sourceMappingURL=ShareAction.js.map