Skip to content

perf(native): optimize useStyle used in native components#210

Merged
Brentlok merged 2 commits into
uni-stack:mainfrom
divineniiquaye:fix-01
Dec 8, 2025
Merged

perf(native): optimize useStyle used in native components#210
Brentlok merged 2 commits into
uni-stack:mainfrom
divineniiquaye:fix-01

Conversation

@divineniiquaye

Copy link
Copy Markdown
Contributor

Summary

Fixes react compiler's auto-memoization in the useSyle hook used to style native components. The React Compiler automatically memoizes components and their dependencies, but it needs the code to follow certain patterns.

@Brentlok

Brentlok commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

This change results in unnecessary rerenders when someone is not using react compiler. Could you share with us when there's an error with react compiler? Because I wasn't able to create such

@divineniiquaye

divineniiquaye commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

@Brentlok I've updated useStyle to pass the properties (isDisabled, isFocused, isPressed) from state to UniwindStore.getStyles and adjusted dependencies for useMemo.

This improves memoization and prevents unnecessary re-renders.

@Brentlok Brentlok merged commit 615b09e into uni-stack:main Dec 8, 2025
1 check passed
@divineniiquaye divineniiquaye deleted the fix-01 branch January 23, 2026 18:46
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.

2 participants