TypeError: null is not an object (evaluating 'this.modalRef.setModalVisible'),
harshakumar87 opened this issue · comments
Hi,
I am using canvas to edit the captured image. The implementation is working fine on iOS(Capture image and edit using sketch canvas but in Android I am getting the below error soon after capturing image. Please help
TypeError: null is not an object (evaluating 'this.modalRef.setModalVisible')
Below is my code snippet for your reference
openDrawImageModal() {
this.modalRef.setModalVisible(true);
}
takeImage() {
launchCamera({
mediaType: 'photo',
maxWidth: 400,
maxHeigth: 300,
quality: 0.5
},(response) => {
if (response.didCancel) {
} else if (response.error) {
this.imageError(response.error);
} else if (response.customButton) {
if (response.customButton == "DeleteImage") this.deleteImage();
} else {
let source = response;
this.setState({ image: source });
this.openDrawImageModal();
}
},
)
}
}
<DrawImageModal
setImageBase64={this.setImageBase64}
imageUri={
this.state.image != null && this.state.image.uri
? Platform.OS === "ios"
? this.state.image.uri.replace("file://", "")
: this.state.image.uri.replace("content://", "")
: ""
}
ref={(modalRef) => {
this.modalRef = modalRef;
console.log("render ~ this.modalRef", this.modalRef)
}}
/>