-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
引入react-native-webview后,无法正常显示,整个页面白屏 #887
Comments
这种布局问题首先都可以通过 inspector 来定位 |
inspector不在浏览器里,在开发者菜单里 https://reactnative.cn/docs/react-devtools#integration-with-react-native-inspector |
多谢,我复现了一下问题,用inspector调试,页面上一片空白没有任何元素可以选择,不过还是多谢你告诉我方法,下次碰到问题就可以用这种方式了 |
这个用于判断是组件布局问题,还是组件内部问题,具体到你这里就是是这个元素压根都没有预期的宽高呢,还是页面有了预期的宽高,但内部渲染不对 |
doctor的输出不准确也不重要,不必在意 |
import {StyleSheet, Text, View} from 'react-native';
import React from 'react';
import {WebView} from 'react-native-webview';
export default function index() {
return (
<WebView
source={{
uri: 'https://h5.dolilive.com/doli-h5-page/dev/20/index.html#/weeklyStar',
}}
scalesPageToFit={true}
allowsInlineMediaPlayback={true}
onLoadStart={() => {
console.log('WebView加载开始');
}}
onLoadEnd={() => {
console.log('WebView加载结束');
}}
style={{borderWidth: 1, borderColor: 'red', width: 100, height: 100}}
/>
);
}
const styles = StyleSheet.create({});
两个回调都可以正常执行,但页面是白屏
日志如下: LOG Running "rn_first_project" with {"rootTag":31}
LOG WebView加载开始
LOG WebView加载结束
这是页面:
The text was updated successfully, but these errors were encountered: