Skip to content

Commit d576a5b

Browse files
elicwhitefacebook-github-bot
authored andcommitted
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
1 parent 15be144 commit d576a5b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Libraries/Components/ScrollView/ScrollView.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -739,10 +739,7 @@ class ScrollView extends React.Component<Props, State> {
739739
this.props.contentOffset ? this.props.contentOffset.y : 0,
740740
);
741741
this._scrollAnimatedValue.setOffset(
742-
/* $FlowFixMe(>=0.98.0 site=react_native_fb) This comment suppresses an
743-
* error found when Flow v0.98 was deployed. To see the error delete this
744-
* comment and run Flow. */
745-
this.props.contentInset ? this.props.contentInset.top : 0,
742+
this.props.contentInset ? this.props.contentInset.top || 0 : 0,
746743
);
747744
this._stickyHeaderRefs = new Map();
748745
this._headerLayoutYs = new Map();

0 commit comments

Comments
 (0)