Fixed parseErrorStackLib params based on RN Version in errorHandler
@@ -52,7 +52,17 @@ export const captureJsErrors = () => {
}
function errorHandler(e, isFatal) {
- let jsStackTrace = parseErrorStackLib(e);
+ let jsStackTrace;
+ if (Platform.hasOwnProperty("constants")) {
+ // RN version >= 0.63
+ if (Platform.constants.reactNativeVersion.minor >= 64)
+ // RN version >= 0.64 -> Stacktrace as string
+ jsStackTrace = parseErrorStackLib(e.stack);
+ // RN version == 0.63 -> Stacktrace as string
+ else jsStackTrace = parseErrorStackLib(e);
+ }
+ // RN version < 0.63 -> Stacktrace as string
+ else jsStackTrace = parseErrorStackLib(e);
//JSON object to be sent to the native SDK
var jsonObject = {
