React原生TextInput边界不起作用



以下是我的输入风格:

 searchBarInput: {
  flex: 1,
  fontSize: 20,
  fontWeight: 'bold',
  color: 'white',
  height: 50,
  padding: 0,
  backgroundColor: 'transparent',
  borderColor: '#000000', 
  borderWidth: 50,  
  borderStyle: 'solid',
 }

如果我更改边框宽度,输入的大小也会更改,但仍然没有可见的边框。

我使用的是带有安卓设备的react native 0.15.0。

这是否回答了您的问题:https://github.com/facebook/react-native/blob/master/docs/KnownIssues.md#text-输入边界

这似乎是react native的一个已知错误。。。

您可以尝试将其包裹在视图组件中,并在视图组件上设置所需的边框。

根据react原生文档,您需要在文本输入属性中设置以下内容:

multiline={true}

现在通过underlineColorAndroid="transparent" 在Android上修复了这一问题

来源:https://facebook.github.io/react-native/releases/0.26/docs/known-issues.html#text-输入边界(存档)

最新更新