Skip to content

Commit d168b33

Browse files
hoxyqfacebook-github-bot
authored andcommitted
Support rename of React stack bottom frame
Summary: # Changelog: [Internal] Adaptation for facebook/react#33680. Reviewed By: jackpope Differential Revision: D77737710
1 parent 477d8df commit d168b33

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

packages/react-native/Libraries/LogBox/__tests__/fantomHelpers.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function findLogBoxInspectorUI(node: ReadOnlyElement): InspectorUI {
117117
// anonymous
118118
// MockConsoleErrorForTesting <-- mockConsoleIndex
119119
// ManualConsoleError
120-
// reactStackBottomFrame <-- react bottom frame
120+
// react_stack_bottom_frame <-- react bottom frame
121121
// <root>
122122
//
123123
// Becomes:
@@ -129,9 +129,19 @@ function getStackFrames(node: ReadOnlyElement): ?Array<string> {
129129
const mockConsoleIndex = text.includes('MockConsoleErrorForTesting')
130130
? text.indexOf('MockConsoleErrorForTesting') + 1
131131
: 0;
132-
const bottomFrameIndex = text.includes('reactStackBottomFrame')
133-
? text.indexOf('reactStackBottomFrame')
134-
: text.length;
132+
let bottomFrameIndex = text.indexOf('react_stack_bottom_frame');
133+
if (bottomFrameIndex === -1) {
134+
// [email protected] with @babel/plugin-transform-function-name
135+
bottomFrameIndex = text.indexOf('reactStackBottomFrame');
136+
}
137+
if (bottomFrameIndex === -1) {
138+
// [email protected] without @babel/plugin-transform-function-name
139+
bottomFrameIndex = text.indexOf('react-stack-bottom-frame');
140+
}
141+
if (bottomFrameIndex === -1) {
142+
bottomFrameIndex = text.length;
143+
}
144+
135145
return text.slice(mockConsoleIndex, bottomFrameIndex);
136146
}
137147

0 commit comments

Comments
 (0)