【发布时间】:2021-04-20 02:48:08
【问题描述】:
我正在尝试使搜索栏在我的屏幕中居中。我正在使用 justifyContent 来尝试这样做。我总是可以使用填充来实现这一点,但我觉得我不应该这样做?我假设我错过了一些简单的东西。
我正在使用https://reactnativeelements.com/docs/searchbar/#containerstyle
非常感谢您的任何见解!
<ScrollView style={{ flex: 1, backgroundColor: '#272933', }}>
<SearchBar
placeholder="Search..."
onChangeText={this.updateSearch}
value={search}
round='true'
containerStyle={{marginTop: scale(15), backgroundColor: '#272933', borderBottomColor: 'transparent', borderTopColor: 'transparent',
display: 'flex', justifyContent: 'center'}}
inputContainerStyle={{height: scale(30), width: scale(200),justifyContent: 'center'}}
searchIcon={() => <MaterialCommunityIcons name="glass-mug-variant" size={30} color='#87909A'/>}
clearIcon= 'null'
/>
【问题讨论】:
标签: css react-native