-
-
Notifications
You must be signed in to change notification settings - Fork 128
Open
Description
I have dumb component, and for getting access to colors I must use EStyleSheet.value.
const DumbComponent = () => {
const [isActive, setActive] = useState(false);
//Current realisation
const activeBackground = EStyleSheet.value('$red');
const disabledBackground = EStyleSheet.value('$blue');
return (
<BumbElement color={isActive ? activeBackground : disabledBackground} />
);
};
But can we put inside EStyleSheet.create
custom object with colors what we need, and after use it in our component?
const styles = EStyleSheet.create({
colors: {
red: '$red',
blue: '$blue',
},
contentContainerStyle: {
flexDirection:'row'
}
});
const DumbComponent = () => {
const [isActive, setActive] = useState(false);
return <BumbElement color={styles.colors[isActive ? 'red' : 'blue']} />;
};
Metadata
Metadata
Assignees
Labels
No labels