I have tried this library react-native-image-crop-picker as suggested on this stackoverflow answer
I have followed each and every step mentioned here
npm i react-native-image-crop-picker@0.4.2
import ImagePicker from 'react-native-image-crop-picker';
thenImagePicker.openPicker({ width: 300, height: 400, cropping: true }).then(image => { console.log(image); });
Also in // file: android/settings.gradle
have added the below code
include ':react-native-image-crop-picker' project(':react-native-image-crop-picker').projectDir = new File(settingsDir, '../node_modules/react-native-image-crop-picker/android')
Also as mentioned in the documentation have added required code in build.gradle
& MainActivity.java
file
But this is not working for me on Android
but working perfectly on iOS
. On Android
I have given to crop images by scale type only not as flexible crop.
I think you have faced the problem for version issue. You should try react-native-amazing-cropper . It works same for both the Android
and iOS
.
I had the same problem. I found out that we need the following line in our AndroidManifest.xml file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" ... >
...
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace" />
Enjoy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.