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

[expo] improve rendering logic #220

Merged
merged 1 commit into from
Jan 9, 2025
Merged

[expo] improve rendering logic #220

merged 1 commit into from
Jan 9, 2025

Conversation

yssk22
Copy link
Owner

@yssk22 yssk22 commented Jan 9, 2025

Summary

We noticed that #219 introduced the regression of HomeTab rendering and the root cause was the 'rerendering' caused by useHomeTabContext() in HomeTab, which triggered 'unmount' of tabs created by Tabs.map()

To avoid unmount while rerendering, we need to move the Tabs.map() to the fixed list of components instead of an array.

Also to ensure sections are properly cached by SectionList, we fixed keyExtractor logic, which can be moved to each SectionListRender class so that React can evaluate the key by default instead of having an override keyExtractor function in the original SectionList.

Test

  • expo

Issue

  • N/A

**Summary**

We noticed that #219 introduced the regression of HomeTab rendering and the root cause was
the 'rerendering' caused by useHomeTabContext() in HomeTab, which triggered 'unmount' of tabs
created by `Tabs.map()`

To avoid unmount while rerendering, we need to move the `Tabs.map()` to the fixed list of components instead of an array.

Also to ensure sections are properly cached by SectionList, we fixed keyExtractor logic, which can be moved to each `SectionListRender` class
so that React can evaluate the key by default instead of having an override `keyExtractor` function in the original SectionList.

**Test**

- expo

**Issue**

- N/A
@yssk22 yssk22 merged commit c95f486 into main Jan 9, 2025
5 checks passed
@yssk22 yssk22 mentioned this pull request Jan 9, 2025
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.

1 participant