我无法将这个简单的js代码注入到反应原生的webview中.
import React, { Component } from 'react';
import { Platform,
StyleSheet,
Text,
View,
WebView
} from 'react-native';
export default class App extends Component<{}> {
injectjs(){
let jsCode = 'alert(hello)';
return jsCode;
}
render() {
return <WebView
javaScriptEnabled={true}
injectedJavaScript={this.injectjs()}
source={{uri:"https://www.google.com"}} style={{ marginTop: 20 }} />;
}
}
Run Code Online (Sandbox Code Playgroud) 下面的代码是从Google日历Api部分的node.js快速入门中粘贴的。此代码无法从google API的auth中访问。我复制了以下错误。要查看完整的代码,您可以访问此链接。谢谢。
const google = require('googleapis');
const OAuth2Client = google.auth.OAuth2;
Run Code Online (Sandbox Code Playgroud)
错误看起来像这样:
const OAuth2Client = google.auth.OAuth2; ^
TypeError:无法读取未定义的属性“ OAuth2”