How to use react-native-webview - 5 common examples

To help you get started, we’ve selected a few react-native-webview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / react-native-webview_v5.x.x / flow_v0.88.x- / test_react-native-webview.js View on Github external
describe('WebView methods', () => {
  const instanceWebView = new WebView({});

  it('should passes when use properly', () => {
    WebView.extraNativeComponentConfig();

    (instanceWebView.goBack(): void);
    (instanceWebView.goForward(): void);
    (instanceWebView.reload(): void);
    (instanceWebView.stopLoading(): void);
    (instanceWebView.injectJavaScript('alert(1);'): void);
  });

  it('should raises an error when call injectJavaScript without arguments', () => {
    // $ExpectError: first argument is required
    instanceWebView.injectJavaScript();
  });
github flow-typed / flow-typed / definitions / npm / react-native-webview_v5.x.x / flow_v0.88.x- / test_react-native-webview.js View on Github external
it('should passes when use properly', () => {
    WebView.extraNativeComponentConfig();

    (instanceWebView.goBack(): void);
    (instanceWebView.goForward(): void);
    (instanceWebView.reload(): void);
    (instanceWebView.stopLoading(): void);
    (instanceWebView.injectJavaScript('alert(1);'): void);
  });
github jarden-digital / react-native-recaptchav3 / dist / src / ReCaptchaComponent.js View on Github external
render() {
        return React.createElement(react_native_1.View, { style: { flex: 0.0001, width: 0, height: 0 } },
            React.createElement(react_native_webview_1.WebView, { ref: (ref) => {
                    this._webViewRef = ref;
                }, javaScriptEnabled: true, originWhitelist: ['about:blank'], automaticallyAdjustContentInsets: true, mixedContentMode: 'always', injectedJavaScript: patchPostMessageJsCode, source: {
                    html: getInvisibleRecaptchaContent(this.props.siteKey),
                    baseUrl: this.props.captchaDomain
                }, onMessage: (e) => {
                    this.props.onReceiveToken(e.nativeEvent.data);
                } }));
    }
}
github RangerMauve / datmobile / react-native-protocol-webview / index.js View on Github external
}

	__dispatchCommand(commandName, args) {
		const ref = this.webViewRef.current.webViewRef.current
		UIManager.dispatchViewManagerCommand(
			ReactNative.findNodeHandle(ref),
			UIManager.getViewManagerConfig('ProtocolWebView').Commands[commandName],
			args,
		);
	}
}

const ProtocolWebViewNative = requireNativeComponent(
	'ProtocolWebView',
	ProtocolWebView,
	WebView.extraNativeComponentConfig
);
github RangerMauve / datmobile / react-native-protocol-webview / index.js View on Github external
import React, { Component } from 'react'
import ReactNative, { UIManager, requireNativeComponent } from 'react-native'

import { WebView } from 'react-native-webview'

export class ProtocolWebView extends Component {
	static propTypes = WebView.propTypes;

	static protocolHandlers = {};

	static registerStreamProtocol = (scheme, handler, completion) => {
		ProtocolWebView.protocolHandlers[scheme] = (url, method, id, webview) => {
			handler({url, method}, (response) => {
				let stream = response;
				let mimeType = response.mimeType;
				if(response.data) {
					stream = response.data
				}

				if(!mimeType) {
					mimeType = stream.mimeType
				}

react-native-webview

React Native WebView component for iOS, Android, macOS, and Windows

MIT
Latest version published 1 month ago

Package Health Score

95 / 100
Full package analysis