Skip to content

Commit 9af5c33

Browse files
lunaleapsfacebook-github-bot
authored andcommitted
ESM LogBox
Summary: Changelog: [General][Changed] - ESM Logbox Reviewed By: yungsters Differential Revision: D42202344 fbshipit-source-id: 8b09fb261c61bd3fb3ab8df66e5732046187cdd8
1 parent b606449 commit 9af5c33

File tree

8 files changed

+15
-10
lines changed

8 files changed

+15
-10
lines changed

Libraries/Core/ExceptionsManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function reportException(
103103
}
104104

105105
if (__DEV__) {
106-
const LogBox = require('../LogBox/LogBox');
106+
const LogBox = require('../LogBox/LogBox').default;
107107
LogBox.addException({
108108
...data,
109109
isComponentError: !!e.isComponentError,

Libraries/Core/InitializeCore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require('./setUpSegmentFetcher');
4040
if (__DEV__) {
4141
require('./checkNativeVersion');
4242
require('./setUpDeveloperTools');
43-
require('../LogBox/LogBox').install();
43+
require('../LogBox/LogBox').default.install();
4444
}
4545

4646
require('../ReactNative/AppRegistry');

Libraries/Core/__tests__/ExceptionsManager-test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
'use strict';
1212

13-
const LogBox = require('../../LogBox/LogBox');
13+
import LogBox from '../../LogBox/LogBox';
14+
1415
const ExceptionsManager = require('../ExceptionsManager');
1516
const NativeExceptionsManager = require('../NativeExceptionsManager').default;
1617
const ReactFiberErrorDialog = require('../ReactFiberErrorDialog').default;
@@ -57,9 +58,12 @@ function runExceptionsManagerTests() {
5758
let logBoxAddException;
5859

5960
beforeEach(() => {
61+
logBoxAddException = jest.fn();
6062
jest.resetModules();
6163
jest.mock('../../LogBox/LogBox', () => ({
62-
addException: jest.fn(),
64+
default: {
65+
addException: logBoxAddException,
66+
},
6367
}));
6468
jest.mock('../NativeExceptionsManager', () => {
6569
return {
@@ -80,7 +84,6 @@ function runExceptionsManagerTests() {
8084
);
8185
jest.spyOn(console, 'error').mockReturnValue(undefined);
8286
nativeReportException = NativeExceptionsManager.reportException;
83-
logBoxAddException = LogBox.addException;
8487
});
8588

8689
afterEach(() => {

Libraries/LogBox/LogBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,4 @@ if (__DEV__) {
258258
};
259259
}
260260

261-
module.exports = (LogBox: ILogBox);
261+
export default (LogBox: ILogBox);

Libraries/LogBox/__tests__/LogBox-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
'use strict';
1313

1414
const LogBoxData = require('../Data/LogBoxData');
15-
const LogBox = require('../LogBox');
15+
const LogBox = require('../LogBox').default;
1616

1717
declare var console: any;
1818

Libraries/YellowBox/YellowBoxDeprecated.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
import type {IgnorePattern} from '../LogBox/Data/LogBoxData';
1414

15-
const LogBox = require('../LogBox/LogBox');
15+
import LogBox from '../LogBox/LogBox';
16+
1617
const React = require('react');
1718

1819
type Props = $ReadOnly<{||}>;

Libraries/YellowBox/__tests__/YellowBoxDeprecated-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
'use strict';
1313

14-
const LogBox = require('../../LogBox/LogBox');
14+
import LogBox from '../../LogBox/LogBox';
15+
1516
const YellowBox = require('../YellowBoxDeprecated');
1617

1718
describe('YellowBox', () => {

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ module.exports = {
282282
return require('./Libraries/Linking/Linking');
283283
},
284284
get LogBox(): LogBox {
285-
return require('./Libraries/LogBox/LogBox');
285+
return require('./Libraries/LogBox/LogBox').default;
286286
},
287287
get NativeDialogManagerAndroid(): NativeDialogManagerAndroid {
288288
return require('./Libraries/NativeModules/specs/NativeDialogManagerAndroid')

0 commit comments

Comments
 (0)