-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Disallow functions as value of style prop in libs related to React Native #2014
Conversation
🦋 Changeset is good to goLatest commit: 0fd8094 We got this. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 0fd8094:
|
@@ -54,6 +54,11 @@ export function createStyled( | |||
|
|||
let stylesWithStyleProp = styles | |||
if (props.style) { | |||
if (typeof props.style === 'function') { |
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.
alternatively, we could resolve those with theme
- the main problem was that those were resolved with props
which didn't even match css prop signatures
I'm mostly interested in avoiding any other solutions from being breaking changes in v11 - we don't have to have a final solution for this problem right now, we only need to make sure that we can implement a final solution within v11 line. But also - I'm not super interested in working on any improvements here 🤷♂️ The community must step up if they want anything from the libs related to React Native.
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.
This still allows functions here doesn't it because I assume you can pass in an array with a function in it and it'll be called?
Why don't we do newProps.style = [emotionStyles, props.style]
?
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.
so that way RN should just resolve on its own the array and we omit the props.style
from being resolved by Emotion? that would be sweet!
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.
Yeah
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.
I've used your advice and changes the code accordingly. Had to update snapshots and I've decided to use actual web implementation of react-primitives
in tests so things get tested in more e2e manner - with the previous mock array got forwarded to the native (JS)DOM's style prop which didn't look OK.
2c840ac
to
95a592f
Compare
@@ -13,7 +13,7 @@ | |||
], | |||
"license": "MIT", | |||
"dependencies": { | |||
"css-to-react-native": "^2.2.1" | |||
"css-to-react-native": "^3.0.0" |
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.
There should be a changeset for this, no?
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.
added
Partially addresses #1955