如何像打开电报一样-链接上的Webview单击-React Native

问题描述 投票:0回答:1

我正在打开带有自定义标头的Webview,但是我想像在点击链接后在Telegram上那样打开一个像Intent这样的Android:

import React, { PureComponent } from 'react';
import { View } from 'flockby-ui-kit';
import { WebView } from 'react-native-webview';
import { get, round } from 'lodash';
import Header from './Header';
import ProgressBar from './ProgressBar';

export default class Browser extends PureComponent {
  state = {
    progressStatus: 0,
  };
  render() {
    const { progressStatus } = this.state;
    const { navigation } = this.props;
    const { item } = navigation.state.params;
    const { link } = item;
    return (
      <View f={1} style={{ flex: 1 }}>
        <Header item={item} nav={navigation} />
        <ProgressBar progressStatus={progressStatus} />
        <WebView
          ref={webview => (this._webview = webview)}
          source={{ uri: link }}
          onLoadProgress={({ nativeEvent }) => {
            this.setState({
              progressStatus: round(get(nativeEvent, 'progress', 0), 2) * 100,
            });
          }}
        />
      </View>
    );
  }
}

附加相同的gif。enter image description here

或类似Gmail的内容:

enter image description here

我想要实现的是在新的应用程序窗口中打开WebvView

android react-native webview react-native-android
1个回答
0
投票

使用https://github.com/proyecto26/react-native-inappbrowser打开应用程序内浏览器,而无需离开应用程序并切换到浏览器。

© www.soinside.com 2019 - 2024. All rights reserved.