@tarojsx/library
Version:
Taro3 library
17 lines • 1.01 kB
JavaScript
import { __rest } from "tslib";
import React, { useCallback } from 'react';
import { ScrollView } from '@tarojs/components';
/**
* Container scroll view
*
* Use provided width/height synthesize standard onScroll event
*/
export const OuterScrollView = React.forwardRef((props, ref) => {
const { style, onScroll } = props, rest = __rest(props, ["style", "onScroll"]);
const _a = style, { width, height } = _a, otherStyle = __rest(_a, ["width", "height"]);
const handleScroll = useCallback((event) => {
onScroll(Object.assign(Object.assign({}, event), { currentTarget: Object.assign(Object.assign({}, event.detail), { clientWidth: width, clientHeight: height }) }));
}, [width, height, onScroll]);
return (React.createElement(ScrollView, Object.assign({ ref: ref, style: Object.assign({ width, height, overflowAnchor: 'auto' }, otherStyle), scrollX: true, scrollY: true, scrollAnchoring: true, onScroll: handleScroll }, rest)));
});
//# sourceMappingURL=OuterScrollView.js.map