@@ -442,8 +442,11 @@ const App: () => React$Node = () => {
442
442
// (you can use "base64"(refer to the library 'mathiasbynens/base64') APIs to make one).
443
443
// The data will be converted to "byte array"(say, blob) before request sent.
444
444
} , "Waka Flacka Flame goes very well with Thomas the Tank Engine." )
445
+ . uploadProgress ( ( received , total ) => {
446
+ console . log ( 'upload progress' , received / total )
447
+ } )
445
448
. progress ( ( received , total ) => {
446
- console . log ( 'progress' , received / total )
449
+ console . log ( 'download progress' , received / total )
447
450
} )
448
451
. then ( ( res ) => {
449
452
console . log ( res . text ( ) ) ;
@@ -458,8 +461,6 @@ const App: () => React$Node = () => {
458
461
RNFetchBlob . config ( {
459
462
// add this option that makes response data to be stored as a file,
460
463
// this is much more performant.
461
- Progress : { count : 10 , interval : 10 } ,
462
- UploadProgress : { count : 10 , interval : 10 } ,
463
464
fileCache : true ,
464
465
} ) . fetch ( 'POST' , 'https://enb954aqyumba.x.pipedream.net/' , {
465
466
Authorization : "Bearer access-token" ,
@@ -478,12 +479,14 @@ const App: () => React$Node = () => {
478
479
mail : 'example@example.com' ,
479
480
tel : '12345678'
480
481
} ) } ,
481
- ] ) . progress ( ( received , total ) => {
482
- console . log ( 'progress' , received / total )
482
+ ] ) . uploadProgress ( { interval : 250 } , ( written , total ) => {
483
+ console . log ( 'uploaded' , written / total )
484
+ } ) . progress ( { count : 10 , interval : - 1 } , ( received , total ) => {
485
+ console . log ( 'progress' , received / total )
483
486
} ) . then ( ( res ) => {
484
- console . log ( res . text ( ) ) ;
487
+ console . log ( res . text ( ) ) ;
485
488
} ) . catch ( ( err ) => {
486
- // error handling ..
489
+ console . log ( err . text ( ) ) ;
487
490
} )
488
491
}
489
492
@@ -890,12 +893,6 @@ const App: () => React$Node = () => {
890
893
{ "FetchBlobTest" }
891
894
</ Text >
892
895
< View style = { styles . sectionDescription } >
893
- < TextInput style = { styles . input }
894
- placeholder = "Source path"
895
- onChangeText = { readStreamParam => setReadStreamParam ( readStreamParam ) }
896
- placeholderTextColor = "#9a73ef"
897
- autoCapitalize = "none"
898
- />
899
896
</ View >
900
897
< Button
901
898
title = "Attempt Fetch"
0 commit comments