util.js 651 B

12345678910111213
  1. import warning from "rc-util/es/warning";
  2. import canUseDom from "rc-util/es/Dom/canUseDom";
  3. export function parseWidthHeight(value) {
  4. if (typeof value === 'string' && String(Number(value)) === value) {
  5. warning(false, 'Invalid value type of `width` or `height` which should be number type instead.');
  6. return Number(value);
  7. }
  8. return value;
  9. }
  10. export function warnCheck(props) {
  11. warning(!('wrapperClassName' in props), "'wrapperClassName' is removed. Please use 'rootClassName' instead.");
  12. warning(canUseDom() || !props.open, "Drawer with 'open' in SSR is not work since no place to createPortal. Please move to 'useEffect' instead.");
  13. }