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}
+ />;
}
}
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": {