I have a React Native App that uses WebView to render an HTML page from the assets. The page has some javascript that does some processing. The problem is that I cannot see the console.log
statements from the web view. I have tried the Chrome Remote Remote Debugging WebViews
Here's how the code looks like. Note that for Android, I am trying to supply some native props to enable debugging.
import React from 'react';
import Expo from 'expo';
import { WebView } from 'react-native';
export default class App extends React.Component {
render() {
const htmlURL = Expo.Asset.fromModule(require('./assets/index.html')).uri;
return (
<WebView nativeConfig={{props: {webContentsDebuggingEnabled: true}}}
source={{uri: htmlURL}} />
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Any ideas around how that might work will be highly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…