@@ -128,7 +128,7 @@ private void setJSBundle(ReactInstanceManager instanceManager, String latestJSBu
128128
129129 ReactHost reactHost = resolveReactHost ();
130130 if (reactHost == null ) {
131- // Bridge, Old Architecture and RN < 0.74 (we support Bridgeless >= 0.74)
131+ // Bridge, Old Architecture
132132 setJSBundleLoaderBridge (instanceManager , latestJSBundleLoader );
133133 return ;
134134 }
@@ -184,29 +184,14 @@ private void loadBundle() {
184184 new Handler (Looper .getMainLooper ()).post (new Runnable () {
185185 @ Override
186186 public void run () {
187- try {
188- // reload method introduced in RN 0.74 (https://github.com/reactwg/react-native-new-architecture/discussions/174)
189- // so, we need to check if reload method exists and call it
190- try {
191- ReactDelegate reactDelegate = resolveReactDelegate ();
192- if (reactDelegate == null ) {
193- throw new NoSuchMethodException ("ReactDelegate doesn't have reload method in RN < 0.74" );
194- }
187+ ReactDelegate reactDelegate = resolveReactDelegate ();
188+ assert reactDelegate != null ;
195189
196- resetReactRootViews (reactDelegate );
190+ resetReactRootViews (reactDelegate );
197191
198- Method reloadMethod = reactDelegate .getClass ().getMethod ("reload" );
199- reloadMethod .invoke (reactDelegate );
200- } catch (NoSuchMethodException e ) {
201- // RN < 0.74 calls ReactInstanceManager.recreateReactContextInBackground() directly
202- instanceManager .recreateReactContextInBackground ();
203- }
204- mCodePush .initializeUpdateAfterRestart ();
205- } catch (Exception e ) {
206- // The recreation method threw an unknown exception
207- // so just simply fallback to restarting the Activity (if it exists)
208- loadBundleLegacy ();
209- }
192+ reactDelegate .reload ();
193+
194+ mCodePush .initializeUpdateAfterRestart ();
210195 }
211196 });
212197
@@ -247,13 +232,7 @@ private ReactDelegate resolveReactDelegate() {
247232 return null ;
248233 }
249234
250- try {
251- Method getReactDelegateMethod = currentActivity .getClass ().getMethod ("getReactDelegate" );
252- return (ReactDelegate ) getReactDelegateMethod .invoke (currentActivity );
253- } catch (Exception e ) {
254- // RN < 0.74 doesn't have getReactDelegate method
255- return null ;
256- }
235+ return currentActivity .getReactDelegate ();
257236 }
258237
259238 private ReactHost resolveReactHost () {
0 commit comments