Webview 正在查找用户可以忽略的React Native弹出Web视图(Android)
我需要打开一个用户可以轻松忽略的web视图。Webview 正在查找用户可以忽略的React Native弹出Web视图(Android),webview,react-native,Webview,React Native,我需要打开一个用户可以轻松忽略的web视图。 它应该能够显示一个给定的URL,并且有一个易于关闭的选项(如x按钮)——还应该显示导航按钮 我查了一下,但找不到类似的东西。您可以使用带有视图包装器的React Native WebView组件来实现它。创建自己的MyWebView组件,如下所示: class MyWebview extends React.Component{ constructor(props, context) { super(props); this.go
它应该能够显示一个给定的URL,并且有一个易于关闭的选项(如x按钮)——还应该显示导航按钮
我查了一下,但找不到类似的东西。您可以使用带有视图包装器的React Native WebView组件来实现它。创建自己的MyWebView组件,如下所示:
class MyWebview extends React.Component{
constructor(props, context) {
super(props);
this.goBack = this.goBack.bind(this);
}
goBack() {
this.props.navigator.pop();
}
render() {
if (!this.props) {
return null;
}else{
return (
<View style={[GlobalStyle.container, style.container]}>
<NavigationBar />
<WebView
startInLoadingState={true}
source={{uri: this.props.route.url}}
/>
</View>
);
}
}
}
MyWebview.propTypes = {
navigator: PropTypes.object,
route: PropTypes.object
};
export default MyWebview;
试试这个
这对我来说真的很有效
let passObj = Object.assign({}, Routes.MyWebview, {
url: url
});
this.props.navigator.push(passObj);