"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useBottomMargins = void 0;
var _reactNative = require("react-native");
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
var _core = require("../../../core");
/* Extra bottom margin for iPhone bottom handle because
   ButtonLink doesn't have a fixed height */
const extraSafeAreaMargin = 8;
const useBottomMargins = (withSecondaryAction = false, excludeSafeAreaMargins = false) => {
  const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
  const needSafeAreaMargin = insets.bottom !== 0;
  const edgeToEdgeMargin = _reactNative.Platform.OS === "ios" ? 0 : 8;

  /* Check if the iPhone bottom handle is present.
     If not, or if you don't need safe area insets,
     add a default margin to prevent the button
     from sticking to the bottom. */
  const bottomMargin = !needSafeAreaMargin || excludeSafeAreaMargins ? _core.IOVisualCostants.appMarginDefault : insets.bottom + edgeToEdgeMargin;

  /* When the secondary action is visible, add extra margin
     to avoid little space from iPhone bottom handle */
  const extraBottomMargin = withSecondaryAction && needSafeAreaMargin ? extraSafeAreaMargin : 0;
  return {
    bottomMargin,
    extraBottomMargin
  };
};
exports.useBottomMargins = useBottomMargins;
//# sourceMappingURL=useBottomMargins.js.map