Я пытаюсь использовать webview, чтобы открыть браузер внутри собственного приложения.
У меня есть следующий компонент:
import React from 'react';
import {
StyleSheet,
View,
Text,
Platform,
ScrollView,
WebView
} from 'react-native';
export default class Browser extends React.Component {
render() {
var DEFAULT_URL = 'https://github.com/facebook/react-native';
return (
<View style={{flex:1}}>
<WebView
automaticallyAdjustContentInsets={false}
source={{uri: DEFAULT_URL}}
javaScriptEnabled={true}
domStorageEnabled={true}
decelerationRate="normal"
startInLoadingState={true}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'space-between',
},
});
Я могу получитьGitHub открыт в Android и IOS, но с отсутствующими стилями CSS.
Но когда я делаю DEFAULT_URL
до https://www.google.com
, это дает мне следующую ошибку:
NSURLErrorDomain
Error Code: -1202
Description: The certificate for this server is invalid. You might be connecting to a server that is pretending to be "www.google.com" which could put your confidential information at risk
IМожно открыть это в Safari с помощью Linking.openURL, но было бы неплохо, если бы что-то открывалось в браузере в самом приложении.
Есть идеи, почему это может происходить или как это можно решить?Заранее спасибо за помощь ..