microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

New architecture not supported - Fabric components and Turbo Modules #2413

Closed RP-alissonpaschoal closed 1 year ago

RP-alissonpaschoal commented 1 year ago

Steps to Reproduce

  1. Create a new react native project
  2. Enable new architecture - https://reactnative.dev/docs/the-new-architecture/use-app-template#enable-the-new-architecture
  3. Configure CodePush
  4. Release a new CodePush version
  5. Try to update app via CodePush

Expected Behavior

It is expected to update the app successfully.

Actual Behavior

It throws an error and do not update.

 LOG  [CodePush] Checking for update.
 LOG  [CodePush] Awaiting user action.
 LOG  [CodePush] Downloading package.
 LOG  [CodePush] An unknown error occurred.
 LOG  [CodePush] Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.

Reproducible Demo

It's not possible to reproduce using the example app from react-native-code-push repository, because react-native version is out-of-date. It's possible to reproduce using react-native 0.70 with new architecture enabled.

Important information: if I disable the new architecture it works as expected, but when I enable new architecture it throws an error.

Environment

RP-alissonpaschoal commented 1 year ago

I found the problem, I forgot to add this code below on MainApplicationReactNativeHost.java file (instead of MainApplication.java, this file is only for the 'old' architecture)

@Override
  protected String getJSBundleFile() {
    return CodePush.getJSBundleFile();
  }
harimohan-hdw commented 10 months ago

@RP-alissonpaschoal I am using RN 0.72.4. I am not able to find this file MainApplicationReactNativeHost.java