From b5601729622bb950a99f0eef914c8f4dd3b7c09c Mon Sep 17 00:00:00 2001 From: Dalibor Horinek Date: Tue, 3 May 2016 02:15:03 +0200 Subject: [PATCH 1/2] Ref might be not registered, so dont trigger measure on null --- lib/LazyloadView.js | 4 +++- package.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/LazyloadView.js b/lib/LazyloadView.js index 1ef19bb..142e7e5 100644 --- a/lib/LazyloadView.js +++ b/lib/LazyloadView.js @@ -89,7 +89,9 @@ class LazyloadView extends Component{ }; measureLayout = (...args) => { - this._root.measureLayout(...args); + if (this._root) { + this._root.measureLayout(...args); + } }; setNativeProps = (...args) => { diff --git a/package.json b/package.json index 95adcae..ee730bc 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "react-native-lazyload", "version": "1.0.4", "description": "lazyload for react native", + "version": "1.0.2", "license": "MIT", "main": "./index.js", "repository": { From 1c3d2054c29d411567464f9108cb631213ead593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hor=C3=A1=C4=8Dek?= Date: Tue, 9 Aug 2016 12:10:54 +0200 Subject: [PATCH 2/2] Proxy some methods/attributes for ListView in LazyloadListView --- lib/LazyloadListView.js | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/lib/LazyloadListView.js b/lib/LazyloadListView.js index e2a84ea..a45c1ef 100644 --- a/lib/LazyloadListView.js +++ b/lib/LazyloadListView.js @@ -7,14 +7,46 @@ import { import LazyloadScrollView from './LazyloadScrollView'; -class LazyloadListView extends Component{ +class LazyloadListView extends Component { static displayName = 'LazyloadListView'; + constructor(props, context) { + super(props, context); + + this._setScrollViewRef = this._setScrollViewRef.bind(this); + } + + get scrollProperties() { + const { _scrollView } = this; + if (!_scrollView) { return; } + return _scrollView.scrollProperties; + } + + get scrollTo() { + const { _scrollView } = this; + if (!_scrollView) { return; } + return _scrollView.scrollTo; + } + + _setScrollViewRef(ref) { + this._scrollView = ref; + } + + _additionalListViewProps() { + if (!this.props.name) { + return {}; + } + return { + renderScrollComponent: props => + }; + } + render() { - return this.props.name ? } - /> : ; + {...this._additionalListViewProps()} + ref={this._setScrollViewRef} + />; } }