Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[SectionList][inverted] SectionList headers are sticky-at-the-top-footers if the list is inverted #18945

Open
3 tasks done
terrysahaidak opened this issue Apr 19, 2018 · 48 comments · May be fixed by #47130
Open
3 tasks done
Labels
Bug Component: SectionList Resolution: PR Submitted A pull request with a fix has been provided.

Comments

@terrysahaidak
Copy link

Environment

Environment:
OS: macOS High Sierra 10.13.1
Node: 8.6.0
Yarn: 1.5.1
npm: 4.6.1
Watchman: 4.9.0
Xcode: Xcode 9.0.1 Build version 9A1004
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.3 => 0.55.3

Steps to Reproduce

Clone this repository and run it via react-native run-ios.
Observe the section separators are in wrong (randomly?) places.

Expected Behavior

The section list headers should be in the top of the section instead of the bottom like section footers do with an inverted list (but they aren't sticky).

Expected gif:

kapture 2018-04-19 at 13 46 22

Actual Behavior

The section headers are footers instead of headers. They are sticky because of #17762 but still footers, not headers.

Sample code:

export default class App extends React.Component {
  render() {
    return (
      <View style={s.container}>
        <SectionList
          inverted
          sections={mock.sections}
          maxToRenderPerBatch={10}
          initialNumToRender={10}
          style={{ flex: 1 }}
          keyExtractor={(item) => item.messageId}
          renderSectionHeader={sectionProps => (
            <SectionHeader
              {...sectionProps}
            />
          )}
          renderItem={({ item }) => (
            <ListItem
              item={item}
            />
          )}
          ItemSeparatorComponent={ItemSeparator}
        />
        />
      </View>
    );
  }
}

Problem Gif:

kapture 2018-04-19 at 13 43 42

@almorak
Copy link

almorak commented Jun 25, 2018

try:
set sectionlist stickySectionHeadersEnabled={false}
use renderSectionFooter instead of renderSectionHeader with inverted case

@terrysahaidak
Copy link
Author

terrysahaidak commented Jun 25, 2018

@almorak thanks for your advice, but it won't fix the bug at all.
Sticky headers are common behavior for chat date headers, I still need them.

Also, see my second issue:
#18943

@terrysahaidak
Copy link
Author

Hi @janicduplessis, you have worked on support of inverted sticky headers, but there are some issues, could you please look at them?

@stale
Copy link

stale bot commented Sep 23, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 23, 2018
@terrysahaidak
Copy link
Author

Still there is no any workaround or fix for that, so it can't be closed.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 23, 2018
@iamolegga
Copy link

Any workaround on this?

@terrysahaidak
Copy link
Author

@iamolegga I just don't use section list with sticky headers currently. Just simply FlatList with custom functions for creating sections and then render it.

@brunoro
Copy link

brunoro commented Jan 15, 2019

Also struggling with this here, I'm implementing infinite scroll to the top and need sticky headers (or inverted footers, apparently). Any solutions so far?

@die20
Copy link

die20 commented Jul 8, 2019

I've been able to use this as a workaround:

<SectionList>
renderSectionFooter={<View style={{transform: [{ scaleY: -1 }]}}>...</View>}
renderItem={<View style={{transform: [{ scaleY: -1 }]}}>...</View>}
inverted={true}
</SectionList>

@terrysahaidak
Copy link
Author

Could you please provide an example with that fix applied to my repro?

Here is what I've got:

image

@stale
Copy link

stale bot commented Oct 14, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 14, 2019
@terrysahaidak
Copy link
Author

This hasn't been fixed yet.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 19, 2019
@stepupithubapp
Copy link

just simple use renderSectionFooter then header and make inverted true simple

@je7ov
Copy link

je7ov commented Jan 2, 2020

I'm having the same issue with inverted sticky headers.

just simple use renderSectionFooter then header and make inverted true simple

This doesn't address the issue. We're looking to have sticky section headers on inverted lists

@ydv0121
Copy link

ydv0121 commented Jan 8, 2020

+1

@djhr
Copy link

djhr commented Jan 31, 2020

opened this issue on 19 Apr 2018

@icecapp
Copy link

icecapp commented Oct 24, 2021

Still an issue on stock installs

@fangpenlin
Copy link

Hey folks 👋

This issue troubled me as I also need the sticky header to work for inverted section list for the app I am building. To solve the problem, I create an InvertedSectionList component for fixing this issue outside of RN code base. I open sourced it here

https://github.com/LaunchPlatform/inverted-section-list

For now I only built it to make it works for my app, didn't test it with other corner cases. My InvertedSectionList component is basically copying source code from RN repo and made critical changes only to make the sticky header (footer actually) works. So in theory, if I port the changes back to RN, it should fix this. I am trying my best to see if I can find time to create PRs to fix this issue. However, if you want, please feel free to port the changes I made and open PRs to RN's repo. In the mean time hopefully the component I made can solve your problem as well before it's fixed in the upstream.

@sergeymild
Copy link

Still an issue on stock installs

@github-actions
Copy link

github-actions bot commented Mar 2, 2023

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 2, 2023
@SrBrahma
Copy link

SrBrahma commented Mar 2, 2023

Up

@github-actions github-actions bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 2, 2023
@adidoes
Copy link

adidoes commented Mar 4, 2023

I can't believe this is still an issue after so many years and how common of a design it is in today's apps.

@jailsonpaca
Copy link

up

@mtnt
Copy link

mtnt commented May 18, 2023

still an issue...
"After all this time? - Always" =)

@iamolegga
Copy link

image

@Ilyxxxaa
Copy link

Please repair it

@timothyerwin
Copy link

how is this still an issue? is it bc all resources are on the metaverse?

@ayushneekhar
Copy link

Is it that hard to implement stickySectionFooterEnabled?

Copy link

github-actions bot commented Jan 8, 2024

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 8, 2024
@SimpleCreations
Copy link

Still an issue

@github-actions github-actions bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 9, 2024
@VadymVashchuk
Copy link

After 6 years still an issue

@adsalihac
Copy link

😀

@eljonathas
Copy link

24/04/2024 and still an issue

@MrQazi665
Copy link

Hello,

I'm interested in making the 'renderSectionFooter' sticky. Is this possible?

image

@HuziMuzi
Copy link

28/08/2024 still an issue

@fangpenlin
Copy link

Hey guys, after years, I was working on upgrading RN version of my app and realized this issue is still here 😅

So I tried my best to open a PR for addressing this bug:

#47130

It appears to be working as I tested, but I am not sure if there's any corner cases I missed. I may also need to find a time to test other platforms, such as iOS. I know this bug troubles us for a very long time, so it would be great if you guys can help me test my PR see if it's working as expected.

I have never create a new PR with a major change like this in react-native repo, so I may also need some help. If you know what's missing in my PR, and how to get my PR merged, please let me know. Thank you so much 🙏

@migueldaipre
Copy link
Collaborator

Hey guys, after years, I was working on upgrading RN version of my app and realized this issue is still here 😅

So I tried my best to open a PR for addressing this bug:

#47130

It appears to be working as I tested, but I am not sure if there's any corner cases I missed. I may also need to find a time to test other platforms, such as iOS. I know this bug troubles us for a very long time, so it would be great if you guys can help me test my PR see if it's working as expected.

I have never create a new PR with a major change like this in react-native repo, so I may also need some help. If you know what's missing in my PR, and how to get my PR merged, please let me know. Thank you so much 🙏

Hey @fangpenlin, is this ready or still in progress?

@fangpenlin
Copy link

@migueldaipre yep, it's ready for review

@migueldaipre migueldaipre added the Resolution: PR Submitted A pull request with a fix has been provided. label Oct 28, 2024
@migueldaipre
Copy link
Collaborator

@fangpenlin thanks 👍

also cc @cortinico @cipolleschi

@cortinico
Copy link
Contributor

I've pinged a couple of folks internally to look into this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Component: SectionList Resolution: PR Submitted A pull request with a fix has been provided.
Projects
None yet
Development

Successfully merging a pull request may close this issue.