Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

application crashed when open camera

$
0
0

I'm using https://github.com/ivpusic/react-native-image-crop-picker in my app, when camera opened I can take the picture but when I want to choose it the app crashes and sometimes it's crashed once the camera is opened, but it works when I use debugging mode instead on android works very well in the all cases.

when I run the project from xcode works fine but not with react-native run-ios --device "myDeviceName"

also with higher version ios like 13 it works well

  • react-native-image-crop-picker ^0.23.1
  • react-native v0.59.0
  • Ios 9.3.6

Component when I call open camera:

ImagePicker.openCamera({
          cropping: true,
          width: 500,
          height: 500,
          includeExif: true,
          includeBase64: true,
          mediaType:"photo"
        })
          .then(image => {
            this.setState({
              cameraOpened: false
            });
            this.props.navigation.navigate("Preview", {
              picture: image,
              type: this.type,
              state: this.props.navigation.state,
              userId: this.userId
            });
          })
          .catch(e => {
            console.log(e);
            this.setState({
              cameraOpened: false
            });
            this.props.navigation.goBack();
          });
      }

Preview.js:

ImageEditor.cropImage(
          this.picture.path,
          {
            offset: { x: 0, y: 0 },
            size: { width: 500, height: 500 },
            displaySize: { width: 500, height: 500 }
          },
          res => {
            // Change it to res
            this._uploadPicture(this.picture.path, response => {
              if (response.status == 200) {
                this.props.savePicture(this.picture);
                this.setState(
                  {
                    loading: false
                  },
                  () => {
                    this.navigation.goBack(key);
                  }
                );
              } else {
                alert(response);
              }
            });
          },
          err => {
            this.setState({
              loading: false
            });
            alert(err);
          }
        );

Any idea ? Thank you


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>