gpt4 book ai didi

React-Native WebView 打开 Google Docs 移除 header

转载 作者:行者123 更新时间:2023-12-02 02:44:38 24 4
gpt4 key购买 nike

在 WebView 中启动 Google 文档时我想禁用 Google 文档标题。当我使用 Swift 编码时,我不得不禁用 JavaScript。所以我尝试了同样的方法,但它不起作用。如何从 React-Native WebView 中删除 Google Docs 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;

https://snack.expo.io/r1mBAV-64

最佳答案

问题是javaScriptEnabled不适用于IOS。

您可以修改 react-native-webview 以便应用 javaScriptEnabled

https://github.com/aksmfosef11/react-native-webview/tree/add-javascriptEnabled-in-IOS

此功能也已添加到 master 中。获取

https://github.com/react-native-community/react-native-webview

关于React-Native WebView 打开 Google Docs 移除 header,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56234817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com