import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';
import { forwardRefAndName } from "../../../lib/forwardRefAndName";

/**
 * React textarea behaves incorrectly on first rendered in Safari version 17.*
 * Reproduce: https://codesandbox.io/p/sandbox/textarea-and-textarea-safari-bug-9v95vz
 * was fixed in Safari version 17.4: https://developer.apple.com/documentation/safari-release-notes/safari-17_4-release-notes
 */
export var TextareaWithSafari17Workaround = forwardRefAndName('TextareaWithSafari17Workaround', function (props, ref) {
  var _React$useState = React.useState(true),
    firstRender = _React$useState[0],
    setFirstRender = _React$useState[1];
  React.useEffect(function () {
    firstRender && setFirstRender(false);
  }, []);
  return /*#__PURE__*/React.createElement("textarea", _extends({}, props, {
    value: firstRender ? '' : props.value,
    ref: ref
  }));
});