[fix] how ListView uses ScrollView

* Bind `_setScrollViewRef` to instance
* Fix getting ScrollView props for ListView
This commit is contained in:
Paul Le Cam
2016-09-20 00:24:25 +01:00
committed by Nicolas Gallagher
parent d64df129b2
commit 0c76cc5d80
+4 -2
View File
@@ -6,6 +6,8 @@ import ScrollView from '../ScrollView';
import View from '../View'; import View from '../View';
import React, { Component } from 'react'; import React, { Component } from 'react';
const scrollViewProps = Object.keys(ScrollView.propTypes);
class ListView extends Component { class ListView extends Component {
static propTypes = ListViewPropTypes; static propTypes = ListViewPropTypes;
@@ -88,14 +90,14 @@ class ListView extends Component {
} }
} }
const props = pick(ScrollView.propTypes, this.props); const props = pick(this.props, scrollViewProps);
return React.cloneElement(this.props.renderScrollComponent(props), { return React.cloneElement(this.props.renderScrollComponent(props), {
ref: this._setScrollViewRef ref: this._setScrollViewRef
}, header, children, footer); }, header, children, footer);
} }
_setScrollViewRef(component) { _setScrollViewRef = (component) => {
this._scrollViewRef = component; this._scrollViewRef = component;
} }
} }