Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When openCropper called, app unmounts #1435

Open
hackrx opened this issue Oct 13, 2020 · 2 comments
Open

When openCropper called, app unmounts #1435

hackrx opened this issue Oct 13, 2020 · 2 comments

Comments

@hackrx
Copy link

hackrx commented Oct 13, 2020

Version

-"react-native-image-crop-picker": "^0.35.1",

  • react-native "0.63.0",

Platform

Tell us to which platform this issue is related

  • iOS
    -[x] Android

Expected behaviour

When openCropper called app should not unmount because openCropper is not returning the image path in then()

Actual behaviour

After cropping image, app restarts and navigate to Home screen (Default ) , while I was on Upload screen.

Steps to reproduce

cropReceivedImage = async () => {
    let widthOfImage = 300;
    let heightOfImage = 400;
    console.log('Ca;ling cropper for path', this.state.filePath);
    await ImagePicker.openCropper({
      path: this.state.filePath,
      width: widthOfImage,
      height: heightOfImage,
    })
      .then((image) => {
        console.log('Got cropped image ', image);
        if (this.mount) {
          this.setState({
            filePath: this.props.sharedImages.value,
          });
        }

        // also set this filePath to redux
        this.props.setImageInfo(this.props.sharedImages.value);
      })
      .catch((err) => {
        console.log('Got error in cropping', err);
      });
    
  };

componentDidMount(){
this.mount = true;
this.cropReceivedImage();
}

Attachments

When openCropper called, app state is background
image
After cropping done
image
Image argument was expected but it just again mounting the complete app.

// 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

@hackrx hackrx changed the title When openCropper called app unmount When openCropper called, app unmounts Oct 13, 2020
@tobikl1
Copy link

tobikl1 commented Dec 1, 2020

I had some similar behavior with my app unmounting immediately when putting it into the background and also when opening the cropper from this lib.
after hours of research with no results i endet up on this article:

https://medium.com/mindorks/hey-android-please-keep-my-activities-7bf96ccc0a38

turns out, i had activated the option "Don’t Keep Activities" in the developer options of my phone which causes the MainActivity with rn app to be destroyed once you start another activity (like imagecropper)

@howg0924
Copy link

@tobikl1 Maybe you will still experience this issue even you disabled "Don’t Keep Activities" due to #955 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants