如何在 react-native-element 中获得这种搜索栏样式?

Che*_*tan 5 styles stylesheet react-native

它基本上是来自 react-native-element 的搜索栏组件,其中容器背景颜色为白色,占位符字段具有带半径的边框。

不确定 react-native-element 是否允许为占位符提供样式。我可以使用 style 和 react-native-elements 搜索栏组件的任何其他方式来获得这个结果吗?

在此处输入图片说明

Pri*_*dya 16

您需要修改inputcontainer样式

 <SearchBar
    inputStyle={{backgroundColor: 'white'}}
    containerStyle={{backgroundColor: 'white', borderWidth: 1, borderRadius: 5}}
    placeholderTextColor={'#g5g5g5'}
    placeholder={'Pritish Vaidya'}
/>
Run Code Online (Sandbox Code Playgroud)

查看文档以获取更多道具,您可以提供自己的道具Icon

  • 你必须添加“inputContainerStyle={{backgroundColor: 'white'}}”。 (4认同)