eloew / NativePhoto

React Native Photo, Video, & Camera using Native Modules (work in progress)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Implementaion

Open React Native android project in android studio

Copy PhotoModule.java and PhotoPackage.java to your project.

Open MainApplication.java

Add "new PhotoPackage()" line to the getPackages methoid:

@Override protected List getPackages() { return Arrays.asList( new MainReactPackage(), new PhotoPackage() ); }

Open AndroidManifest.xml Add permisions and features.

...

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

...

iOS implementation

open ios .xcodeproj

Add PhotoUtil.m & PotoUtil.h to the xcode project

Righ click info.plist > Open As > Source Code

Add the below usage descriptions:

<plist version="1.0">
<dict>
  <key>NSPhotoLibraryUsageDescription</key>
  <string>Access to photo library to add pictures</string>
  <key>NSCameraUsageDescription</key>
  <string>Access to camera to take pictures and videos</string>

#React Native Implementation

See App.js.

TODO

iOS Camera needs to be finished

Android & iOS Video

About

React Native Photo, Video, & Camera using Native Modules (work in progress)


Languages

Language:Java 56.6%Language:Objective-C 28.2%Language:JavaScript 11.3%Language:Python 3.9%