我可以在视图中使用 WebView(本机反应)吗? [英] Can I use WebView inside a View (react native)?
本文介绍了我可以在视图中使用 WebView(本机反应)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 View 组件中使用 WebView 组件,用于我正在处理的本机应用程序.当我在 View 中嵌入 WebView 时,我没有看到我在 WebView 中显示的内容.这是 React Native 的预期行为吗?
I am trying to use WebView Component inside View component, for a react native application I am working on. When I embed WebView inside View, I am not seeing the content I am displaying in WebView. Is this the expected behavior with react native?
推荐答案
你应该为你的 webview 指定宽度和高度.请按以下步骤操作:
You should specify a width and height for your webview. Do it as follow:
render() {
return (
<WebView
source={{uri: 'https://github.com/facebook/react-native'}}
style={{flex: 1}} // OR style={{height: 100, width: 100}}
/>
);}
这篇关于我可以在视图中使用 WebView(本机反应)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文