Open cantianshu opened 6 years ago
can you provide stacktrace?
Same here. Android, RN is integrated in my app by ReactRootView.
After choose the photo and return nothing (where I have console.log something). It doesn't crash and logcat seems normal.
+1. Only have this when a photo is taken - the image picker seems to work fine. The promise simply never resolves or fails. RN 0.52 / latest picker from NPM.
Here's my code:
try {
const image = await ImagePicker.openCamera({cropping: false});
alert("took photo");
} catch(e) {
alert(e);
}
do you have some time to debug this?
i'm very new to RN - I'll gladly invest some time, but TBH I wouldn't know where to look since there's no obvious failure...
Having the same issue: After selected an image from gallery, it brings me to the cropping screen where it only shows spinner without my image.
// don't use Alert see data is callback // use renderImage see callback data
renderImage=(image)=> {
return
//调用相机 cameraOnPress=()=>{ this.props.modalVisibleFn( false )
//打开相机
ImagePicker.openCamera({
width: 300,
height: 400,
cropping: true,
}).then(resJson => {
// don't use Alert see data is callback
if (resJson && resJson.path ) {
// use renderImage see callback data
this.renderImage( resJson.path )
}
}).catch(e => {
Alert.alert(e.message ? e.message : e);
});
}
liuflwy@163.com
From: Kheoh Yee Wei Date: 2018-01-11 16:59 To: ivpusic/react-native-image-crop-picker CC: fulong; Author Subject: Re: [ivpusic/react-native-image-crop-picker] Android select image then no callback (#553) Having the same issue: After selected an image from gallery, it brings me to the cropping screen where it only shows spinner without my image. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
@cantianshu Can you elaborate what you mean by see data is callback? I guess if the then
function executes, an alert will show, no?
Remove 'alert 、Alert' it will interrupt the process
use :
renderImage=(image)=> {
return
liuflwy@163.com
From: Philipp Sumi Date: 2018-01-13 17:13 To: ivpusic/react-native-image-crop-picker CC: fulong; Mention Subject: Re: [ivpusic/react-native-image-crop-picker] Android select image then no callback (#553) @cantianshu Can you elaborate what you mean by see data is callback? I guess if the then function executes, an alert will show, no? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@cantianshu , perhaps if you use...
renderImage=(image)=> {
return <Image style={styles.icon} source={{ uri: image }} />
}
works?
Having the same issue pls help
Same issue here, no errors but the activity indicator remains forever.
RN 0.52.0 Sansumg S7 Edge (Android 7.0) android.buildToolsVersion "25.0.3"
@LyhengTep , please try removing width
and height
from the options, leave only cropping: true
.
This works for me ...but I'm getting 200px images :(
@aMarCruz it remained the same bro :(
Hey guys, i think there wasn't anything wrong with this library. You might wanna rebuild your apk, npm start, close and open your app and build the index.js again..that kind of stuffs..if still doesn't work, rm -rf node_modules && yarn
. That worked for me anyway.
it seeem to be Image was damaged!!
@LyhengTep you're right, same issue.
@kilgarenone I've done like what you said bro but nothing change
@quy1403 I dont know bro but every time it happened. I have to rebuild the application
Lets take a new photo and pick it!!!! It worked for me!
Same issue here. On Samsung Note4 Android 6.0.1
Same issue, but it's strange when I turn on remote debugging, it just works again... On Nexus 6P.
Alright so I am doing some debuggng and I found the issue:
Method threw 'com.facebook.react.bridge.ObjectAlreadyConsumedException' exception. Cannot evaluate com.facebook.react.bridge.WritableNativeMap.toString()
Now I am trying to see how to fix it.
According to RN source code, either using putArray or putMap consumes the Map, so the exception is thrown. Weird thing is that the only place in the code where this is used is with compression or cropping. And I have disabled both and the issue still persists. I believe this could be a RN issue when it sends the values over the bridge.
@ivpusic Hi! Sorry to bother you, but do you know where this issue could e coming from? I was able to check that there is a class called Arguments that converts what you send over the bridge to a WritableNativeMap and that is where the exception is thrown but it does not make sense, because the map itself is not consumed.
I'm having this issue as well. Selecting photos and clicking open does not trigger callback function.
I resolve this problem by
mReactInstanceManager = ReactInstanceManager.builder() .setApplication(getApplication()) .setBundleAssetName("index.android.bundle") .setJSMainModulePath("index") .addPackage(new MainReactPackage()) .setUseDeveloperSupport(BuildConfig.DEBUG) .setInitialLifecycleState(LifecycleState.RESUMED) .build();
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (mReactInstanceManager != null) { mReactInstanceManager.onActivityResult(this,requestCode,resultCode,data); } }
@zsaCHG Hi, could you please elaborate where should I add these lines?
@Elitebigboss90 In the Activity which the react native page attach. This Activity implements DefaultHardwareBackBtnHandler or extends ReactActivity.
Changing the sdk version to 27 did the trick for me
same here!!
Version
Tell us which versions you are using:
Platform
Tell us to which platform this issue is related
Expected behaviour
do callback functions and params (path, widht, height ... )
Actual behaviour
Steps to reproduce
openPicker or openCamera while no callback then
Attachments
// stacktrace or any other useful debug info
Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate