File tree Expand file tree Collapse file tree
packages/repack/src/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ interface RNDevSettings {
1010 reload ( ) : void ;
1111}
1212
13- interface RNLogBoxData {
14- clear ( ) : void ;
13+ interface RNLogBox {
14+ clearAllLogs ( ) : void ;
1515}
1616
1717class HMRClient {
@@ -153,17 +153,13 @@ class HMRClient {
153153
154154if ( __DEV__ && module . hot ) {
155155 const reload = ( ) => {
156- let DevSettings : RNDevSettings ;
157- if ( __REACT_NATIVE_MINOR_VERSION__ >= 79 ) {
158- DevSettings =
159- require ( 'react-native/Libraries/Utilities/DevSettings' ) . default ;
160- } else {
161- DevSettings = require ( 'react-native/Libraries/Utilities/DevSettings' ) ;
162- }
156+ const DevSettings : RNDevSettings = require ( 'react-native' ) . DevSettings ;
163157 DevSettings . reload ( ) ;
164158 } ;
165159
166160 const dismissErrors = ( ) => {
161+ const LogBox : RNLogBox = require ( 'react-native' ) . LogBox ;
162+
167163 if ( __PLATFORM__ === 'ios' ) {
168164 const NativeRedBox =
169165 require ( 'react-native/Libraries/NativeModules/specs/NativeRedBox' ) . default ;
@@ -173,14 +169,8 @@ if (__DEV__ && module.hot) {
173169 require ( 'react-native/Libraries/Core/NativeExceptionsManager' ) . default ;
174170 NativeExceptionsManager ?. dismissRedbox ( ) ;
175171 }
176- let LogBoxData : RNLogBoxData ;
177- if ( __REACT_NATIVE_MINOR_VERSION__ >= 79 ) {
178- LogBoxData =
179- require ( 'react-native/Libraries/LogBox/Data/LogBoxData' ) . default ;
180- } else {
181- LogBoxData = require ( 'react-native/Libraries/LogBox/Data/LogBoxData' ) ;
182- }
183- LogBoxData . clear ( ) ;
172+
173+ LogBox . clearAllLogs ( ) ;
184174 } ;
185175
186176 const showLoadingView = ( text : string , type : 'load' | 'refresh' ) => {
You can’t perform that action at this time.
0 commit comments