Skip to content

Commit

Permalink
Fix ScrollViewStickyHeader to push up header above it
Browse files Browse the repository at this point in the history
Summary:
When there are multiple sticky headers, ScrollViewStickyHeader should push up the header above it when it gets to the top.

This behavior was accidentally changed in D21948830 (fa5d3fb) when this component was fixed to work in Fabric.

This diff added a new variable `_shouldRecreateTranslateY`, which determines whether the `translateY` value should be recreated on render. `_shouldRecreateTranslateY` was not being set to true during `setNextHeaderY`, so the next header's Y value was never accounted for at render.

Changelog:
[General][Fixed] Fix ScrollViewStickyHeader to push up header above it

Reviewed By: lunaleaps

Differential Revision: D27277829

fbshipit-source-id: 83c9aacd454be178649bf8d060d1a5c750f4060f
  • Loading branch information
kacieb authored and facebook-github-bot committed Mar 25, 2021
1 parent 24f9f75 commit d754bde
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/Components/ScrollView/ScrollViewStickyHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class ScrollViewStickyHeader extends React.Component<Props, State> {
_debounceTimeout: number = Platform.OS === 'android' ? 15 : 64;

setNextHeaderY(y: number) {
this._shouldRecreateTranslateY = true;
this.setState({nextHeaderLayoutY: y});
}

Expand Down

0 comments on commit d754bde

Please sign in to comment.