仅将边框添加到< Text />的一侧React Native(iOS)中的组件 [英] Adding border only to the one side of the <Text/> component in React Native (iOS)

查看:122
本文介绍了仅将边框添加到< Text />的一侧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.


  1. 我们可以尝试包装<查看/> < Text /> 并将 borderBottomWidth 样式应用于<检视/> 。 ( borderBottomWidth 适用于< View />

  2. 添加这样的< View /> 就在< Text /> 组件的下方,它看起来像一条线。

  1. We can try wrapping <View/> to the <Text/> and apply borderBottomWidth style to the <View/>. (borderBottomWidth works fine with <View/>)
  2. 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-/

这篇关于仅将边框添加到&lt; Text /&gt;的一侧React Native(iOS)中的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆