我正在与React Native elements searchbar一起工作,努力让顶部和底部的这两条小线条消失——我不知道它们是什么:

Weirdly formatted Searchbar image here

这是我的搜索条形码:

    <SearchBar placeholder="Search contacts..." 
        data={this.state.searchResultFriendsList}
        ref={(ref) => this.searchBar = ref}
        style= {styles.searchbar} 
        lightTheme round 
        containerStyle={styles.searchcontainer}
    />

以下是我的两个风格片段:

searchcontainer: {
    backgroundColor: 'white',
    borderWidth: 0, //no effect
    shadowColor: 'white', //no effect
},
searchbar: {
    width: "100%",
    backgroundColor: 'red', //no effect
    borderWidth:0, //no effect
    shadowColor: 'white', //no effect
},

如果我将主题从lightTheme改为默认值,线条会变成深灰色,因此我知道它与SearchBar元素本身有关,但无法通过更改边框或阴影来消除它.

想知道以前是否有人经历过类似的事情,提前谢谢!

推荐答案

borderBottomColorborderTopColor用作transparentsearchcontainer

searchcontainer: {
 backgroundColor: 'white',
 borderWidth: 0, //no effect
 shadowColor: 'white', //no effect
 borderBottomColor: 'transparent',
 borderTopColor: 'transparent'
}

希望这能有所帮助

React-native相关问答推荐

在第二次加载时仅将本机应用程序设置为状态

React Native 无法下载模板

React native + react-query + onError 不捕获并处理错误?

TextInput 中的大写文本 - react native

No component found for view with name "ARTShape"

React Native TextInput 没有获得焦点

如何更改 React Native(android)应用程序的远程推送通知图标

使用react native获取设备令牌

未找到 xcode 'boost/config/user.hpp' 文件

React Native 有全局作用scope域吗?如果没有,我该如何模仿它?

ld:找不到-lFirebaseCore clang的库: error: linker command failed with exit code 1 (use -v to see invocation)

元素中缺少main.jsbundle、Foundation和Security,导致报错

react native图像不适用于特定 URL

使用 applicationIdSuffix 时 React Native 应用程序不会启动

如何在 React Native 上获取设备的 ip?

如何将 BuildConfig 值传递给依赖模块?

react-native-webview :对于 iOS 文本太小

无法运行 jetifier React Native

Gradlew bundleRelease 不会在 react-native 中生成发布 apk

为什么 this.state 在react-native中未定义?