仅将边框添加到< Text />的一侧React Native(iOS)中的组件 [英] Adding border only to the one side of the <Text/> component in React Native (iOS)
问题描述
我在 iOS 中使用React-Native的< Text />
组件时遇到了一些奇怪的问题。
I am facing something weird issue with React-Native's <Text/>
component in iOS.
我想将 borderBottomWidth
样式应用到< Text />
组件中但是它不工作。但是, borderWidth
选项工作。
I wanted to apply borderBottomWidth
style into <Text/>
component but it did NOT work. However, the borderWidth
option worked.
-
工作
<文字样式= {{borderWidth:1}}> React Native< / Text>
不工作
<文字样式= {{borderBottomWidth:1}}> React Native< / Text>
有没有办法只申请底部级别边框到< Text />
组件?
谢谢!
注意:
我知道以下提到的方法是为了达到这个目的但在我的情况下,我只需要将样式应用于 < Text />
组件。
I am aware of following mentioned approaches in order to achieve this but in my case, I required to apply the style only to the <Text/>
component.
- 我们可以尝试包装
<查看/>
到< Text />
并将borderBottomWidth
样式应用于<检视/>
。 (borderBottomWidth
适用于< View />
) - 添加这样的
< View />
就在< Text />
组件的下方,它看起来像一条线。
- We can try wrapping
<View/>
to the<Text/>
and applyborderBottomWidth
style to the<View/>
. (borderBottomWidth
works fine with<View/>
) - Adding such
<View/>
just below to the<Text/>
component which can look like a line.
推荐答案
目前无法实现。请参阅以下RN问题: https://github.com/facebook/react-native/issues / 29 和产品问题上的这张票: https://productpains.com/post/react-native/add-borderwidth-left-right-top-bottom-to-textinput-/
This isn't currently possible. See the following RN issue: https://github.com/facebook/react-native/issues/29 and this ticket on Product Pains: https://productpains.com/post/react-native/add-borderwidth-left-right-top-bottom-to-textinput-/
这篇关于仅将边框添加到< Text />的一侧React Native(iOS)中的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!