mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix bug where ScrollView contentInset top set to undefined wouldn't default to 0
Summary:
If you passed
```
contentInset: { bottom: 10 }
```
then it wouldn't go into the if case and it could try to call `setOffset` with `undefined`. `setOffset` requires a number.
Changelog:
[Fix][ScrollView] ScrollView contentInset top now defaults to 0 in expected situations
Reviewed By: JoshuaGross
Differential Revision: D17796155
fbshipit-source-id: 951dbbb0de1052f64a6835963e8bbc564990c120
This commit is contained in:
@@ -713,10 +713,7 @@ class ScrollView extends React.Component<Props, State> {
|
||||
this.props.contentOffset ? this.props.contentOffset.y : 0,
|
||||
);
|
||||
this._scrollAnimatedValue.setOffset(
|
||||
/* $FlowFixMe(>=0.98.0 site=react_native_fb) This comment suppresses an
|
||||
* error found when Flow v0.98 was deployed. To see the error delete this
|
||||
* comment and run Flow. */
|
||||
this.props.contentInset ? this.props.contentInset.top : 0,
|
||||
this.props.contentInset ? this.props.contentInset.top || 0 : 0,
|
||||
);
|
||||
this._stickyHeaderRefs = new Map();
|
||||
this._headerLayoutYs = new Map();
|
||||
|
||||
Reference in New Issue
Block a user