Fixed parseErrorStack params based on RN Version in reportJSException
@@ -24,7 +24,17 @@ export default {
* @param errorObject Error object to be sent to Instabug's servers
*/
reportJSException: function(errorObject) {
- let jsStackTrace = InstabugUtils.parseErrorStack(errorObject);
+ let jsStackTrace;
+ if (Platform.hasOwnProperty("constants")) {
+ // RN version >= 0.63
+ if (Platform.constants.reactNativeVersion.minor >= 64)
+ // RN version >= 0.64 -> Stacktrace as string
+ jsStackTrace = InstabugUtils.parseErrorStack(errorObject.stack);
+ // RN version == 0.63 -> Stacktrace as string
+ else jsStackTrace = InstabugUtils.parseErrorStack(errorObject);
+ }
+ // RN version < 0.63 -> Stacktrace as string
+ else jsStackTrace = InstabugUtils.parseErrorStack(errorObject);
var jsonObject = {
message: errorObject.name + ' - ' + errorObject.message,
os: Platform.OS,
