React native React本机元素搜索栏边框线未清除
我正在努力让顶部和底部的这两条小线条消失——我不知道它们是什么: 这是我的搜索条形码:React native React本机元素搜索栏边框线未清除,react-native,React Native,我正在努力让顶部和底部的这两条小线条消失——我不知道它们是什么: 这是我的搜索条形码: <SearchBar placeholder="Search contacts..." data={this.state.searchResultFriendsList} ref={(ref) => this.searchBar = ref} style= {styles.searchbar} lightTheme ro
<SearchBar placeholder="Search contacts..."
data={this.state.searchResultFriendsList}
ref={(ref) => this.searchBar = ref}
style= {styles.searchbar}
lightTheme round
containerStyle={styles.searchcontainer}
/>
如果我将主题从lightTheme
更改为默认值,线条将变为深灰色,因此我知道它与SearchBar
元素本身有关,但无法通过更改边框或阴影来消除它
想知道是否有人曾经经历过类似的事情,提前谢谢 使用
borderBottomColor
和borderTopColor
作为透明
和searchcontainer
searchcontainer: {
backgroundColor: 'white',
borderWidth: 0, //no effect
shadowColor: 'white', //no effect
borderBottomColor: 'transparent',
borderTopColor: 'transparent'
}
希望这对react native elements的新版本有所帮助
containerStyle={{
backgroundColor:"#FBFBFB",
borderBottomColor: 'transparent',
borderTopColor: 'transparent'
}}
完整代码:
import {SearchBar} from 'react-native-elements';
<SearchBar
placeholder="Rechercher"
onChangeText={this.updateSearch}
value={search}
containerStyle={styles.searchBarContainer}
inputContainerStyle={styles.searchBarInputContainer}
inputStyle={styles.searchBarInputStyle}
leftIconContainerStyle={styles.searchBarLeftIconContainer}
rightIconContainerStyle={styles.searchBarRightIconContainer}
lightTheme
placeholderTextColor={styles.placeholderText}
round
showCancel
underlineColorAndroid={styles.placeholderText}
cancelButtonTitle
searchIcon={() => <Image source={searchIcon} style={styles.search} />}
/>
searchBarContainer: {
backgroundColor: COLORS.SEARCHBAR,
alignSelf: 'center',
flexDirection: 'row',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
alignContent: 'center',
borderBottomColor: 'transparent',
borderTopColor: 'transparent',
},
从'react native elements'导入{SearchBar};
}
/>
searchBarContainer:{
backgroundColor:COLORS.SEARCHBAR,
对齐自我:“中心”,
flexDirection:'行',
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
对齐内容:“中心”,
borderBottomColor:'透明',
borderTopColor:'透明',
},
对于希望删除这些边框的其他人,请尝试分别设置每个边框的宽度:
containerStyle={{
borderWidth: 0, //no effect
borderTopWidth: 0, //works
borderBottomWidth: 0, //works
}}
containerStyle={{
borderWidth: 0, //no effect
borderTopWidth: 0, //works
borderBottomWidth: 0, //works
}}