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

Fix: the tab header not sync with scene swipe when header is long #1402

Closed
wants to merge 3 commits into from

Conversation

gongdao123
Copy link

@gongdao123 gongdao123 commented Nov 9, 2022

Please provide enough information so that others can review your pull request:

Motivation

  • The Tab Header is utilizing FlatList for rendering propose.
  • FlatList will NOT try to render ALL of the content if the content is long for performant reasons.
  • With the previous code, the tab header moves ONLY when all of the header content is rendered.
    These cause the header will not sync with the scene swipe when the header is long

output

Test plan

After the patch, the tab header can follow the screen swipe, with no performance drawback.
output1

Code formatting

Look around. Match the style of the rest of the codebase. Run yarn lint --fix before committing.

@github-actions
Copy link

github-actions bot commented Nov 9, 2022

Hey gongdao123! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines.

@gongdao123 gongdao123 changed the title Fix the tab header not sync with scene swipe when header is long Fix: the tab header not sync with scene swipe when header is long Nov 9, 2022
@okwasniewski
Copy link
Collaborator

Hey, thanks for your PR. Unfortunately I don't think that using setTimeout won't have any performance drawback. Therefore I think that this should be solved differently. Can you open an issue for this I will take a look into this.

@gongdao123
Copy link
Author

gongdao123 commented Nov 10, 2022

Hey, thanks for your PR. Unfortunately I don't think that using setTimeout won't have any performance drawback. Therefore I think that this should be solved differently. Can you open an issue for this I will take a look into this.

Thx for your reply, I've created issue #1405.

Just in case. Want to clarify here that the clearTimeout and setTimeout are very basic debounce mechanisms to make sure the setTabWidths will ONLY trigger once in one batch, which actually can reduce performance drawback?

@okwasniewski
Copy link
Collaborator

Closing this PR, since I've implemented a proper fix for this here: #1409

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants