-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
flexDirection is not assignable to CSSProperties #1344
Comments
Thanks @reifnotreef ! your workaround worked for me 👍 |
This appears to be an issue with the CSSType library, I think. Notice here that JustifyContent has the (string & {}) at the end: https://github.com/frenic/csstype/blob/master/index.d.ts#L18504 But it's missing from FlexDirection: https://github.com/frenic/csstype/blob/master/index.d.ts#L18324 There's been some discussion about it: frenic/csstype#84, but nothing directly relating to this particular issue. Also, you can use |
whiteSpace: 'nowrap' |
Wanted to drop a note on here that this does not happen using react-jss and createUseStyles. |
as React.CSSProperties works for me
|
You are just using a style tag and a JS object, this has no direct interaction with JSS. |
@reifnotreef Sorry, I reacted to the question not realizing it was specific to JSS |
Seems this problem appearing when using withStyles. When using makeStyle problem is gone |
This is a TS issue and it happens because in the absence of typing, your Does it work if you provide an explicit type for your
|
Hm.. but I get the problem when using the createStyles as input to A bit of a side track, but I was under the impression that one had to use the PS: I get the same problem for the |
* Add mobile view to core pages, update design * Updated Dropdown and Tab styling for mobile view * Weird css issue, see fix cssinjs/jss#1344 --------- Co-authored-by: Håkan Eriksson <hakan.eriksson2@sj.se>
Same problem |
There is an issue with the `flexDirection` property I am consistently getting an error about it and the only fix I found is cssinjs/jss#1344 (comment) which states to add `as React.CSSProperties` when I declare a style
You can also declare the object type immediately versus trying to cast it later on. This is a variation of one of the top answers from above.
|
flexDirection: string; is not assignable to type 'CSSProperties'
React using TypeScript.
Get this error when trying to assign a flexDirection in styles:
This really confuses me:
It doesn't know that the string 'row' is === "row"
single quotes are being put in place via eslint/prettier, even when I try using double quotes it doesn't change it. I have also tried nested flex properties in an object:
and
But neither of those work.
EDIT:
I found a workaround:
This allows it to work as expected but is super clunky.
The text was updated successfully, but these errors were encountered: