1.0.8 • Published 10 months ago

@witpranav/react-native-photo-picker v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

react-native-photo-picker

Getting started

$ npm install @witpranav/react-native-photo-picker

Note

  • This module works only for android at the moment.

How it works

-- This module uses the new PhotoPicker API introduced in Android 11.

-- Since this API is backported, the module also works with previous versions of Android.

Usage

  • Goto app level build.gradle in android/app/build.gradle and add the following block at the end of the file.
configurations.implementation {
    exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}

-- If backported photo picker support is needed as well, insert the following entry inside the application tag in your apps manifest file

<service android:name="com.google.android.gms.metadata.ModuleDependencies"
         android:enabled="false"
         android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
    </intent-filter>
    <meta-data android:name="photopicker_activity:0:required" android:value="" />
</service>

-- Javascript

import {launchPhotoPicker, StatusConstants} from '@witpranav/react-native-photo-picker';

launchPhotoPicker(
    {
    mediaType: 'ImageAndVideo', //optional prop; possible values can be ImageAndVideo, ImageOnly, VideoOnly; defaults to ImageAndVideo
    multipleMedia: true, //optional prop; defaults to false
    mimeType: "image/gif" //optional prop;
    },
    (res: any) => {
      if (res.status === StatusConstants.STATUS_CANCELLED) {
        //process cancelled res.error
      }
      if (res.status === StatusConstants.STATUS_SUCCESS) {
        // process success res.uris
      }
      if (res.status === StatusConstants.STATUS_ERROR) {
        // process error res.error
      }
    },
  );

-- More information on mimetypes here.

TODO

  • Add Persist Media File Permission.
  • Convert to Fabric
  • Add count limit to files
  • ???
1.0.8

10 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago