我需要显示边框线,但这里只能看到侧面,顶部和底部都是空白的
我已经使用反应本机元素尝试过这个这是我想要实现的目标 这是我通过此代码得到的
<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
}}
/>