Skip to content

Conversation

@hgray-instawork
Copy link
Collaborator

@hgray-instawork hgray-instawork commented Jun 13, 2025

Example of using a react-native FlatList in place of SectionList for our hv-section-list component.

All functionality is retained. Code was able to be simplified especially around the scrolling behaviors.

This PR isn't necessarily for merging, just an example of what is possible with FlatList.

Section List Flat List
s-l-sticky f-l-sticky
s-l-scroll f-l-scroll

Asana

Performing an update action (append, prepend, replace, replace-inner)
with a delay requires that the behavior element has an id. The
`basic-forms` demo was missing an id so was non functional.

- Added an error to warn developers of this condition
- Fixed the demo by adding an id to the element

| Before | Error | After |
| -- | -- | -- |
|
![before](https://github.com/user-attachments/assets/dfa1fded-0d8d-47a7-846e-def4b7e573fe)
|
![error](https://github.com/user-attachments/assets/66e2d97e-64cf-4bae-8c03-02ba9b2700bf)
|
![after](https://github.com/user-attachments/assets/c349dacd-ac16-410b-8682-3d1b3e4c02a6)
|


[Asana](https://app.asana.com/1/47184964732898/project/1204008699308084/task/1210535376481469?focus=true)
The previous functionality was returning zero if the
`scroll-to-input-offset` attribute was missing, otherwise it was
returning the default value (120). There was no path which returned the
value of `scroll-to-input-offset` if available.

- Created a new demo "Scroll to Input Offset"
- Corrected the value return
- Fixed a few typos in the demo and documentation

| Before | After |
| -- | -- |
|
![before](https://github.com/user-attachments/assets/1bcf806c-4b20-4bcf-b95e-4d904dc78dac)
|
![after](https://github.com/user-attachments/assets/a49278dc-138e-4da2-8b28-a150b7baa999)
|


[Asana](https://app.asana.com/1/47184964732898/project/1204008699308084/task/1210525849054931?focus=true)
@hgray-instawork hgray-instawork requested a review from a team June 13, 2025 13:54
@hgray-instawork hgray-instawork marked this pull request as draft June 13, 2025 13:54
@hgray-instawork hgray-instawork force-pushed the hardin/section-list-as-flat branch from 524f6cd to f4361f2 Compare June 13, 2025 14:08
Copy link
Collaborator

@flochtililoch flochtililoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a difference in behavior between the two implementation: the sticky header pushed the previous one with SectionList, while it overlap with the previous one with FlatList. Is this something we can fine tune?

@hgray-instawork
Copy link
Collaborator Author

hgray-instawork commented Jun 13, 2025

I see a difference in behavior between the two implementation: the sticky header pushed the previous one with SectionList, while it overlap with the previous one with FlatList. Is this something we can fine tune?

I see the same "push up" animation in my clean react-native testbed. I'm not sure if the difference here is related to:

  • the use of the scroll component wrapper
  • the different version of expo or react-native in my test project
  • some other style differences

I'll poke around some more and see if I can get them to match.

flatlist-demo.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants