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

invertedStickyHeaders not working on iOS as of 0.54.2 #18471

Closed
3 tasks done
dannycochran opened this issue Mar 20, 2018 · 6 comments
Closed
3 tasks done

invertedStickyHeaders not working on iOS as of 0.54.2 #18471

dannycochran opened this issue Mar 20, 2018 · 6 comments
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@dannycochran
Copy link
Contributor

dannycochran commented Mar 20, 2018

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 8.9.4
Yarn: 1.5.1
npm: 5.6.0
Watchman: Not Found
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.2
react-native: 0.54.2 => 0.54.2

Steps to Reproduce

Create a section list and set invertStickyHeaders=true. See:

git clone https://github.com/dannycochran/invertedStickyHeadersBug
cd invertedStickyHeadersBug
yarn install && react-native start-ios
react-native start-android

Expected Behavior

Sticky headers render at the bottom of the screen and stick to the bottom when scrolling.

Actual Behavior

Sticky headers continue to render at the top, and do not stick to the bottom. They also seem to
screw up rendering of the list in general with empty components where there should be headers:

screen shot 2018-03-20 at 1 28 04 pm

This appears to be a regression in 0.54.2 (it did not exist in 0.52.0). Also, the sticky headers were
always behaving as I expected in 0.52.0. I have an inverted sectionList and the headers were stuck
to the bottom and worked fine.

Edit: I originally reported this as iOS only. It is happening on both iOS and Android.

@react-native-bot react-native-bot added the Platform: macOS Building on macOS. label Mar 20, 2018
@dannycochran
Copy link
Contributor Author

@janicduplessis who implemented invertStickyHeaders

@hramos hramos added the Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. label Mar 20, 2018
@react-native-bot react-native-bot added the Platform: iOS iOS applications. label Mar 20, 2018
@janicduplessis
Copy link
Contributor

janicduplessis commented Mar 20, 2018

We changed this behaviour recently (sorry if it wasn't properly documented), now sticky headers will always stick at the top of the list even when inverted. You can restore the previous behaviour by using invertStickyHeaders={false} on ScrollView. There isn't currently a prop on SectionList to set it but you can use renderScrollComponent={(props) => <ScrollView {...props} invertStickyHeader={false} />. Maybe it would be worth adding a better way to configure it (https://github.com/facebook/react-native/blob/master/Libraries/Lists/VirtualizedList.js#L896).

cc @sahrens

@janicduplessis janicduplessis added 🔶Lists and removed Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. labels Mar 20, 2018
@janicduplessis
Copy link
Contributor

Also the name invertStickyHeaders is a bit misleading here, what this prop does is render the headers at the bottom of the ScrollView instead of at the top but since the list is inverted it will appear at the top again. In your case you want invertStickyHeaders to be false since it will cause the sticky headers to appear at the bottom when inverted.

@sahrens
Copy link
Contributor

sahrens commented Mar 22, 2018

Most all props should just get forwarded through to the underlying ScrollView, no?

@dannycochran
Copy link
Contributor Author

@sahrens no, for some reason it reads "this.props.inverted" instead of the actual prop when passing props to the ScrollView:

invertStickyHeaders: this.props.inverted,

@janicduplessis, is there anything else to propagating invertStickyHeaders besides changing the line above?

@janicduplessis
Copy link
Contributor

No this should be the only change needed

dannycochran added a commit to dannycochran/react-native that referenced this issue Mar 23, 2018
invertStickyHeaders was being set to "this.props.inverted" -- it should just inherit from the props of VirtualizedList instead, per discussion in facebook#18471
@hramos hramos removed the Platform: macOS Building on macOS. label Mar 29, 2018
grabbou pushed a commit that referenced this issue Apr 3, 2018
Summary:
invertStickyHeaders was being set to "this.props.inverted" -- it should just inherit from the props of VirtualizedList instead, per discussion in #18471

Fixes #18471

Pass "invertStickyHeaders: false" to a SectionList (or FlatList), and expect that your sticky headers stick to the bottom of the ScrollView, instead of the top.

none

[ANDROID] [BUGFIX] [SectionList] - invertStickyHeaders can now be set from SectionList or FlatList.
Closes #18524

Differential Revision: D7386163

Pulled By: hramos

fbshipit-source-id: 3b66dfca280e657303f69f98c5a8bc0df033f9f7
jacobp100 pushed a commit to OurStarClub/react-native that referenced this issue Apr 27, 2018
Summary:
invertStickyHeaders was being set to "this.props.inverted" -- it should just inherit from the props of VirtualizedList instead, per discussion in facebook#18471

Fixes facebook#18471

Pass "invertStickyHeaders: false" to a SectionList (or FlatList), and expect that your sticky headers stick to the bottom of the ScrollView, instead of the top.

none

[ANDROID] [BUGFIX] [SectionList] - invertStickyHeaders can now be set from SectionList or FlatList.
Closes facebook#18524

Differential Revision: D7386163

Pulled By: hramos

fbshipit-source-id: 3b66dfca280e657303f69f98c5a8bc0df033f9f7
macdoum1 pushed a commit to macdoum1/react-native that referenced this issue Jun 28, 2018
Summary:
invertStickyHeaders was being set to "this.props.inverted" -- it should just inherit from the props of VirtualizedList instead, per discussion in facebook#18471

Fixes facebook#18471

Pass "invertStickyHeaders: false" to a SectionList (or FlatList), and expect that your sticky headers stick to the bottom of the ScrollView, instead of the top.

none

[ANDROID] [BUGFIX] [SectionList] - invertStickyHeaders can now be set from SectionList or FlatList.
Closes facebook#18524

Differential Revision: D7386163

Pulled By: hramos

fbshipit-source-id: 3b66dfca280e657303f69f98c5a8bc0df033f9f7
@facebook facebook locked as resolved and limited conversation to collaborators Mar 23, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants