问题描述
当我尝试在 Text 元素上使用 'textAlignVertical' 样式时,我收到一条错误消息,指出textAlignVertical"不是有效的样式属性.我检查了文档,它说我应该能够使用这个样式属性:https://facebook.github.io/react-native/docs/text.html
I am getting an error saying "textAlignVertical" is not a valid style property when attempting to use the 'textAlignVertical' style on a Text element. I've checked the documentation and it says I should be able to use this style property: https://facebook.github.io/react-native/docs/text.html
有其他人遇到过这个问题吗?
has anyone else had this issue?
推荐答案
textAlignVertical
样式是 Android 独有的属性.如果您在 iOS 上进行开发,请尝试使用 flexbox 对齐属性 alignItems: center
代替.
The textAlignVertical
style is an Android-only property. If you are developing on iOS, try using the flexbox alignment property alignItems: center
instead.
textAlignVertical
属性似乎也从 TextInput
属性移到了 Text
元素样式,只有 三天前,并将在 React Native 0.19 中发布.
It also appears that the textAlignVertical
property was moved from TextInput
properties to the Text
element styles only three days ago, and is going to be released in React Native 0.19.
我不确定 React Native 文档是如何生成的,但基于我对这个的阅读 commit diff,文档似乎比最新发布的版本早.
I am not sure how the React Native documentation is generated, but based on my reading of this commit diff, the documentation appears to be ahead of the latest released version.
这篇关于“textAlignVertical"不是有效的样式属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!