This is a react-native style module plug-in that features a modular JSON object tree structure.
npm install --save react-native-css-tree
import cssTree from 'react-native-css-tree';
const styles = cssTree({ //globalStyle
grid:10,
base:{
size: 10,
}
})((key, parent, sub)=>{ //middleware
return sub;
})({
container:{
flex: 1,
margin: "$grid",
padding: 5,
_box:{
height: 100,
},
text:(color)=>({
color,
fontSize: "$base.size"
})
},
});
<View style={styles.container}>
<View style={styles.container._box}></View>
</View>
Styles = cssTree(GlobalStyle)(Middleware)(Style);
$
reference variable, and support the operation._
As a key prefix , it inherits all of the style properties of the parent.Version | Tag | Published |
---|---|---|
1.0.3 | latest | 5yrs ago |