Closed huangxinbo closed 2 months ago
StyleX's dynamic styles are for truly dynamic values that cannot be known ahead of time. They're not to be used for conditionally applying styles. Create two separate style objects and merge them conditionally instead.
import * as stylex from "@stylexjs/stylex";
const styles = stylex.create({
taskListExpander: {
paddingLeft: "1rem",
fontSize: "0.6rem",
userSelect: "none",
paddingLeft: "1rem",
},
taskListExpanderWithSymbol: {
color: "#f58320",
cursor: "pointer",
padding: "0.15rem 0.2rem 0rem 0.2rem",
paddingLeft: null,
},
});
stylex.props(styles.taskListExpander, expanderSymbol && styles.taskListExpanderWithSymbol)
Describe the issue
Expected behavior
expanderSymbol is a variable.
Steps to reproduce
"@stylexjs/stylex": "0.5.1", "@stylexjs/eslint-plugin": "0.5.1",
Test case
No response
Additional comments
No response