mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-30 17:29:14 +00:00
[fix] how ListView uses ScrollView
* Bind `_setScrollViewRef` to instance * Fix getting ScrollView props for ListView
This commit is contained in:
committed by
Nicolas Gallagher
parent
d64df129b2
commit
0c76cc5d80
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user