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 kelset committed May 27, 2021
1 parent d894163 commit eaed48f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/Components/ScrollView/ScrollViewStickyHeader.js
Expand Up @@ -64,6 +64,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 eaed48f

Please sign in to comment.