File tree Expand file tree Collapse file tree
apps/playground/src/__tests__ Expand file tree Collapse file tree Load diff This file was deleted.
Load diff This file was deleted.
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import './globals.js';
33
44export { createElement } from './jsx/jsx-runtime.js' ;
55export { UI as ReactNativeHarness } from './ui/index.js' ;
6- export { disableLogBoxUI , isLogBoxSuppressed } from './logbox.js' ;
76export * from './spy/index.js' ;
87export * from './expect/index.js' ;
98export * from './collector/index.js' ;
Original file line number Diff line number Diff line change 11import { getDeviceDescriptor } from './client/getDeviceDescriptor.js' ;
22import { getClient } from './client/index.js' ;
33import { disableHMRWhenReady } from './disableHMRWhenReady.js' ;
4- import { disableHMR } from './hmr.js' ;
5- import { disableLogBoxUI } from './logbox.js' ;
64import { setupJestMock } from './jest-mock.js' ;
75
86// Polyfill for EventTarget on runtimes that don't ship one (RN's JSC).
@@ -22,13 +20,20 @@ if (typeof globalThis.EventTarget !== 'function') {
2220// Setup jest mock to warn users about using Jest APIs
2321setupJestMock ( ) ;
2422
25- disableLogBoxUI ( ) ;
23+ // Turn off LogBox
24+ const { LogBox } = require ( 'react-native' ) ;
25+ LogBox . ignoreAllLogs ( true ) ;
26+
27+ // Turn off HMR
28+ const HMRClientModule = require ( 'react-native/Libraries/Utilities/HMRClient' ) ;
29+ const HMRClient =
30+ 'default' in HMRClientModule ? HMRClientModule . default : HMRClientModule ;
2631
2732// Wait for HMRClient to be initialized
2833setTimeout ( ( ) => {
2934 void ( async ( ) => {
3035 try {
31- await disableHMRWhenReady ( disableHMR , 50 ) ;
36+ await disableHMRWhenReady ( ( ) => HMRClient . disable ( ) , 50 ) ;
3237 const handle = await getClient ( ) ;
3338
3439 const deviceDescriptor = getDeviceDescriptor ( ) ;
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ declare module 'react-native/Libraries/Core/Devtools/getDevServer' {
2+ export type DevServerInfo = {
3+ url : string ;
4+ fullBundleUrl ?: string ;
5+ bundleLoadedFromServer : boolean ;
6+ } ;
7+ export default function getDevServer ( ) : DevServerInfo ;
8+ }
9+
110declare module 'react-native/Libraries/Core/Devtools/parseErrorStack' {
211 export type StackFrame = {
312 column : number | null | undefined ;
Original file line number Diff line number Diff line change 1- import { Platform , TurboModuleRegistry } from 'react-native' ;
2-
3- type SourceCodeModule = {
4- getConstants : ( ) => {
5- scriptURL ?: string ;
6- } ;
7- } ;
8-
9- const FALLBACK_DEV_SERVER_URL = 'http://localhost:8081/' ;
10-
11- const getScriptURL = ( ) : string | null => {
12- const sourceCode = TurboModuleRegistry . get < SourceCodeModule > ( 'SourceCode' ) ;
13- return sourceCode ?. getConstants ( ) ?. scriptURL ?? null ;
14- } ;
1+ import { Platform } from 'react-native' ;
2+ import getDevServer from 'react-native/Libraries/Core/Devtools/getDevServer' ;
153
164export const getDevServerUrl = ( ) : string => {
175 if ( Platform . OS === 'web' ) {
18- return `${ window . location . origin } /` ;
6+ // This is going to be the same as the current URL
7+ return window . location . origin + '/' ;
198 }
20-
21- const scriptUrl = getScriptURL ( ) ;
22- const match = scriptUrl ?. match ( / ^ h t t p s ? : \/ \/ . * ? \/ / ) ;
23- return match ?. [ 0 ] ?? FALLBACK_DEV_SERVER_URL ;
9+
10+
11+ const devServer = getDevServer ( ) ;
12+ return devServer . url ;
2413} ;
You can’t perform that action at this time.
0 commit comments