react-native-image-crop-picker

repository·master·Indexed 27 days ago

https://github.com/ivpusic/react-native-image-crop-picker

A React Native library for iOS and Android that provides access to the device's camera and photo gallery. It allows users to select single or multiple images and videos, with support for configurable compression, image cropping, and EXIF data extraction. Key functions include openPicker, openCamera, and openCropper, with utilities to clean up temporary files.

Tokens
3.6K
Snippets
12
Records
24
Agent score
91%

What's inside react-native-image-crop-picker

  1. Build and run the iOS app

    master

    To run the iOS application, you must first ensure CocoaPods dependencies are installed.

    1. If this is your first time setting up the project, install CocoaPods using Ruby bundler: bundle install

    2. Every time you update native dependencies, run: bundle exec pod install

    3. Once dependencies are installed, run the app using:

    # Using npm
    npm run ios
    
    # OR using Yarn
    yarn ios
  2. Configure iOS permissions and setup

    master

    After installing the package, follow these steps for iOS:

    1. Install Pods: Navigate to the ios directory and run pod install.
    2. Configure Info.plist: Open Info.plist in Xcode and add the following keys with descriptive values explaining why your app requires access:
      • NSPhotoLibraryUsageDescription: Required for accessing the photo library.
      • NSCameraUsageDescription: Required if you use the camera feature.
      • NSMicrophoneUsageDescription: Required if you use the microphone feature.

    Optional: Localize UI text To localize the camera, gallery, or cropper text buttons:

    1. Open your Xcode project.
    2. Select your project in the Navigation pane.
    3. Go to the Info tab.
    4. Under Localizations, click the + button to add the desired language.
    5. Rebuild your app.
    cd ios
    pod install
  3. Configure Android permissions

    master

    For Android, you may need to add permissions to app/src/main/AndroidManifest.xml:

    • Camera Access (Optional): If you want to use the camera picker, add: <uses-permission android:name="android.permission.CAMERA"/>

    • Front Camera Support (Optional): If you want to use the front camera, add: <uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera.front" android:required="false" />

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.front" android:required="false" />
  4. Clean up temporary files

    master

    The module creates temporary images. To manually force cleanup of these files, use ImagePicker.clean() to remove all temporary files or ImagePicker.cleanSingle(path) to remove a specific file.

    ImagePicker.clean()
      .then(() => {
        console.log("removed all tmp images from tmp directory");
      })
      .catch((e) => {
        alert(e);
      });