diff --git a/package.json b/package.json index 85711b97..2b5246cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "recyclerlistview", - "version": "1.4.0-beta.5", + "version": "1.4.0-beta.6", "description": "The listview that you need and deserve. It was built for performance, uses cell recycling to achieve smooth scrolling.", "main": "dist/reactnative/index.js", "types": "dist/reactnative/index.d.ts", diff --git a/src/core/scrollcomponent/BaseScrollComponent.tsx b/src/core/scrollcomponent/BaseScrollComponent.tsx index edf404b3..9e1fdd17 100644 --- a/src/core/scrollcomponent/BaseScrollComponent.tsx +++ b/src/core/scrollcomponent/BaseScrollComponent.tsx @@ -14,6 +14,7 @@ export interface ScrollComponentProps { scrollThrottle?: number; distanceFromWindow?: number; useWindowScroll?: boolean; + onLayout?: any; } export default abstract class BaseScrollComponent extends React.Component { public abstract scrollTo(x: number, y: number, animate: boolean): void; diff --git a/src/platform/reactnative/scrollcomponent/ScrollComponent.tsx b/src/platform/reactnative/scrollcomponent/ScrollComponent.tsx index fabb064d..5d59aab2 100644 --- a/src/platform/reactnative/scrollcomponent/ScrollComponent.tsx +++ b/src/platform/reactnative/scrollcomponent/ScrollComponent.tsx @@ -26,7 +26,6 @@ export default class ScrollComponent extends BaseScrollComponent { private _height: number; private _width: number; private _isSizeChangedCalledOnce: boolean; - private _dummyOnLayout: (event: LayoutChangeEvent) => void = TSCast.cast(null); private _scrollViewRef: ScrollView | null = null; constructor(args: ScrollComponentProps) { @@ -42,7 +41,7 @@ export default class ScrollComponent extends BaseScrollComponent { public scrollTo(x: number, y: number, isAnimated: boolean): void { if (this._scrollViewRef) { - this._scrollViewRef.scrollTo({x, y, animated: isAnimated}); + this._scrollViewRef.scrollTo({ x, y, animated: isAnimated }); } } @@ -63,13 +62,13 @@ export default class ScrollComponent extends BaseScrollComponent { // } = this.props; return ( this._scrollViewRef = scrollView as (ScrollView | null)} - removeClippedSubviews={false} - scrollEventThrottle={this.props.scrollThrottle} - {...this.props} - horizontal={this.props.isHorizontal} - onScroll={this._onScroll} - onLayout={(!this._isSizeChangedCalledOnce || this.props.canChangeSize) ? this._onLayout : this._dummyOnLayout}> - + removeClippedSubviews={false} + scrollEventThrottle={this.props.scrollThrottle} + {...this.props} + horizontal={this.props.isHorizontal} + onScroll={this._onScroll} + onLayout={(!this._isSizeChangedCalledOnce || this.props.canChangeSize) ? this._onLayout : this.props.onLayout}> +