我对使用 react-style 很感兴趣。尽管尝试在 Gulp 中处理我的文件时出现错误。我收到以下错误:
错误:无法从“/Users/nnnnnn/Google Drive/Code/reactTesting/reactTestOne/node_modules/react-style/lib”中找到模块“react/lib/ExecutionEnvironment”
jsx 文件在这里,以防万一我做了一些非常愚蠢的事情:
import React, {Component, PropTypes} from 'react';
var ReactDOM = require('react-dom');
var Stylesheet = require('react-style');
export default class ToDo extends React.Component {
constructor(props){
super(props);
}
componentDidMount() {
var node = ReactDOM.findDOMNode(this);
TweenLite.to(node, 0.5, {css:{opacity:1, x:100}, ease:Power4.easeOut});
}
render() {
return (
<div styles={[styles.todo]} onClick={this.props.onClick} >
{this.props.text}
</div>
)
}
}
ToDo.propTypes = {
onClick: PropTypes.func.isRequired,
text: PropTypes.string.isRequired,
completed: PropTypes.bool.isRequired
}
var styles = Stylesheet.create({
todo: {
opacity: 0,
x: -100
}
})
谷歌没有帮助。想知道我是否需要以某种方式编译包,很累,所以可能是时候离开它过夜了。但是在完成之前努力放手。你知道是怎么回事 :)
干杯。