Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
697 views
in Technique[技术] by (71.8m points)

javascript - 不变违规:文本字符串必须在 <Text> 零件(Invariant Violation: Text strings must be rendered within a <Text> component)

I've upgraded from RN 0.54 to 0.57 and my app has pretty much fallen over due to using React Native Elements.(我已经从RN 0.54升级到0.57,由于使用了React Native Elements,我的应用程序已经崩溃了。)

I took use of their error functionality on TextInput components which basically enabled props that you could style the error message and set your error message.(我在TextInput组件上使用了它们的错误功能,这些功能基本上启用了支持您设置样式的错误消息并设置错误消息的道具。) Very convenient, however the upgrade has broke these and I'm now greeted with this error:(非常方便,但是升级已经打破了这些限制,现在我遇到了这个错误:) image组件内呈现。" referrerpolicy="no-referrer"> So I've delete that code and the error disappears, however I'm still receiving the issue when I run this code:(因此,我删除了该代码,错误消失了,但是运行此代码时,我仍然收到问题:) { this.state.event.cards[i].fields[j].error && <Text style={{ color: '#e74c3c', fontSize: 14, paddingLeft: 5 }}> {this.state.event.cards[i].fields[j].error} </Text> } When I begin to type in to a text input, it sets my error message to an empty string, so if an error is returned typing in the field will make the error go away.(当我开始输入文本输入时,它将错误消息设置为空字符串,因此,如果返回错误,则在该字段中键入将使错误消失。) As soon as this.state.event.cards[i].fields[j].error becomes a string, I get returned this error.(只要this.state.event.cards[i].fields[j].error变成字符串,我就会返回此错误。) However you can see I check to see if error exists, then I just display the error, or try to at least.(但是,您可以看到我检查是否存在错误,然后仅显示错误,或者至少尝试执行。) Another set of eyes would be grateful on this one.(另一组眼睛将对此表示感谢。)   ask by swonder translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...