"use strict";

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

var _react = require("react");

var _NativeBaseContext = require("../core/NativeBaseContext");

var _tools = require("../theme/tools");

function useResponsiveSSRProps(incomingProps, theme) {
  const [modified, setModified] = (0, _react.useState)(false); // const theme = useTheme();

  const isSSR = (0, _NativeBaseContext.useNativeBaseConfig)('NativeBase').isSSR;
  let responsivePropsExists = false;

  if (isSSR) {
    responsivePropsExists = (0, _tools.isResponsiveAnyProp)(incomingProps, theme);
  }

  let modifiedProps = incomingProps;

  if (responsivePropsExists && isSSR && !modified) {
    modifiedProps = { ...modifiedProps,
      key: Math.random()
    };
  }

  (0, _react.useEffect)(() => {
    if (responsivePropsExists && isSSR) {
      setModified(true);
    }
  }, [responsivePropsExists, isSSR]);
  return modifiedProps;
}
//# sourceMappingURL=useResponsiveSSRProps.js.map