// Metro module 9210 (f9211). import { forwardRef, useState, useRef, useImperativeHandle, useCallback, useEffect, useMemo } from "react"; import * as _PhoneOrEmailUtils from "../PhoneOrEmailUtils"; import useStableCallback from "../../../hooks/useStableCallback"; import { intl, t } from "../../../intl/index.native"; import { SplitTextInput } from "../../../design/components/SplitTextInput/native/SplitTextInput.native"; const r22 = forwardRef(function(a0, a1) { let c17072_6, c17072_7; const { onChange, alpha2: _alpha2, countryCode, onPressCountrySelector, forceMode, ...props } = a0; let alpha2 = a0.alpha2; c17072_6 = void 0; c17072_7 = void 0; const [state, setState] = useState(""); const ref = useRef(null); useImperativeHandle(a1, () => ({ blur: () => { const current = ref.current; return current == null ? void 0 : current.blur(); }, focus: () => { const current = ref.current; return current == null ? void 0 : current.focus(); }, isFocused: () => { const current = ref.current; let r6 = current == null ? void 0 : current.isFocused(); if (r6 == null) { r6 = false; } return r6; }, setText: (a0) => { setState(a0); const current = ref.current; if (current != null) { current.setText(a0); } }, getText: () => { const current = ref.current; let r6 = current == null ? void 0 : current.getText(); if (r6 == null) { r6 = ""; } return r6; }, measure: (a0) => { const current = ref.current; return current == null ? void 0 : current.measure(a0); }, measureInWindow: (a0) => { const current = ref.current; return current == null ? void 0 : current.measureInWindow(a0); }, measureLayout: (a0, a1, a2) => { const current = ref.current; return current == null ? void 0 : current.measureLayout(a0, a1, a2); } }), []); const shouldShowCountryCodeSelector = _PhoneOrEmailUtils.shouldShowCountryCodeSelector(forceMode, state); const callback = useCallback((a0) => { setState(a0); const r14 = _PhoneOrEmailUtils.shouldShowCountryCodeSelector(forceMode, a0) ? countryCode : ""; if (onChange != null) { onChange(a0, r14); } }, [countryCode, forceMode, onChange]); const stableCallback = useStableCallback(callback); c17072_6 = stableCallback; useEffect(() => { const current = ref.current; let r8 = current == null ? void 0 : current.getText(); if (r8 == null) { r8 = ""; } c17072_6(r8); }, [countryCode, stableCallback]); let leadingText = void 0; if (shouldShowCountryCodeSelector) { if (alpha2 == null) { alpha2 = ""; } leadingText = `${alpha2} ${countryCode}`; } c17072_7 = leadingText; return { let accessibilityLabel = c17072_7; if (accessibilityLabel == null) { accessibilityLabel = ""; } return { onPress: onPressCountrySelector, accessibilityRole: "button", accessibilityLabel, accessibilityHint: intl.string(t.GwAW3k) }; }, [leadingText, onPressCountrySelector])} />; }); export default r22;