Skip to content

Vydia/ReactNativeBackgroundUploadExample

Repository files navigation

This is a React Native app and Express server that servers ars a very basic implementation of react-native-background-upload. Use this repo to experiment with the package, or fork this repo and use it to create a minimal reproduction of a bug or other issue when opening up a github issue on react-native-background-upload.

Usage

  1. Clone the repo
  2. yarn install
  3. npm run server
  4. Run the example app react-native run-ios or react-native run-android
  5. Tap the button in the mobile app to perform an upload.

If you are running on an Android enumlator/device and uploads don't 'just work', run adb reverse tcp:3000 tcp:3000 after react-native run-android. This will allow the device to communicate with the server. Otherwise it won't work.

Important files to look at

The React Native component that allows the user to choose an image from device and upload it to the localhost server.

Note: In the iOS simulator, you can add images and videos to the camera roll by dragging and dropping files from finder onto the simulator window. In the Android emulator you can usually use the emulator camera app to take test picture.

The express server that receives the upload and writes it to file.

Common issues

  1. If your server is not getting hit adb reverse tcp:3000 tcp:3000

Working on the react-native-background-upload package

If you are using this app to make changes to the react-native-background-upload package, you'll probably need to use the react-native-background-upload package from your file system and not from npm. To do this, edit the package.json to replace the existing version from npm like so:

"react-native-background-upload": "file:../react-native-background-upload",

Remember not to push this to github because it'll work for you but nobody else.

About

Example app for react-native-background-upload

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published