Javascript 使用formsy react的toUpperCase错误

Javascript 使用formsy react的toUpperCase错误,javascript,reactjs,Javascript,Reactjs,我在正常react应用程序中使用formsy react模块时遇到问题。我一直在react的autoGenerateWrapperClass中遇到type.toUpperCase()异常 我已经逐字复制了GitHub页面上的示例。我的班级是 var React = require('react'); var ReactDOM = require('react-dom'); var Formsy = require('formsy-react'); var Form = Formsy.Fo

我在正常react应用程序中使用formsy react模块时遇到问题。我一直在react的autoGenerateWrapperClass中遇到type.toUpperCase()异常

我已经逐字复制了GitHub页面上的示例。我的班级是

 var React = require('react');
 var ReactDOM = require('react-dom');
 var Formsy = require('formsy-react');
 var Form = Formsy.Form;
 var MyOwnInput = require('./MyOwnInput.jsx');

  var MyAppForm = React.createClass({
      getInitialState: function () {
          return {
              canSubmit: false
          }
      },
      enableButton: function () {
          this.setState({
              canSubmit: true
          });
      },
      disableButton: function () {
          this.setState({
              canSubmit: false
          });
      },
      submit: function (model) {
          someDep.saveEmail(model.email);
      },
      render: function () {
          return (
            <Form onValidSubmit={this.submit} onValid={this.enableButton} onInvalid={this.disableButton}>
              <MyOwnInput name="email" validations="isEmail" validationError="This is not a valid email" required/>
              <button type="submit" disabled={!this.state.canSubmit}>Submit</button>
            </Form>
      );
  }
  });
var React=require('React');
var ReactDOM=require('react-dom');
var Formsy=要求('Formsy-react');
var Form=Formsy.Form;
var myownimport=require('./myownimport.jsx');
var MyAppForm=React.createClass({
getInitialState:函数(){
返回{
可以提交:错误
}
},
enableButton:函数(){
这是我的国家({
可以提交:正确
});
},
disableButton:函数(){
这是我的国家({
可以提交:错误
});
},
提交:功能(模型){
someDep.saveEmail(model.email);
},
渲染:函数(){
返回(
提交
);
}
});
和我的自定义输入类

var React = require('react');
var Formsy = require('formsy-react');
var Mixins = Formsy.Mixin;

var MyInput = React.createClass({

  // Add the Formsy Mixin
    mixins: [Mixins],

  // setValue() will set the value of the component, which in
  // turn will validate it and the rest of the form
  changeValue: function(event) {
    this.setValue(event.currentTarget[this.props.type === 'checkbox' ? 'checked' : 'value']);
  },
  render: function() {

    // Set a specific className based on the validation
    // state of this component. showRequired() is true
    // when the value is empty and the required prop is
    // passed to the input. showError() is true when the
    // value typed is invalid
    var className = this.props.className + ' ' + (this.showRequired() ? 'required' : this.showError() ? 'error' : null);

    // An error message is returned ONLY if the component is invalid
    // or the server has returned an error message
    var errorMessage = this.getErrorMessage();

    return (
      <div className='form-group'>
        <label htmlFor={this.props.name}>{this.props.title}</label>
        <input type={this.props.type || 'text' }
               name={this.props.name}
               onChange={this.changeValue}
               value={this.getValue()}
               checked={this.props.type ==='checkbox' && this.getValue() ? 'checked' : null} />
        <span className='validation-error'>{errorMessage}</span>
      </div>
    );
  }
});

module.exports = MyInput;
var React=require('React');
var Formsy=要求('Formsy-react');
var Mixin=Formsy.Mixin;
var MyInput=React.createClass({
//添加Formsy Mixin
mixins:[mixins],
//setValue()将设置组件的值,该值在
//turn将验证它和表单的其余部分
changeValue:函数(事件){
this.setValue(event.currentTarget[this.props.type==='checkbox'?'checked':'value']);
},
render:function(){
//根据验证设置特定的类名
//此组件的状态。showRequired()为true
//当值为空且所需的道具为
//当
//键入的值无效
var className=this.props.className+''+(this.showRequired()?“required”:this.showRor()?“error”:null);
//仅当组件无效时,才会返回错误消息
//或者服务器返回了错误消息
var errorMessage=this.getErrorMessage();
返回(
{this.props.title}
{errorMessage}
);
}
});
module.exports=MyInput;
我正在使用Browserify来遵从JSX,如果这有区别的话


有人知道这是从哪里来的吗?

您使用的是什么版本的
react
formsy react
?当您从无效的组件类创建元素时,通常会发生此错误,例如当未定义MyComponent时执行
。formsy react的值为0.17.0,react的值为0.14.0。我我已设法将异常移到“React.createElement:类型不应为null、未定义、布尔或数字”,这似乎与formsy类有关。