UNPKG

react-native-confirmation-code-field

Version:

A react-native component to input confirmation code for both Android and IOS

12 lines (11 loc) 341 B
import { useRef, useEffect } from 'react'; export function useBlurOnFulfill({ value, cellCount, }) { 'use memo'; const inputRef = useRef(null); useEffect(function blurOnFulfillEffect() { if (value?.length === cellCount) { inputRef.current?.blur(); } }, [value, cellCount]); return inputRef; }