mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Scrollview updatedChildFrames data controlled by prop
Summary: Optimize ScrollView by adding flag "DEPRECATED_sendUpdatedChildFrames" to gate whether updatedChildFrames data is computed and propagated on scroll events. The frame data is used in ListView by the onChangeVisibleRows prop. When this prop is not defined, unnecessary computation in ScrollView should not be performed. Reviewed By: sahrens Differential Revision: D5174898 fbshipit-source-id: e3eaed8760b76becf14dfeb00122bdebdaeae4ef
This commit is contained in:
committed by
Facebook Github Bot
parent
d062cc252e
commit
62b20ce582
@@ -388,6 +388,15 @@ const ScrollView = React.createClass({
|
||||
'always',
|
||||
'never',
|
||||
]),
|
||||
/**
|
||||
* When true, ScrollView will emit updateChildFrames data in scroll events,
|
||||
* otherwise will not compute or emit child frame data. This only exists
|
||||
* to support legacy issues, `onLayout` should be used instead to retrieve
|
||||
* frame data.
|
||||
* The default value is false.
|
||||
* @platform ios
|
||||
*/
|
||||
DEPRECATED_sendUpdatedChildFrames: PropTypes.bool,
|
||||
},
|
||||
|
||||
mixins: [ScrollResponder.Mixin],
|
||||
@@ -682,6 +691,9 @@ const ScrollView = React.createClass({
|
||||
this.props.alwaysBounceVertical :
|
||||
!this.props.horizontal;
|
||||
|
||||
const DEPRECATED_sendUpdatedChildFrames =
|
||||
!!this.props.DEPRECATED_sendUpdatedChildFrames;
|
||||
|
||||
const baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
|
||||
const props = {
|
||||
...this.props,
|
||||
@@ -710,6 +722,7 @@ const ScrollView = React.createClass({
|
||||
scrollEventThrottle: hasStickyHeaders ? 1 : this.props.scrollEventThrottle,
|
||||
sendMomentumEvents: (this.props.onMomentumScrollBegin || this.props.onMomentumScrollEnd) ?
|
||||
true : false,
|
||||
DEPRECATED_sendUpdatedChildFrames,
|
||||
};
|
||||
|
||||
const { decelerationRate } = this.props;
|
||||
|
||||
Reference in New Issue
Block a user