UNPKG

@quidone/react-native-wheel-picker

Version:

Picker is a UI component for selecting an item from a list of options.

21 lines (20 loc) 531 B
import { useEffect } from 'react'; const useSyncScrollEffect = _ref => { let { listRef, valueIndex, activeIndexRef, touching } = _ref; useEffect(() => { if (listRef.current == null || touching || activeIndexRef.current === valueIndex) { return; } listRef.current.scrollToIndex({ index: valueIndex, animated: true }); }, [valueIndex]); // eslint-disable-line react-hooks/exhaustive-deps }; export default useSyncScrollEffect; //# sourceMappingURL=useSyncScrollEffect.js.map