ImagePicker.openPicker({
width: 300,
height: 400,
cropping: true,
}).then(image => {
console.log(image);
}).catch(e => console.log('error', e));
안드로이드에서 해당 ImagePicker를 동작할때, gif 또는 webp,heic 고효율 이미지일때
아래와 같은 에러가 발생했다.
Cannot find image data
at Object.promiseMethodWrapper [as openPicker] (NativeModules.js:103)
at HomeScreen.loadImageGallery (homescreen.js:107)
at Object.onPress (homescreen.js:75)
at onAction (Alert.js:92)
at MessageQueue.__invokeCallback (MessageQueue.js:472)
at MessageQueue.js:136
at MessageQueue.__guard (MessageQueue.js:373)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:135)
at RNDebuggerWorker.js:2
해당 라이브러리의 이슈사항을 참고하니, 안드로이드 같은경우에는 데이터가 큰 이미지일 경우 크롭을 하는 과정에서 이미지를 불러오기전에 크롭이 되어버려서 그런것 같았다.
해결방법은 openPicker 또는 openCamera를 호출 한다음 openCropper를 호출하면 된다.
해결방법 예시:
let selectedImage = await ImagePicker.openPicker({
mediaType: "photo",
cropping: false,
});
let croppedImage = await ImagePicker.openCropper({
path: selectedImage.path,
width: props.width,
height: props.height,
})
출처: https://github.com/ivpusic/react-native-image-crop-picker/issues/1367
태클은 언제나 환영입니다 잘못된부분이 있으면 댓글달아주세요 감사합니다 :)
'React-Native' 카테고리의 다른 글
[ReactNative] FlatList의 스크롤의 시작과 끝을 알고싶을때 (0) | 2023.04.13 |
---|---|
[ReactNative] TextInput 에 onPress 이벤트 설정하는 방법 (0) | 2023.02.27 |
[ReactNative] 배포시 console.log 없애기 (0) | 2023.01.14 |
[ReactNative] crypto-js를 이용한 AES ECB 모드 암호화 및 복호화 하기 (0) | 2022.12.11 |
command phasescriptexecution failed with a nonzero exit code (0) | 2022.12.04 |