Comments (3)
Change styleResolution
to property-specificity
. The output will not contain that bloat https://stylexjs.com/docs/api/configuration/babel-plugin/#styleresolution
from stylex.
Unless I'm mistaken, I think this behavior is intended in order to ensure that the last style always wins. It seems to be setting null here in order to override more specific styles that potentially come from other stylex.create()
calls that are passed in.
if you had some styles that define background color
const lessSpecificStyles = stylex.create({
container: {
background: 'green',
},
});
const moreSpecificStyles = stylex.create({
container: {
backgroundColor: 'red'
}
});
Setting these nulls allows you to use the less specific styles last, and still have them apply because lessSpecificStyles.container
will set backgroundColor
to null when it builds.
stylex([moreSpecificStyles.container, lessSpecificStyles.container]);
I'm not 100% sure if this is the reason though
from stylex.
@Jta26 That is exactly the reason for this.
@venututor if you choose property-specificity
styles merge the way they do in React Native, so be aware of the change in behaviour.
from stylex.
Related Issues (20)
- Remove non-standard CSS properties from types
- Unable to run StyleX with Next.js HOT 14
- How to Contribute
- Question: what pattern should be used for DRY values in style keys?
- @stylexjs/[email protected] tarball without lib directory HOT 2
- [@stylexjs/valid-styles]: overflow: 'clip' not allowed HOT 1
- @stylexjs/cli Missing Plugin HOT 2
- Stop transforming textAlign:start/end HOT 3
- Documentation for `useCSSLayers` and CLI package HOT 1
- stylex.firstThatWorks() not correctly linted HOT 2
- Can I use stylex in Next.JS with SWC? HOT 4
- How would you use dataset propertiers / attributes in stylexjs?
- Support for creating custom properties as functions HOT 2
- Allow variables in themes HOT 2
- defineVars gives error "A stylex namespace must be an object"
- [@stylexjs/webpack-plugin] Yarn Plug'n'Play Cannot find package '@babel/plugin-transform-modules-commonjs' HOT 2
- [not a bug] What is the correct way to type a CSS property, as `React.CSSProperties` is not HOT 1
- Inefficient and Confusing Use of StyleX for Color Scheme Handling HOT 1
- Push to Chromatic fails at "verifying your storybook" step HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stylex.