React Native AWS S3
A React Native wrapper for AWS iOS/Android S3 SDK.
We currently implements TransferUtility
, it allow you to upload / download tasks in the background, very suitable for transferring large files, you can freely subscribe / unsubscribe, pause / resume / cancel the task.
See iOS/Android docs for more information.
Known issues
- Currently reload js will lead TransferUtility not work. (#9)
Installation
$ npm install react-native-s3 --save
Setup
iOS
NOTE Only supported iOS ^8.0.
In XCode, in the project navigator:
- Right click
Libraries
➜Add Files to [your project's name]
, Addnode_modules/react-native-s3/ios/RNS3.xcodeproj
. - Add
libRNS3.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Add
$(SRCROOT)/../node_modules/react-native-s3/ios
toHeader Search Paths
, and mark it asrecursive
. - Add
$(SRCROOT)/../node_modules/react-native-s3/ios/Frameworks
to your project'sBuild Settings
➜Framework Search Paths
- Add
node_modules/react-native-s3/ios/Frameworks/*.framework
to your project'sGeneral
➜Embedded Binaries
- Edit
AppDelegate.m
of your project
...... - (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler
- [Optional] you can set the credentials in
AppDelegate.m
...... - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Android
- Edit
android/settings.gradle
of your project:
...include ':react-native-s3'project(':react-native-s3').projectDir = new File(settingsDir, '../node_modules/react-native-s3/android')
- Edit
android/app/build.gradle
of your project:
...dependencies { ... compile project(':react-native-s3')}
- Add package to
MainApplication.java
...... // import
You can use rnpm instead of above steps.
- Edit
android/app/src/main/AndroidManifest.xml
of your project:
- [Optional] you can set the credentials in
MainActivity.java
:
nativeCredentialsOptions
type
The BASIC
COGNITO
Usage
;
See API.md for more information.
Alternatives
- react-native-aws3 - if you don't need the native library provided background upload/download task features.