React native React Native WebView打开Google文档删除标题
在WebView中启动Google文档时 我想禁用Google文档标题。 当我使用Swift编码时,我不得不禁用JavaScript。 所以我尝试了同样的方法,但不起作用。 如何从React Native WebView中删除Google文档标题React native React Native WebView打开Google文档删除标题,react-native,react-native-webview,React Native,React Native Webview,在WebView中启动Google文档时 我想禁用Google文档标题。 当我使用Swift编码时,我不得不禁用JavaScript。 所以我尝试了同样的方法,但不起作用。 如何从React Native WebView中删除Google文档标题 import React, { Component } from 'react'; import { StyleSheet,View,WebView } from 'react-native'; import { Container, Header
import React, { Component } from 'react';
import { StyleSheet,View,WebView } from 'react-native';
import {
Container, Header, Left, Button, Icon, Content,Text
} from 'native-base';
const styles = StyleSheet.create({
wrapper: {
justifyContent: 'center',
flexDirection: 'column',
flex: 1,
},
});
class WebViewContainer extends Component {
render() {
return (
<View style={styles.wrapper}>
<Container>
<Header />
<Content scrollEnabled={false} contentContainerStyle={styles.wrapper}>
<Text>text</Text>
<WebView
injectedJavaScript={false}
javaScriptEnabled={false}
originWhitelist={['*']}
source={{ uri: 'https://docs.google.com/document/d/1VyuUU550TtZNMpX31z9lRSrYFABkthLXi-4qfheq4GU/edit?usp=sharing' }}
/>
<Text>text</Text>
</Content>
</Container>
</View>
);
}
}
export default WebViewContainer;
import React,{Component}来自'React';
从“react native”导入{StyleSheet,View,WebView};
进口{
容器、标题、左侧、按钮、图标、内容、文本
}来自“本土基地”;
const styles=StyleSheet.create({
包装器:{
为内容辩护:“中心”,
flexDirection:'列',
弹性:1,
},
});
类WebViewContainer扩展组件{
render(){
返回(
文本
文本
);
}
}
导出默认WebViewContainer;
问题在于
javaScriptEnabled
不适用于IOS
您可以修改react native webview
,以便应用javaScriptEnabled
此功能也已添加到主控形状中。得到
使用
injectedJavascript
将自定义JavaScript注入WebView
并使用它删除标题