"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useSafeArea = useSafeArea;

var _reactNativeSafeAreaContext = require("react-native-safe-area-context");

var _utils = require("./utils");

var _useTheme = require("./../useTheme");

var _stableHash = _interopRequireDefault(require("stable-hash"));

var _react = require("react");

var _utils2 = require("../../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable react-hooks/exhaustive-deps */
// import { useSortedProps, calculatePaddingProps } from './utils/';
function useSafeArea(props) {
  const {
    safeAreaProps,
    paddingProps,
    sansPaddingProps
  } = (0, _utils.useSortedProps)(props);
  const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
  const sizes = (0, _useTheme.useTheme)().sizes;
  const result = (0, _react.useMemo)(() => {
    if ((0, _utils2.isEmptyObj)(safeAreaProps)) {
      return props;
    }

    const calcualtedPaddingProps = (0, _utils.calculatePaddingProps)(safeAreaProps, paddingProps, insets, sizes);
    return { ...sansPaddingProps,
      ...paddingProps,
      ...calcualtedPaddingProps
    };
  }, [// eslint-disable-next-line react-hooks/exhaustive-deps
  (0, _stableHash.default)(paddingProps), (0, _stableHash.default)(safeAreaProps), (0, _stableHash.default)(sansPaddingProps)]); // const { style, dataSet } = React.useMemo(() => {});

  return result;
}
//# sourceMappingURL=index.js.map