-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
feat: add a secondary layout
argument in createStyleSheet
#155
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hey @justblender, thanks for the PR. I think injecting the second argument is a great idea. However, I'm curious, why don't we inject By focusing solely on layout props, we might overlook additional metadata such as |
Hey @jpudysz! Yeah, I might've rushed this PR a little bit 😅 Initially I wanted to pass the whole runtime too. I started reconsidering this after noticing that stylesheets are only invalidated when the stylesheet itself, theme or layout changes, so I was concerned that extra runtime properties like react-native-unistyles/src/useStyles.ts Lines 28 to 30 in ca4752c
But after looking again, I might've been mistaken as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please add yourself to the list of contributors:
### Contributors |
Summary
This PR adds a secondary
layout
argument for the callback function passed intocreateStyleSheet
. This is not a breaking change for existing users who only accept onetheme
argument, and will only improve developer experience by providing an easier access to current breakpoint, screen orientation, dimensions, and insets without requiring users to importUnistylesRuntime
every time.