Sfoglia il codice sorgente

Update ref handling

Remove fallback ref.
master
parent
commit
61f8c99569
1 ha cambiato i file con 1 aggiunte e 2 eliminazioni
  1. +1
    -2
      categories/formatted/react/src/components/PhoneNumberInput/index.tsx

+ 1
- 2
categories/formatted/react/src/components/PhoneNumberInput/index.tsx Vedi File

@@ -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;


Caricamento…
Annulla
Salva