Skip to content

Commit bd0ca38

Browse files
fix(debug-symbolicator): Use new default exports of RN 0.79 (#4801)
1 parent 366c2d0 commit bd0ca38

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
### Fixes
1212

1313
- Disable native driver for Feedback Widget `backgroundColor` animation in unsupported React Native versions ([#4794](https://github.com/getsentry/sentry-react-native/pull/4794))
14+
- Fix Debug Symbolicator for local development builds (use RN 0.79 default exports) ([#4801](https://github.com/getsentry/sentry-react-native/pull/4801))
1415

1516
## 6.13.0
1617

packages/core/src/js/utils/rnlibraries.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,47 @@ const InternalReactNativeLibrariesInterface: Required<ReactNativeLibrariesInterf
88
Devtools: {
99
parseErrorStack: (errorStack: string): Array<ReactNative.StackFrame> => {
1010
const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');
11+
12+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
13+
if (parseErrorStack.default && typeof parseErrorStack.default === 'function') {
14+
// Starting with react-native 0.79, the parseErrorStack is a default export
15+
// https://github.com/facebook/react-native/commit/e5818d92a867dbfa5f60d176b847b1f2131cb6da
16+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
17+
return parseErrorStack.default(errorStack);
18+
}
19+
20+
// react-native 0.78 and below
1121
return parseErrorStack(errorStack);
1222
},
1323
symbolicateStackTrace: (
1424
stack: Array<ReactNative.StackFrame>,
1525
extraData?: Record<string, unknown>,
1626
): Promise<ReactNative.SymbolicatedStackTrace> => {
1727
const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
28+
29+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
30+
if (symbolicateStackTrace.default && typeof symbolicateStackTrace.default === 'function') {
31+
// Starting with react-native 0.79, the symbolicateStackTrace is a default export
32+
// https://github.com/facebook/react-native/commit/e5818d92a867dbfa5f60d176b847b1f2131cb6da
33+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
34+
return symbolicateStackTrace.default(stack, extraData);
35+
}
36+
37+
// react-native 0.78 and below
1838
return symbolicateStackTrace(stack, extraData);
1939
},
2040
getDevServer: (): ReactNative.DevServerInfo => {
2141
const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');
42+
43+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
44+
if (getDevServer.default && typeof getDevServer.default === 'function') {
45+
// Starting with react-native 0.79, the getDevServer is a default export
46+
// https://github.com/facebook/react-native/commit/e5818d92a867dbfa5f60d176b847b1f2131cb6da
47+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
48+
return getDevServer.default();
49+
}
50+
51+
// react-native 0.78 and below
2252
return getDevServer();
2353
},
2454
},

0 commit comments

Comments
 (0)