"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _enums = require("../../../enums");
var _BehaviourProvider = require("../../../providers/BehaviourProvider");
var _native = require("@react-navigation/native");
var _TargetSelectionPage = _interopRequireDefault(require("../../../components/TargetSelectionPage/TargetSelectionPage"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const AmityPollTargetSelectionPage = () => {
  const {
    AmityPollTargetSelectionPageBehavior
  } = (0, _BehaviourProvider.useBehaviour)();
  const navigation = (0, _native.useNavigation)();
  const onSelectFeed = ({
    targetId,
    targetType,
    targetName,
    community
  }) => {
    const context = {
      pop: 2,
      targetId,
      targetType,
      community,
      targetName
    };
    if (AmityPollTargetSelectionPageBehavior.goToPollPostComposerPage) {
      return AmityPollTargetSelectionPageBehavior.goToPollPostComposerPage(context);
    }
    navigation.navigate('PollPostComposer', context);
  };
  const onClickClose = () => {
    if (AmityPollTargetSelectionPageBehavior !== null && AmityPollTargetSelectionPageBehavior !== void 0 && AmityPollTargetSelectionPageBehavior.onClickClose) {
      AmityPollTargetSelectionPageBehavior.onClickClose();
    }
  };
  return /*#__PURE__*/_react.default.createElement(_TargetSelectionPage.default, {
    onSelectFeed: onSelectFeed,
    pageId: _enums.PageID.select_poll_target_page,
    onClickClose: onClickClose
  });
};
var _default = exports.default = /*#__PURE__*/_react.default.memo(AmityPollTargetSelectionPage);
//# sourceMappingURL=TargetSelection.js.map