diff --git a/packages/react-imask/src/hook.ts b/packages/react-imask/src/hook.ts index f128fe5c..51dbe4df 100644 --- a/packages/react-imask/src/hook.ts +++ b/packages/react-imask/src/hook.ts @@ -9,7 +9,8 @@ function useIMask< Opts extends FactoryOpts=FactoryOpts, >( opts: Opts, - { onAccept, onComplete }: { + { onAccept, onComplete, ref=useRef(null) }: { + ref?: MutableRefObject, onAccept?: (value: InputMask['value'], maskRef: InputMask, e?: InputEvent) => void; onComplete?: (value: InputMask['value'], maskRef: InputMask, e?: InputEvent) => void; } = {} @@ -23,7 +24,6 @@ function useIMask< typedValue: InputMask['typedValue'], setTypedValue: Dispatch['typedValue']>, } { - const ref = useRef(null); const maskRef = useRef | null>(null); const [initialized, setInitialized] = useState(false); const [lastAcceptState, setLastAcceptState] = useState<{