标签: tcomb

如何避免reactjs被包含在rails和reactjs环境中两次?

我正在使用react-rails和browserify.在我使用的application.js中

// require react
// require react-ujs
Run Code Online (Sandbox Code Playgroud)

我也使用tcomb-form

var t=require("tcomb-form")
Run Code Online (Sandbox Code Playgroud)

结果我看到reactjs在我的资产管道中被包含两次.

我应该如何正确使用reactjs与rails?

编辑:

顺便说一句,如果您在控制台中看到此错误,可能您遇到的问题是reactjs被包含两次.

[Error] Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created inside of another component's render method). Try rendering this component inside of a new top-level component which will hold the ref.
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails reactjs tcomb

6
推荐指数
1
解决办法
620
查看次数

如何使用tcomb-form-native向字段添加电子邮件验证?

使用带有反应原生的tcomb-form-native库 - 我将keyboardType设置为email-address.如何在表单中添加正则表达式或电子邮件验证程序?我是否必须在提交函数上执行此操作(并抛出一个特殊错误?)或者是否可以使用库设置正则表达式验证字段?

我注意到tcomb-validation https://github.com/gcanti/tcomb-validationlibrary有一个RegExp类型字段 - 但我没有看到任何如何使用它的例子.显示的示例似乎测试字段是否是正则表达式模式,这是一个令人困惑的用例,因为您通常希望针对正则表达式模式测试字段,而不是将正则表达式模式输入字段.

javascript validation react-native tcomb tcomb-form-native

6
推荐指数
1
解决办法
2578
查看次数