如何在 React Native Elements 中将 SearchBar 居中

How to center a SearchBar in React Native Elements

我是 React Native 的新手,正在使用 React Native Elements 为我正在创建的应用构建 UI。我的问题是我似乎无法将搜索栏放在屏幕中间。有没有我缺少的道具或东西。

您可以为 containerStyle 添加 样式 SearchBar

道具
<View styles={{ flex:1 }}>
   <SearchBar
      placeholder="Type Here..."
      onChangeText={this.updateSearch}
      value={search}
      containerStyle = {{ alignItems:'center', justifyContent:'center' }}
   />
</View>