@@ -152,7 +152,11 @@ private void setJSBundle(ReactHostDelegate reactHostDelegate, String latestJSBun
152152 Field bundleLoaderField = reactHostDelegate .getClass ().getDeclaredField ("jsBundleLoader" );
153153 bundleLoaderField .setAccessible (true );
154154 bundleLoaderField .set (reactHostDelegate , latestJSBundleLoader );
155- } catch (Exception e ) {
155+ }
156+ catch (NoSuchFieldException noSuchFileFound ) {
157+ // Ignore this error for Expo
158+ }
159+ catch (Exception e ) {
156160 CodePushUtils .log ("Unable to set JSBundle of ReactHostDelegate - CodePush may not support this version of React Native" );
157161 throw new IllegalAccessException ("Could not setJSBundle" );
158162 }
@@ -182,13 +186,23 @@ private void loadBundle() {
182186 // logic to reload the current React context.
183187 final ReactHost reactHost = resolveReactHost ();
184188 if (reactHost == null ) {
189+ loadBundleLegacy ();
185190 return ;
186191 }
187192
188193 String latestJSBundleFile = mCodePush .getJSBundleFileInternal (mCodePush .getAssetsBundleFileName ());
189194
190- // #2) Update the locally stored JS bundle file path
191- setJSBundle (getReactHostDelegate ((ReactHostImpl ) reactHost ), latestJSBundleFile );
195+ try {
196+ if (reactHost instanceof ReactHostImpl ) {
197+ ReactHostDelegate delegate = getReactHostDelegate ((ReactHostImpl ) reactHost );
198+ if (delegate != null ) {
199+ // #2) Update the locally stored JS bundle file path
200+ setJSBundle (delegate , latestJSBundleFile );
201+ }
202+ }
203+ } catch (Exception e ) {
204+ CodePushUtils .log ("Exception setJSBundle: " + e .getMessage ());
205+ }
192206
193207 // #3) Get the context creation method
194208 try {
0 commit comments