Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Add support for SectionList sticky headers #37

Open
rcidt opened this issue Oct 3, 2018 · 10 comments
Open

Add support for SectionList sticky headers #37

rcidt opened this issue Oct 3, 2018 · 10 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@rcidt
Copy link

rcidt commented Oct 3, 2018

I am using this in a MaterialTopTabNavigator with a SectionList. The SectionList sticky headers do not seem to stick. It looks like they might actually be sticking, but are hidden from view underneath the tabs.

@rcidt
Copy link
Author

rcidt commented Oct 3, 2018

oct-03-2018 10-17-17

@benevbright
Copy link
Owner

Hi, @rcidt
I really appreciate your issue and GIF.
Please let me understand clearly. Did you expect to the tab be hidden too?

If so, showing tab is the way I built this module. (and it's also the way many major apps do)

@benevbright
Copy link
Owner

Oh, you have bottom tab too.
It would be great if the module would be able to hide it as well. #28

@rcidt
Copy link
Author

rcidt commented Oct 3, 2018

@benevbright This is working just as I expected. I expect the tabs to stay visible at all times, but the Titled Header to be hidden from view as I scroll down.

The only thing that is not working as expected is the "sticky headers". This is a SectionList, so the each "sticky header" should stick to the top of the scrollable area.

In my Gif, if you look carefully you will see two rows, with the following title "Seen" and "Replied". Those are the sticky headers.


I have played around with collapsible source code a bit, maybe it will clarify:

index.js line 20:

const defaultHeaderHeight = Platform.select({ios: 44, android: 56, web: 50});
const defaultTabHeight = 50;
-const safeBounceHeight = Platform.select({ios: 300, android: 100, web: 200});
+const safeBounceHeight = Platform.select({ios: 70, android: 100, web: 200});

index.js line 333:

return (
-       <View style={{flex: 1}}>
+       <View style={{marginTop: 70, flex: 1}}>
         <SafeAreaView style={{flex: 1}} forceInset={{bottom: 'never'}}>

And here is the result:
oct-03-2018 10-57-42
Notice how in the above Gif, the sticky headers do eventually stick to the top scroll area. But as you can see there are a few issues with this.

Hopefully you can shine some light on how to achieve this.

Thanks you for your time

@benevbright
Copy link
Owner

Oh, I got it now.
Thanks again for your explanation.
I'll look into it!

@benevbright benevbright added the bug Something isn't working label Oct 6, 2018
@benevbright
Copy link
Owner

Hi, I tried to resolve this issue but I don't think I could resolve it easily.
Yes, I was able to reproduce the same behavior.
And as you point out, it's relative with safeBounceHeight.
safeBounceHeight is necessary to prevent the side effect of this module.
I will update you if I find a solution. :)

@rcidt
Copy link
Author

rcidt commented Oct 8, 2018

@benevbright Thanks for looking into this, yes please let me know. I will also give it some thought as well.

@benevbright benevbright added the help wanted Extra attention is needed label Oct 11, 2018
@benevbright
Copy link
Owner

benevbright commented Oct 11, 2018

https://github.com/benevbright/react-navigation-collapsible/tree/bug/sectionlist
I created bug/sectionlist branch reproducing bug with SectionList.

@benevbright benevbright removed the help wanted Extra attention is needed label Nov 22, 2018
@benevbright benevbright added the enhancement New feature or request label Mar 8, 2019
@radetsky
Copy link

@rcidt How did you make floating button fixed? I tried to use position absolute, but the screen height is floating too when headers collapsing.

@rcidt
Copy link
Author

rcidt commented Apr 29, 2019

@radetsky it is rendered higher up in the component tree. Outside of the list.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants