Skip to content

bogdan-vol/RNDownload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RNDownload

Download functionality, based on react-native-background-downloader. All downloads are serial because of some issues on iOS with parallel download.

List of changes:

  • Styles
  • Progress event
  • Network handling
  • Wrapped resume functionality
  • Custom download button with progress
  • Whole lesson download (text, media, resources, comments)

Libraries used

Installation

npm i --save https://github.com/bogdan-vol/RNDownload.git

Add podspecs to your Podfile then pod install

Inside AppDelegate.m:

...
#import <RNBackgroundDownloader.h>
...
- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler
{
  [RNBackgroundDownloader setCompletionHandlerWithIdentifier:identifier completionHandler:completionHandler];
}
...

Props

Download

Prop Type Required Description
iconColor string no download button icon color (default white)
textColor string no download button text color (default white)
entity object yes the entity from which the library automatically extracts downloadable content (images, media etc) and plain text and downloads them
additionalData object no additional data to be downloaded (used for comments; to be changed in the future and moved into entity)
parentStyle object no touchable area style
downloadExtendedEntity func no extended entity used when downloading an entire course with special endpoint that gets all videos for all lessons (see mocks in index.js)

DownloadResources

Prop Type Required Description
resources object yes resources to be downloaded

EVENTS

Progress event

import Download from 'RNDownload';
...
Download.addProgressListener(({id, val}) => {
  //id is the downloading task id
  //val is the value in percentage of the download progress
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published