not able to download blob url content in react native webview

Viewed 539

I am fresher and I am facing issue to handling the blob url while downloading the files in react native webview npm. I am not receiving blob url on the js file so i an not able to convert it base64 please help me solve this!.

const onMessage = payload => {
console.log('payload',payload);
let dataPayload;

try {
  dataPayload = JSON.parse(payload.nativeEvent.data);
} catch (e) {}


 //    else if (dataPayload.data.startsWith("blob")) {
 //     const reader = new FileReader();
// reader.readAsDataURL(payload);
// console.log('===reader', reader)
// return new Promise(resolve => {
//   reader.onloadend = () => {
//     resolve(reader.result);
//   };
// });
 //   }
 };

<WebView
ref={maiNWebView}
renderLoading={LoadingIndicatorView}
startInLoadingState={true}
allowUniversalAccessFromFileURLs={true}
jvaScriptEnabled={true}
setSupportMultipleWindows={true}
javaScriptCanOpenWindowsAutomatically={true}
domStorageEnabled={true}
allowFileAccess={true}
androidHardwareAccelerationDisabled={true}
allowUniversalAccessFromFileURLs={true}
originWhitelist={['http://*', 'https://*', 'intent://*', 'blob:']}
onNavigationStateChange={onShouldStartLoadWithRequest1}
onFileDownload={({nativeEvent}) => {
const {downloadUrl} = nativeEvent;
console.log('onFileDownload', nativeEvent);
}}
onMessage={onMessage}
  
      />
0 Answers
Related