Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}