UNPKG

@quidone/react-native-wheel-picker

Version:

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

25 lines (24 loc) 635 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = require("react"); const useSyncScrollEffect = ({ listRef, valueIndex, activeIndexRef, touching }) => { (0, _react.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 }; var _default = exports.default = useSyncScrollEffect; //# sourceMappingURL=useSyncScrollEffect.js.map