UNPKG

react-native-reanimated

Version:

More powerful alternative to Animated library for React Native.

36 lines (31 loc) 1.61 kB
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import React, { Component, forwardRef } from 'react'; import { ScrollView } from 'react-native'; import createAnimatedComponent from '../../createAnimatedComponent'; import { useAnimatedRef, useScrollViewOffset } from '../hook'; // TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file. // TODO TYPESCRIPT This is a temporary type to get rid of .d.ts file. // eslint-disable-next-line @typescript-eslint/no-empty-interface const AnimatedScrollViewComponent = createAnimatedComponent(ScrollView); // type AnimatedScrollViewFC = React.FC<AnimatedScrollViewProps>; export const AnimatedScrollView = /*#__PURE__*/forwardRef((props, ref) => { const { scrollViewOffset, ...restProps } = props; const aref = ref === null ? useAnimatedRef() : ref; if (scrollViewOffset) { useScrollViewOffset(aref, scrollViewOffset); } // Set default scrollEventThrottle, because user expects // to have continuous scroll events. // We set it to 1 so we have peace until // there are 960 fps screens. if (!('scrollEventThrottle' in restProps)) { restProps.scrollEventThrottle = 1; } return /*#__PURE__*/React.createElement(AnimatedScrollViewComponent, _extends({ ref: aref }, restProps)); }); //# sourceMappingURL=ScrollView.js.map