From 9b9f90e751d38ff36267b730ff16f800a083c10e Mon Sep 17 00:00:00 2001 From: tkow Date: Mon, 29 Jul 2019 15:25:03 +0900 Subject: [PATCH] add fetch example --- example/App.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/example/App.js b/example/App.js index 7f88a9e5..6fdcb591 100644 --- a/example/App.js +++ b/example/App.js @@ -7,7 +7,7 @@ */ import React, { Fragment } from 'react'; -import { Button, SafeAreaView, StatusBar } from 'react-native'; +import { Button, SafeAreaView, StatusBar,Platform } from 'react-native'; import DocumentPicker from '../' @@ -30,7 +30,15 @@ const App = () => { res.name, res.size ); + if(Platform.OS==='android' && res.uri && res.uri.startsWith('content://')) { + const uri = decodeURIComponent(res.uri) + let result = await fetch(res.uri) + const blob = await result.blob() + console.log(blob); + console.log(result) + } } catch (err) { + console.error(err) if (DocumentPicker.isCancel(err)) { // User cancelled the picker, exit any dialogs or menus and move on } else {