HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – React Native WebView在底部渲染意外边框大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这有点难以描述.我正在使用React本机WebView组件来制作迷你浏览器.它工作正常,但它底部一个奇怪的黑色边框,我没有放入.它在滚动到或超出网页底部时出现.

您可以在下面的“blah”文本上方看到细黑线. blah文本和底部粉红色部分的原因是在WebView或其容器上排除了一个迷路borderBottom *样式.

另外需要注意的是,重新加载页面时边框会短暂消失,因此它似乎在WebView的html中.但我不明白如何或为什么,因为a)它出现在所有网站上,b)它没有出现在其他iOS浏览器中.

在这做什么奇怪的事吗?

截图:

元素和风格:

<View style={styles.container as any}>
    <View style={styles.header as any}>
      {this.addressbarButtonProps().map(props => React.createElement(Button,{ ...props,key: props.title }))}
      <TexTinput
        ref={ADDRESSBAR_REF}
        placeholder="type url"
        style={{ minWidth: this.screenWidth - 50 * this.addressbarButtonProps().filter(b => !b.hidden).length - 10 }}
        />
    </View>
    <WebView
      ref={WEBVIEW_REF}
      source={{uri: this.state.uri}}
      style={{ ...styles.web,width: this.screenWidth,paddingBottom: 0,padding: 0 }}
      scalesPageToFit={truE}
      allowsInlineMediaPlayBACk={truE}
      onmessage={m => this.onmessage(m.nativeEvent.data)}
      injectedJavaScript={js}
      starTinLoadingState={truE}
    />
    <Text style={{ borderTopWidth:20,borderTopColor: "red" }}>blah</Text>
  </View>

const styles = {
  container: {
    paddingTop: 20,flex: 1,alignItems: "center",justifyContent: "space-between",BACkgroundColor: "#fafafa",borderBottomcatolor: "pink",borderBottomWidth: 100
  },header: {
    flexDirection: "row",alignItems: "flex-start",justifyContent: "flex-start",alignSelf: "stretch"
  },web: {
    flex: 1,borderBottomcatolor: "#fafafa",BACkgroundColor: "#fafafa"
  }
}

解决方法

将WebView的BACkgroundColor设置为透明,不会呈现“边框”.
<Webview style={{BACkgroundColor: 'transparent'}} .../>

大佬总结

以上是大佬教程为你收集整理的ios – React Native WebView在底部渲染意外边框全部内容,希望文章能够帮你解决ios – React Native WebView在底部渲染意外边框所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。