react-native - 如何使用 React native 显示搜索栏的边框线
问题描述
我需要显示边框线,但这里只能看到侧面,顶部和底部是空白的
我已经使用反应原生元素尝试过这 是我想要实现的 这是我用这段代码得到的
<SearchBar
round
lightTheme
icon={{ type: 'font-awesome', name: 'search' }}
placeholder="Buscar producto..."
platform="ios"
containerStyle={{
backgroundColor: 'transparent',
}}
inputStyle={{ backgroundColor: 'white' }}
/>
解决方案
首先,您必须找到可以SearchBar
让您访问的道具是您想要的道具。inputStyle
只设置TextInput
组件的样式,而containerStyle
设置整个大的样式SearchBar
(其中有一些额外的填充和我们不想要的东西)。
您想要的道具inputContainerStyle
将围绕容器设置样式TextInput
以及左右两侧的位。因此,要给出边界,您可以简单地执行以下操作:
<SearchBar
round
lightTheme
icon={{ type: 'font-awesome', name: 'search' }}
placeholder="Buscar producto..."
platform="ios"
inputContainerStyle={{
backgroundColor: 'white',
borderColor: 'grey',
borderWidth: 1
}}
/>
推荐阅读
- google-cloud-firestore - 如何检查 int 字段是否存在于 firebase
- java - gradle中的条件依赖
- http-status-code-404 - Symfony 4 - api 平台 - jwt - 自定义操作和控制器
- powerbi - 通过传递度量或参数创建计算表
- javascript - firebase 部署错误:“解析函数触发器时发生错误”
- scala - 如何从与正则表达式匹配的火花数据框中删除行
- web - 带有 X509 证书 + 智能卡的 Web 签名
- linux - Magento2 的 Ubuntu 网络服务器权限设置
- mongodb - 我可以通过 id 更新 mongodb 的现有记录吗?
- angular - 如何在角度 5 中获取语言环境的所有短日期格式