瀏覽代碼

Update ref handling

Remove fallback ref.
master
TheoryOfNekomata 1 年之前
父節點
當前提交
61f8c99569
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. +1
    -2
      categories/formatted/react/src/components/PhoneNumberInput/index.tsx

+ 1
- 2
categories/formatted/react/src/components/PhoneNumberInput/index.tsx 查看文件

@@ -83,7 +83,6 @@ export const PhoneNumberInput = React.forwardRef<
const defaultId = React.useId();
const id = idProp ?? defaultId;
const defaultRef = React.useRef<PhoneNumberInputDerivedElement>(null);
const ref = forwardedRef ?? defaultRef;

React.useEffect(() => {
const { current: currentRaw } = defaultRef;
@@ -116,7 +115,7 @@ export const PhoneNumberInput = React.forwardRef<
}, [forwardedRef, defaultRef]);

const handlePhoneInputChange = (phoneNumberValue: Value) => {
if (!(typeof ref === 'object' && ref)) {
if (!(typeof defaultRef === 'object' && defaultRef)) {
return;
}
const { current: input } = defaultRef;


Loading…
取消
儲存