// Metro module 14777 (f14778). import { useRef, useEffect } from "react"; import { View } from "react-native"; import AppStateStore from "../../../../stores/native/AppStateStore"; import { AppStates } from "../../../../Constants"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import { useStateFromStores } from "../../../../_bundle/Module589"; import useStableCallback from "../../../../hooks/useStableCallback"; import { runAfterInteractions } from "../../../../utils/native/RunAfterInteractionsUtils"; import { getString } from "../../../../utils/ClipboardUtils.native"; import { TextInput } from "../../../../design/components/TextInput/native/TextInput.native"; function $mk118922($env) { return (a0) => runAfterInteractions(a0); } let env10423 = {}; const useStyles = createStyles({ inputContainer: { flexDirection: "column", alignSelf: "stretch" } }); export default function ClipboardCopyInput(props) { const { label, placeholder, isValidClipboardCode, maxLength, onChangeCode, error, textContentType, autoComplete, keyboardType, isDisabled, autoFocus = true } = props; let c21334_3; c21334_3 = void 0; const styles = useStyles(); const ref = useRef(null); const ref2 = useRef(null); const stateFromStores = useStateFromStores([AppStateStore], () => AppStateStore.getState()); const stableCallback = useStableCallback(onChangeCode); const stableCallback2 = useStableCallback(isValidClipboardCode); c21334_3 = stableCallback2; useEffect(() => { let _run2 = function _run() { const r9 = async () => { let c31733_1; let env32060; c31733_1 = void 0; const r27 = env32060 = { $parent: env10423 }; let c31733_0 = r27; env32060[0] = void 0; await new Promise((resolve) => setTimeout(resolve, 500)); await new Promise($mk118922(env10423)); env32060[0] = (await getString()).trim(); if (env32060[0] !== ref.current) { ref.current = env32060[0]; if ((0, c21334_3)(env32060[0])) { const current = ref2.current; if (current != null) { current.setText(env32060[0]); } } } }; _run2 = r9; return r9.apply(this, arguments); }; if (stateFromStores === AppStates.ACTIVE) { (function run() { return _run2.apply(this, arguments); })(); } }, [stateFromStores, stableCallback2, stableCallback]); return ; };