@quidone/react-native-wheel-picker
Version:
Picker is a UI component for selecting an item from a list of options.
27 lines (26 loc) • 672 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
const useSyncScrollEffect = _ref => {
let {
listRef,
valueIndex,
activeIndexRef,
touching
} = _ref;
(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 = useSyncScrollEffect;
exports.default = _default;
//# sourceMappingURL=useSyncScrollEffect.js.map