Skip to content

Commit a8f77b6

Browse files
a7medevHeshamMegid
authored andcommitted
[INSD-9579] Fix Unhandled JavaScript Crashes on Android (#980)
1 parent b6daff5 commit a8f77b6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixed
66

7+
- Fix an issue with unhandled JavaScript crashes being reported as native Android crashes ([#980](https://github.com/Instabug/Instabug-React-Native/pull/980)).
78
- Fix an issue with the Android sourcemaps upload script, causing the build to fail on older versions of Gradle ([#970](https://github.com/Instabug/Instabug-React-Native/pull/970)), closes [#969](https://github.com/Instabug/Instabug-React-Native/issues/969).
89
- Fix an issue with the Android sourcemaps upload script, causing the build to fail when using product flavors ([#975](https://github.com/Instabug/Instabug-React-Native/pull/975)), closes [#974](https://github.com/Instabug/Instabug-React-Native/issues/974).
910

src/utils/InstabugUtils.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,19 @@ export const captureJsErrors = () => {
8888
};
8989

9090
ErrorUtils.setGlobalHandler((err, isFatal) => {
91-
if (!process.env.JEST_WORKER_ID) {
91+
instabugErrorHandler(err, isFatal);
92+
93+
if (process.env.JEST_WORKER_ID) {
94+
return;
95+
}
96+
97+
if (Platform.OS === 'android') {
98+
setTimeout(() => {
99+
originalErrorHandler(err, isFatal);
100+
}, 500);
101+
} else {
92102
originalErrorHandler(err, isFatal);
93103
}
94-
instabugErrorHandler(err, isFatal);
95104
});
96105
};
97106

0 commit comments

Comments
 (0)