Skip to content

Hide sticky overflow for Section List #714

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

friyiajr
Copy link
Contributor

Description

Fixes #528

When a view was placed above a sticky header with Flash List the header would overflow that view (see video in original ticket). This PR removes that problem.

Reviewers’ hat-rack 🎩

Note: I couldn't get the e2e tests to run on my machine. Please run them on your end before approving.

  1. In fixture/src/contacts/Contacts.tsx copy and paste this code into the render function
  return (
    <View style={{ flex: 1 }}>
      <View style={{ height: 100 }} />
      <View style={{ height: "100%" }}>
        <FlashList
          testID="FlashList"
          estimatedItemSize={44}
          data={data}
          renderItem={({ item }) => {
            if (typeof item === "string") {
              return <ContactSectionHeader title={item} />;
            } else {
              return <ContactCell contact={item as Contact} />;
            }
          }}
          getItemType={(item) => {
            return typeof item === "string" ? "sectionHeader" : "row";
          }}
          ItemSeparatorComponent={ContactDivider}
          stickyHeaderIndices={stickyHeaderIndices}
          ListHeaderComponent={ContactHeader}
          initialScrollIndex={debugContext.initialScrollIndex}
        />
      </View>
    </View>
  );
  1. At this point if you scroll up, the sticky header in Contacts should NOT overflow the blank space above it. If you are in main, the sticky header would have gone over the empty space

Screenshots or videos (if needed)

fix.mov

Checklist

@friyiajr friyiajr force-pushed the fix-hide-sticky-header-overflow branch from e3c97cd to 4ec2b96 Compare December 19, 2022 16:56
@sebastienlabine
Copy link

Would be nice to see it in the next release 🙌

@friyiajr friyiajr merged commit 3b308bf into Shopify:main Jan 4, 2023
@friyiajr friyiajr deleted the fix-hide-sticky-header-overflow branch January 4, 2023 14:06
@andrestone
Copy link

Before this PR, it was possible to have sticky headers combined with blurry top menu bars by using the (unadvised) overrideProps.

//...
          overrideProps={{
            style: { minHeight: 1, minWidth: 1, overflow: 'visible' },
          }}
//...

I'm currently patching locally to obtain same behavior, wondering if there's any interest on adding a prop to support that behavior or maybe expanding the use of overrideProps to also allow modifying the sticky header container props, more or less like so:

//...
      <StickyHeaderContainer
        overrideRowRenderer={this.stickyOverrideRowRenderer}
        applyWindowCorrection={this.applyWindowCorrection}
        stickyHeaderIndices={stickyHeaderIndices}
        style={
          this.props.horizontal
            ? { ...this.getTransform() }
            : { flex: 1, overflow: "hidden", ...this.getTransform() }
        }
        {...this.props.overrideProps.stickyContainerProps}
      >
      
      //...

        <ProgressiveListView
          {...restProps}
          ref={this.recyclerRef}
          //...
          scrollViewProps={{
            onScrollBeginDrag: this.onScrollBeginDrag,
            //...
            ...this.props.overrideProps.scrollViewProps,
          }}
//...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sticky header overflows list
4 participants