代码改变世界

React.js 样式组件:React Style

2015-04-07 14:31  RTdo  阅读(2172)  评论(0编辑  收藏  举报

点这里

 

React Style 是 React.js 可维护的样式组件。使用 React Native StyleSheet.create一样的样式。

完全使用 JavaScript 定义样式:

1
2
3
4
5
6
7
var StyleSheet = require('react-style')
var styles = StyleSheet.create({
    foo: {
      color: 'red',
      backgroundColor: 'white'
    }
})

样式 React 组件:

1
2
3
4
5
6
7
8
9
10
var React = require('react')
 
class HelloWorld extends React.Component{
 
  render() {
    var dynamicStyles = {color: this.props.color}
    return <div styles={[styles.foo, dynamicStyles]}>Hello, world!</div>
  }
 
}

 

https://github.com/js-next/react-style