react-native-camera-kit icon indicating copy to clipboard operation
react-native-camera-kit copied to clipboard

Fix #614. "onError" method needs to be declared

Open DavidBertet opened this issue 2 years ago • 0 comments

Summary

Fix the error Unsupported top level event type "onError" dispatched, js engine: hermes, raised by #614

When Android can't access the camera, it throws an error. On v13 we were logging the error. On v14 we are forwarding it to the app https://github.com/teslamotors/react-native-camera-kit/commit/73bd920ca46bdaa16c8254820728c50c900c682e

While doing it, we forgot to declare the method. Hence hermes raises an error for method unknown.

Fix

Declare the method "onError"

How did you test this change?

On an emulator without camera, it doesn't raise the error anymore.

And if "onError" is added on the application

<Camera
  onError={(e) => console.log('error', e.nativeEvent)}

It does forward it.

 LOG  Running "CameraKitExample" with {"rootTag":11}
 LOG  error {"errorMessage": "Provided camera selector unable to resolve a camera for the given use case"}

DavidBertet avatar Dec 21 '23 03:12 DavidBertet