Giter Site home page Giter Site logo

ivpusic / react-native-image-crop-picker Goto Github PK

View Code? Open in Web Editor NEW
6.0K 6.0K 1.5K 8.02 MB

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping

License: MIT License

Java 30.03% JavaScript 4.25% Objective-C 63.71% Ruby 1.23% Starlark 0.78%
android crop cropping image ios react react-native recording video

react-native-image-crop-picker's Introduction

react-native-image-crop-picker

Backers on Open Collective Sponsors on Open Collective

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping

Result

Important notes

  1. If you are using react-native >= 0.60 use react-native-image-crop-picker version >= 0.25.0. Otherwise use version < 0.25.0.
  2. If you want to use react-native-image-crop-picker version >= 0.39.0 you have to set your android compileSdkVersion to 33 or greater. Otherwise use react-native-image-crop-picker version < 0.39.0

Usage

Import library

import ImagePicker from 'react-native-image-crop-picker';

Select from gallery

Call single image picker with cropping

ImagePicker.openPicker({
  width: 300,
  height: 400,
  cropping: true
}).then(image => {
  console.log(image);
});

Call multiple image picker

ImagePicker.openPicker({
  multiple: true
}).then(images => {
  console.log(images);
});

Select video only from gallery

ImagePicker.openPicker({
  mediaType: "video",
}).then((video) => {
  console.log(video);
});

Android: The prop 'cropping' has been known to cause videos not to be displayed in the gallery on Android. Please do not set cropping to true when selecting videos.

Select from camera

Image

ImagePicker.openCamera({
  width: 300,
  height: 400,
  cropping: true,
}).then(image => {
  console.log(image);
});

Video

ImagePicker.openCamera({
  mediaType: 'video',
}).then(image => {
  console.log(image);
});

Crop picture

ImagePicker.openCropper({
  path: 'my-file-path.jpg',
  width: 300,
  height: 400
}).then(image => {
  console.log(image);
});

Optional cleanup

Module is creating tmp images which are going to be cleaned up automatically somewhere in the future. If you want to force cleanup, you can use clean to clean all tmp files, or cleanSingle(path) to clean single tmp file.

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

Request Object

Property Type Description
cropping bool (default false) Enable or disable cropping
width number Width of result image when used with cropping option
height number Height of result image when used with cropping option
multiple bool (default false) Enable or disable multiple image selection
writeTempFile (ios only) bool (default true) When set to false, does not write temporary files for the selected images. This is useful to improve performance when you are retrieving file contents with the includeBase64 option and don't need to read files from disk.
includeBase64 bool (default false) When set to true, the image file content will be available as a base64-encoded string in the data property. Hint: To use this string as an image source, use it like: <Image source={{uri: `data:${image.mime};base64,${image.data}`}} />
includeExif bool (default false) Include image exif data in the response
avoidEmptySpaceAroundImage (ios only) bool (default true) When set to true, the image will always fill the mask space.
cropperActiveWidgetColor (android only) string (default "#424242") When cropping image, determines ActiveWidget color.
cropperStatusBarColor (android only) string (default #424242) When cropping image, determines the color of StatusBar.
cropperToolbarColor (android only) string (default #424242) When cropping image, determines the color of Toolbar.
cropperToolbarWidgetColor (android only) string (default darker orange) When cropping image, determines the color of Toolbar text and buttons.
freeStyleCropEnabled bool (default false) Enables user to apply custom rectangle area for cropping
cropperToolbarTitle string (default Edit Photo) When cropping image, determines the title of Toolbar.
cropperCircleOverlay bool (default false) Enable or disable circular cropping mask.
disableCropperColorSetters (android only) bool (default false) When cropping image, disables the color setters for cropping library.
minFiles (ios only) number (default 1) Min number of files to select when using multiple option
maxFiles (ios only) number (default 5) Max number of files to select when using multiple option
waitAnimationEnd (ios only) bool (default true) Promise will resolve/reject once ViewController completion block is called
smartAlbums (ios only) array (supported values) (default ['UserLibrary', 'PhotoStream', 'Panoramas', 'Videos', 'Bursts']) List of smart albums to choose from
useFrontCamera bool (default false) Whether to default to the front/'selfie' camera when opened. Please note that not all Android devices handle this parameter, see issue #1058
compressVideoPreset (ios only) string (default MediumQuality) Choose which preset will be used for video compression
compressImageMaxWidth number (default none) Compress image with maximum width
compressImageMaxHeight number (default none) Compress image with maximum height
compressImageQuality number (default 1 (Android)/0.8 (iOS)) Compress image with quality (from 0 to 1, where 1 is best quality). On iOS, values larger than 0.8 don't produce a noticeable quality increase in most images, while a value of 0.8 will reduce the file size by about half or less compared to a value of 1.
loadingLabelText (ios only) string (default "Processing assets...") Text displayed while photo is loading in picker
mediaType string (default any) Accepted mediaType for image selection, can be one of: 'photo', 'video', or 'any'
showsSelectedCount (ios only) bool (default true) Whether to show the number of selected assets
sortOrder (ios only) string (default 'none', supported values: 'asc', 'desc', 'none') Applies a sort order on the creation date on how media is displayed within the albums/detail photo views when opening the image picker
forceJpg (ios only) bool (default false) Whether to convert photos to JPG. This will also convert any Live Photo into its JPG representation
showCropGuidelines (android only) bool (default true) Whether to show the 3x3 grid on top of the image during cropping
showCropFrame (android only) bool (default true) Whether to show crop frame during cropping
hideBottomControls (android only) bool (default false) Whether to display bottom controls
enableRotationGesture (android only) bool (default false) Whether to enable rotating the image by hand gesture
cropperChooseText (ios only)            string (default choose)         Choose button text
cropperChooseColor (ios only) string (default #FFCC00) HEX format color for the Choose button. Default color is controlled by TOCropViewController.
cropperCancelText (ios only) string (default Cancel) Cancel button text
cropperCancelColor (ios only) string (default tint iOS color ) HEX format color for the Cancel button. Default value is the default tint iOS color controlled by TOCropViewController
cropperRotateButtonsHidden (ios only)            bool (default false)         Enable or disable cropper rotate buttons

Smart Album Types (ios)

NOTE: Some of these types may not be available on all iOS versions. Be sure to check this to avoid issues.

['PhotoStream', 'Generic', 'Panoramas', 'Videos', 'Favorites', 'Timelapses', 'AllHidden', 'RecentlyAdded', 'Bursts', 'SlomoVideos', 'UserLibrary', 'SelfPortraits', 'Screenshots', 'DepthEffect', 'LivePhotos', 'Animated', 'LongExposure']

Response Object

Property Type Description
path string Selected image location. This is null when the writeTempFile option is set to false.
localIdentifier(ios only) string Selected images' localidentifier, used for PHAsset searching
sourceURL(ios only) string Selected images' source path, do not have write access
filename(ios only) string Selected images' filename
width number Selected image width
height number Selected image height
mime string Selected image MIME type (image/jpeg, image/png)
size number Selected image size in bytes
duration number Video duration time in milliseconds
data base64 Optional base64 selected file representation
exif object Extracted exif data from image. Response format is platform specific
cropRect object Cropped image rectangle (width, height, x, y)
creationDate (ios only) string UNIX timestamp when image was created
modificationDate string UNIX timestamp when image was last modified

Install

Step 1

npm i react-native-image-crop-picker --save

Step 2

iOS

cd ios
pod install

Step 3

iOS

Step 1

In Xcode open Info.plist and add string key NSPhotoLibraryUsageDescription with value that describes why you need access to user photos. More info here https://forums.developer.apple.com/thread/62229. Depending on what features you use, you also may need NSCameraUsageDescription and NSMicrophoneUsageDescription keys.

(Optional) Step 2 - To localize the camera / gallery / cropper text buttons

  • Open your Xcode project
  • Go to your project settings by opening the project name on the Navigation (left side)
  • Select your project in the project list
  • Should be into the Info tab and add in Localizations the language your app was missing throughout the +
  • Rebuild and you should now have your app camera and gallery with the classic ios text in the language you added.

Android

  • VERY IMPORTANT Add the following to your build.gradle's repositories section and change Android SDK version to 33. (android/build.gradle)
buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
        ...
    }
}

allprojects {
    repositories {
      mavenLocal()
      jcenter()
      maven { url "$rootDir/../node_modules/react-native/android" }

      // ADD THIS
      maven { url 'https://maven.google.com' }

      // ADD THIS
      maven { url "https://www.jitpack.io" }
    }
}
  • Add useSupportLibrary (android/app/build.gradle)
android {
    ...

    defaultConfig {
        ...
        vectorDrawables.useSupportLibrary = true
        ...
    }
    ...
}
  • Minimum Gradle version if you are using react-native-image-crop-picker >= 0.35.0
3.3.3
3.4.3
3.5.4
3.6.4
4.0.1

Reference for more details #1406

  • If you use SDK version >= 33, add following to app/src/main/AndroidManifest.xml

    • <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
  • [Optional] If you want to use camera picker in your project, add following to app/src/main/AndroidManifest.xml

    • <uses-permission android:name="android.permission.CAMERA"/>
  • [Optional] If you want to use front camera, also add following to app/src/main/ AndroidManifest.xml

    • <uses-feature android:name="android.hardware.camera" android:required="false" />
    • <uses-feature android:name="android.hardware.camera.front" android:required="false" />

TO DO

  • [Android] Standardize multiple select
  • [Android] Video compression

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

MIT

react-native-image-crop-picker's People

Contributors

baloo1 avatar benvium avatar dburdan avatar esganzerla avatar fubar avatar gameboyvito avatar gausam avatar ivpusic avatar jasongaare avatar joeferraro avatar johncblandii avatar lebedev avatar lxxyx avatar migue1s avatar mikunj avatar nadjib avatar nikolaravic avatar oxyii avatar pnthach95 avatar sahil290791 avatar strate avatar sungsong88 avatar superandrew213 avatar svbutko avatar the-simian avatar therealrinku avatar timbrandin avatar vitalyrotari avatar zkrige avatar zmicierbiesau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-image-crop-picker's Issues

Unable to override or implement

I tried adding in the package, followed the steps for Android, but got the following error when trying to build it on my device:

"react-native-image-crop-picker/android/src/main/java/com/reactnative/picker/PickerModule.java:310: error: method does not override or implement a method from a supertype"

":react-native-image-crop-picker:compileReleaseJavaWithJavac FAILED"

Any thoughts?

use rpnm to link and build in Xcode got error

/node_modules/react-native-image-crop-picker/ios/ImageCropPicker.h:12:9: 'RCTBridgeModule.h' file not found

also tried don't use rnpm link, just manually add as Libraries and add the libios.a into Build Phase>Link Binary with Libraries...

still got the build error:
'RCTBridgeModule.h' file not found

library not found for -lQBImagePickerController

Like #7
pod install success with no warning

Update all pods
Updating local specs repositories

CocoaPods 1.1.0.beta.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.1.0.beta.1

Analyzing dependencies
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `react-native-image-crop-picker` from `../node_modules/react-native-image-crop-picker/ios`
Downloading dependencies
Using QBImagePickerController (3.4.0)
Using RSKImageCropper (1.5.1)
Using React (0.28.0)
Using UIImage-Resize (1.0.1)
Using react-native-image-crop-picker (0.4.3)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 6 dependencies from the Podfile and 5 total
pods installed.

but build failed in XCode..


ld: warning: directory not found for option '-L/Users/Kotori/Library/Developer/Xcode/DerivedData/bosspower-estwxlnmygshocelqgoskkpxmitw/Build/Products/Debug-iphonesimulator/QBImagePickerController'
ld: warning: directory not found for option '-L/Users/Kotori/Library/Developer/Xcode/DerivedData/bosspower-estwxlnmygshocelqgoskkpxmitw/Build/Products/Debug-iphonesimulator/RSKImageCropper'
ld: warning: directory not found for option '-L/Users/Kotori/Library/Developer/Xcode/DerivedData/bosspower-estwxlnmygshocelqgoskkpxmitw/Build/Products/Debug-iphonesimulator/React'
ld: warning: directory not found for option '-L/Users/Kotori/Library/Developer/Xcode/DerivedData/bosspower-estwxlnmygshocelqgoskkpxmitw/Build/Products/Debug-iphonesimulator/UIImage-Resize'
ld: warning: directory not found for option '-L/Users/Kotori/Library/Developer/Xcode/DerivedData/bosspower-estwxlnmygshocelqgoskkpxmitw/Build/Products/Debug-iphonesimulator/react-native-image-crop-picker'
ld: library not found for -lQBImagePickerController
clang: error: linker command failed with exit code 1 (use -v to see invocation)

On upgrade getting error running on device

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.7.0
  • react-native v0.32.0

// stacktrace or any other useful debug info

I can run on simulator just fine, but when I try to run on my iPhone I get the following stacktrace error:

dyld: Library not loaded: @rpath/RSKImageCropper.framework/RSKImageCropper
Referenced from: /var/containers/Bundle/Application/E8B8771F-2FB0-413A-B4AE-9592B6DF6888/AppName.app/AppName
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/E8B8771F-2FB0-413A-B4AE-9592B6DF6888/AppName.app/Frameworks/RSKImageCropper.framework/RSKImageCropper: mach-o, but wrong architecture

The app just hangs on the launch screen. I also noticed when trying to archive that it won't let me push the build to iTunes with a similar error message about not all architectures being supported with RSKImageCropper and QBImagePicker.

When adding the libraries in the Embedded Binaries section of the installation - I choose the ones from Libraries/imageCropPicker.xcodeproj/Frameworks. Is that correct?

Build failed issue (like #12)

I still have problem with RCTBridgeModule.h not found after following the instructions.
I am using React Native 0.29.
This is my pod file:

platform :ios, '9.3'

target 'NhapHoc' do

  # Pods for NhapHoc

  source 'https://github.com/CocoaPods/Specs.git'
  pod 'React', :subspecs => ['Core', 'RCTImage', 'RCTNetwork', 'RCTText', 'RCTWebSocket'], :path => '../node_modules/react-native'
  pod 'react-native-image-crop-picker', :path => '../node_modules/react-native-image-crop-picker/ios'

end

not work on android

System Version : 4.4.4 (19);


Issues :

1. cannot multiple select;

2. cannot crop image. if you try it, app will be dead and open "System Clocks";


Console Logs :

07-29 06:54:14.864 25020-25020/com.alipay.app E/VdcInflateDelegate: Exception while inflating
org.xmlpull.v1.XmlPullParserException: Binary XML file line #1 tag requires viewportWidth > 0
at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:878)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:355)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:196)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:49)
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:65)
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:102)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1030)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
at com.yalantis.ucrop.UCropActivity.onCreate(UCropActivity.java:102)
at android.app.Activity.performCreate(Activity.java:5303)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1091)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.access$800(ActivityThread.java:142)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5217)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
07-29 06:54:14.874 25020-25020/com.alipay.app W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4185ae00)
07-29 06:54:14.874 25020-25020/com.alipay.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.alipay.app, PID: 25020
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alipay.app/com.yalantis.ucrop.UCropActivity}: android.view.InflateException: Binary XML file line #35: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.access$800(ActivityThread.java:142)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5217)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
at com.yalantis.ucrop.UCropActivity.onCreate(UCropActivity.java:102)
at android.app.Activity.performCreate(Activity.java:5303)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1091)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255) 
at android.app.ActivityThread.access$800(ActivityThread.java:142) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5217) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ucrop_vector_ic_crop.xml from drawable resource ID #0x7f020066
at android.content.res.Resources.loadDrawable(Resources.java:2265)
at android.content.res.Resources.getDrawable(Resources.java:751)
at android.support.v7.widget.ResourcesWrapper.getDrawable(ResourcesWrapper.java:128)
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:45)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:201)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:49)
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:65)
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:102)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1030)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136) 
at com.yalantis.ucrop.UCropActivity.onCreate(UCropActivity.java:102) 
at android.app.Activity.performCreate(Activity.java:5303) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1091) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255) 
at android.app.ActivityThread.access$800(ActivityThread.java:142) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5217) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
at android.content.res.Resources.loadDrawable(Resources.java:2261)
at android.content.res.Resources.getDrawable(Resources.java:751) 
at android.support.v7.widget.ResourcesWrapper.getDrawable(ResourcesWrapper.java:128) 
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:45) 
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323) 
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:201) 
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191) 
at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:49) 
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:65) 
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:53) 
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:102) 
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972) 
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1030) 
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136) 
at com.yalantis.ucrop.UCropActivity.onCreate(UCropActivity.java:102) 
at android.app.Activity.performCreate(Activity.java:5303) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1091) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255) 
at android.app.ActivityThread.access$800(ActivityThread.java:142) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5217) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) 
at dalvik.system.NativeStart.main(Native Method) 


Sorry, I don't know how to do it.

[iOS] Problem when choosing image

When I defined the width and height for the chosen image, the image holder seemed to go down and lost a part of its detail, which makes the image hard to crop. Image size I defined is width: 450, height: 750. I am using RN 0.30 and iOS 9.3, Xcode 7.3.
I have attached an example image for you to take a look.
img_0063

Original photo:
img_0051

A problem occurred configuring project ':react-native-image-crop-picker'.

I'm getting the following error on building the project. I think I followed the link steps correctly, but still getting the error below.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

    A problem occurred configuring project ':react-native-image-crop-picker'.

FAILURE: Build failed with an exception.

hi there, I just install the module on:

"react-native": "^0.28.0",
Nexus 6 5.1.1

below is what I am facing:

/node_modules/react-native-image-crop-picker/android/build/intermediates/exploded-aar/com.yalantis/ucrop/1.5.0/res/drawable/ucrop_vector_loader.xml: Error: Width (0) and height (0) cannot be <= 0
:react-native-image-crop-picker:mergeReleaseResources FAILED

  • What went wrong:
    Execution failed for task ':react-native-image-crop-picker:mergeReleaseResources'.

here is ucrop_vector_loader.xml

`

<group
    android:name="circleGroup"
    android:pivotX="96.0"
    android:pivotY="96.0"
    android:rotation="0">

    <path
        android:name="circlePath"
        android:pathData="M96,5.56405C145.946,5.56405 186.436,46.0536 186.436,96C186.436,145.946 145.946,186.436 96,186.436C46.0536,186.436 5.56405,145.946 5.56405,96C5.56405,46.0536 46.0536,5.56405 96,5.56405Z"
        android:strokeAlpha="1"
        android:strokeColor="@color/ucrop_color_toolbar_widget"
        android:strokeWidth="13"
        android:trimPathEnd="0.7"/>

</group>

`

any ideas to fix it?

Feature request: Using Camera

Hi there,
I was using react-native-image-picker previously, and it seems like it doesn't support image cropping on Android devices very well. So I switched to this module which help me to achieve the image cropping goal. However, I realized that this module doesn't support selecting picture from camera? Is that possible to add this feature in the future? Thank you very much!

Missing dimen folder?

  • react-native-image-crop-picker v0.7.0
  • react-native v0.30.0

I am encountering this error.
* What went wrong: Execution failed for task ':react-native-image-crop-picker:mergeReleaseResources'.

../node_modules/react-native-image-crop-picker/android/build/intermediates/exploded-aar/com.yalantis/ucrop/2.1.2/res/drawable/ucrop_vector_loader.xml: Error: Width (0) and height (0) cannot be <= 0

Upload to server

Apologies as I know this isn't an issue with the library, but I can't find a solution anywhere.

Base64 is just too slow, especially if selecting multiple images. How do I got about uploading files via paths returned using this library? I'm using Relay inside my app and GraphQL on the server. Has anyone done this?

I can't get Relay's getFiles to work :(

Build failed, no such file libReact.a

Hi @ivpusic , I have a problem when using this package in IOS. Pod install is successful, no warnings. But when I run my project(.xcworkspace) in xcode, an error shows:

clang: error: no such file or directory: '/Users/kw/Library/Developer/Xcode/DerivedData/test-fohpnlfelwvgtiaczpjponpxpgyd/Build/Products/Debug-iphonesimulator/libReact.a'

pod install failed

i created Podfile with
pod 'react-native-image-crop-picker', :path => '../node_modules/react-native-image-crop-picker/ios'
under iOS project and
run
pod install

got error:

[!] The dependency react-native-image-crop-picker (from../../node_modules/react-native-image-crop-picker/ios) is not used in any concrete target.

Build issue

after adding header search path RCTBridgeModule.h not found issue resolved but another new issue came

Undefined symbols for architecture x86_64:
"_RCTRegisterModule", referenced from:
+[ImageCropPicker load] in ImageCropPicker.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Standalone Cropping

Hey, do you see an easy way to just using the cropping without the gallery view with providing an image path?

Thanks!

"Cannot find image data" Sony Xperia Z2

I've tried the camera feature on a few Android phones and it works just fine (OnePlus One, MotoG3) but when I'm trying it on a Sony Xperia Z2 I'm getting the error "Cannot find image data" after taking a picture.

I have noticed that on the working devices after taking a picture there is a 'confirmation screen' where the user can decide if the image is good enough to go to the cropper, however there isn't on the Z2, the cropper flashes up and then disappears before throwing the error.

The .openPicker() function works great on all devices.

Potentially a problem with the Sony camera not going through the same motions as the stock android camera?

Not sure how to provide a stack trace, let me know if there's more info that I can provide.

Awesome library :) thanks!

ios target name

Any chance to have the ios xcode proj target renamed? libios is a bit general maybe? :)

Cannot read property 'openPicker' of undefined

I have installed the library using
npm install react-native-image-crop-picker --save
and then I ran npm install again for safe measure.

I then added the following line to the header of my file
import ImagePicker from 'react-native-image-crop-picker';

I am using the following function to use the image picker
openImagePicker() { ImagePicker.openPicker({ width: 300, height: 400, cropping: true }).then(image => { console.log(image); }); }
I am getting the error
Cannot read property 'openPicker' of undefined

I realize it's an issue with ImagePicker, but I'm not sure what I'm importing incorrectly.

Build failed and pod failed

Hello,

I got this error when I try to pod install:

Analyzing dependencies
Fetching podspec for `react-native-image-crop-picker` from `../node_modules/react-native-image-crop-picker/ios`
[!] Unable to satisfy the following requirements:

- `react-native-image-crop-picker (from `../node_modules/react-native-image-crop-picker/ios`)` required by `Podfile`

It seems like you've changed the constraints of dependency `react-native-image-crop-picker` inside your development pod `react-native-image-crop-picker`.
You should run `pod update react-native-image-crop-picker` to apply changes you've made.

Here my PodFile:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'APPNAME' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for APPNAME

  pod 'react-native-image-crop-picker', :path => '../node_modules/react-native-image-crop-picker/ios'

  pod 'Firebase/Messaging'

  target 'APPNAMETEST' do
    inherit! :search_paths
    # Pods for testing
  end

end

Edit: I use react-native 0.30

Fix1:

If someone come here, check if your platform line is commented on your PodFile and uncomment it.

Fix2:

If you do a rnpm link just do a rnpm unlink and link the android side manually.

Fit image picker to <View />?

Is it possible to have the image picker not be fullscreen? For example, I have a modal in my app that I would like to have the picker inside of instead of taking over the whole screen. It would give it more of an integrated feel.

Installation instructions are incomplete

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.7.0
  • react-native v0.31.0

Expected behaviour

After running your recommended steps for installation the application should run.

npm i react-native-image-crop-picker --save
react-native link react-native-image-crop-picker

Actual behaviour

After executing "react-native run-android" following error occurs:

E:(...)\MainApplication.java:8: error: package com.reactnative.ivpusic.imagepicker does not exist
import com.reactnative.ivpusic.imagepicker.PickerPackage;
^
E:(...)\MainApplication.java:31: error: cannot find symbol
new PickerPackage(),
^
symbol: class PickerPackage
2 errors

Steps to reproduce

  1. npm i react-native-image-crop-picker --save
  2. react-native link react-native-image-crop-picker
  3. react-native run-android

Attachments

I noticed in your example project there are lines that are missing in mine, for example:
settings.gradle:

include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(settingsDir, '../../android')"
app/build.gradle:
dependencies {
(...)
compile project(':react-native-image-crop-picker')
}

However it still fails with:

A problem occurred configuring project ':app'.

Cannot evaluate module react-native-image-crop-picker : Configuration with name 'default' not >found."

Here is my MainApplication.java:
package com.stampowlapp;

import android.app.Application;
import android.util.Log;
import com.oblador.vectoricons.VectorIconsPackage;

import com.facebook.react.ReactApplication;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;

import com.imagepicker.ImagePickerPackage;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@OverRide
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
      new PickerPackage(),
      new VectorIconsPackage(),
      new ImagePickerPackage() // <-- add this line
  );
}

};

@OverRide
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}

Pod failed due to missing attributes

[!] The `react-native-image-crop-picker` pod failed to validate due to 2 errors:
    - ERROR | attributes: Missing required attribute `homepage`.
    - ERROR | attributes: Missing required attribute `source`.

pod install failed

Same issue as #2

Here is the Podfile content
pod 'react-native-image-crop-picker', :path => '../node_modules/react-native-image-crop-picker/ios'

Which sits in the ios folder of the project.

And here is the response that i get when i run pod install
[!] The dependency react-native-image-crop-picker (from ../node_modules/react-native-image-crop-picker/ios) is not used in any concrete target.

Android crop crash

on android emulator 4.4.4

E/VdcInflateDelegate( 1797): Exception while inflating <vector>
E/VdcInflateDelegate( 1797): org.xmlpull.v1.XmlPullParserException: Binary XML file line #1<vector> tag requires viewportWidth > 0
E/VdcInflateDelegate( 1797):    at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
E/VdcInflateDelegate( 1797):    at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
E/VdcInflateDelegate( 1797):    at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
E/VdcInflateDelegate( 1797):    at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:878)
E/VdcInflateDelegate( 1797):    at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:355)
E/VdcInflateDelegate( 1797):    at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:196)
E/VdcInflateDelegate( 1797):    at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
E/VdcInflateDelegate( 1797):    at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:49)
E/VdcInflateDelegate( 1797):    at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:65)
E/VdcInflateDelegate( 1797):    at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
E/VdcInflateDelegate( 1797):    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:102)
E/VdcInflateDelegate( 1797):    at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
E/VdcInflateDelegate( 1797):    at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1030)
E/VdcInflateDelegate( 1797):    at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
E/VdcInflateDelegate( 1797):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
E/VdcInflateDelegate( 1797):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
E/VdcInflateDelegate( 1797):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/VdcInflateDelegate( 1797):    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
E/VdcInflateDelegate( 1797):    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/VdcInflateDelegate( 1797):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
E/VdcInflateDelegate( 1797):    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
E/VdcInflateDelegate( 1797):    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
E/VdcInflateDelegate( 1797):    at com.yalantis.ucrop.UCropActivity.onCreate(UCropActivity.java:102)
E/VdcInflateDelegate( 1797):    at android.app.Activity.performCreate(Activity.java:5231)
E/VdcInflateDelegate( 1797):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/VdcInflateDelegate( 1797):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/VdcInflateDelegate( 1797):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
E/VdcInflateDelegate( 1797):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/VdcInflateDelegate( 1797):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/VdcInflateDelegate( 1797):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/VdcInflateDelegate( 1797):    at android.os.Looper.loop(Looper.java:136)
E/VdcInflateDelegate( 1797):    at android.app.ActivityThread.main(ActivityThread.java:5001)
E/VdcInflateDelegate( 1797):    at java.lang.reflect.Method.invokeNative(Native Method)
E/VdcInflateDelegate( 1797):    at java.lang.reflect.Method.invoke(Method.java:515)
E/VdcInflateDelegate( 1797):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/VdcInflateDelegate( 1797):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/VdcInflateDelegate( 1797):    at dalvik.system.NativeStart.main(Native Method)

Internal error

I get this error
I've done the steps. not really sure what to do next

screen shot 2016-08-23 at 4 25 09 pm
screen shot 2016-08-23 at 4 30 27 pm

screen shot 2016-08-23 at 4 27 50 pm
screen shot 2016-08-23 at 4 27 20 pm
screen shot 2016-08-23 at 4 26 45 pm

BUILD FAILED

:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim;
Unknown source file : at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file : at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file : at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file : at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file : at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file : at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file : at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file : at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file : at com.android.dx.command.Main.main(Main.java:106)

:app:dexDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:dexDebug'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 10.67 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Archiving fails on iOS

I get the following error:

ld: 251 duplicate symbols for architecture arm64

duplicates are related to:

'Core', 'RCTImage', 'RCTNetwork', 'RCTText', 'RCTWebSocket'

which are in the podfile.

Feature request: expose crop and resize statics

I'd like to be able to crop and resize an image programatically. Any chance of exposing a couple of static methods to crop, resize and adjust image quality? The result would ideally be a uri to the output file.

"RCTBridgeModule.h" not found

Does this work with the latest version of RN?
I've uninstalled and reinstalled this module and it's pods like 10 times.

Unable to run. Uses-sdk:minSdkVersion 16 cannot be smaller than version 18

Hi, I am unable to build and run this on android simulator. It is giving me the error below.

Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 18 declared in library [Ogre:react-native-image-crop-picker:unspecified] C:.......\android\app\build\intermediates\exploded-aar\Ogre\react-native-image-crop-picker\unspecified\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.reactnative.imagepicker" to force usage
:app:processDebugManifest FAILED

C:......\android\app\src\main\AndroidManifest.xml:15:5-17:41 Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 18 declared in library [Ogre:react-native-image-crop-picker:unspecified] C:......\android\app\build\intermediates\exploded-aar...\react-native-image-crop-picker\unspecified\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.reactnative.imagepicker" to force usage
:app:processDebugManifest FAILED

How can I fix this? Thanks.

Cannot read property 'openPicker' of undefined

This project looks great and I'm really looking forward to using it. However I'm getting the error referenced in the title when trying to open the image picker in my app.

Here is the code:

import ImagePicker from 'react-native-image-crop-picker'

...

selectPhotoTapped() {
    console.log(ImagePicker)
    ImagePicker.openPicker({
      multiple: true
    }).then(images => {
      console.log(images);
    })
}

...

<TouchableOpacity onPress={this.selectPhotoTapped.bind(this)}>
  <View style={[styles.avatar, styles.avatarContainer, {marginBottom: 20}]}>
    { this.state.image === null ? <Text>Select a Photo</Text> :
      <Image style={styles.avatar} source={this.state.image} />
    }
  </View>
</TouchableOpacity>

And this is my Podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'

target 'SclMktUi' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for SclMktUi

  target 'SclMktUiTests' do
    inherit! :search_paths
    source 'https://github.com/CocoaPods/Specs.git'
    pod 'React', :path => '../node_modules/react-native'
    pod 'react-native-image-crop-picker', :path => '../node_modules/react-native-image-crop-picker/ios'
    # Pods for testing
  end

end

Per the iOS install instructions I added $(inherited) to the Other Linker Flags field:

screen shot 2016-08-09 at 10 39 37 pm

When I run the code and click my TouchableOpacity I get the RSOD and the console log of ImagePicker reports undefined. Not sure what I'm doing wrong here.

From checking out [https://github.com//issues/33] I found that I had to undo the rnpm link at which point the build succeeded but I'm stuck at this undefined error. Everything looks good to my ignorant eyes 😄

Below is a screenshot of my Build Phases settings in Xcode. Any help would be greatly appreciated!

screen shot 2016-08-09 at 10 25 53 pm

issue displaying image from path on ios

I have successfully gotten the correct path returned, but when I try to display it, it appears blank.

I have tried on both the simulator and on an actual device, and in both instances it returns blank.

<Image source={{uri: path, isStatic: true}} style={{height: 50, width: 50}} />

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.