daily-co / react-native-daily-js

https://docs.daily.co/reference/rn-daily-js
BSD 2-Clause "Simplified" License
36 stars 13 forks source link

Expo - Android Upgrading to Expo SDK 50 leads to ERROR - "Super expression must either be null or a function" #52

Closed badhrin closed 7 months ago

badhrin commented 7 months ago

Base code was a fully working Android App using Expo SDK 49 & Expo Router V2 that uses Daily successfully. There has been no change to the working code. Issue happened on upgrade to Expo SDK 50 & Expo Router V3.

Expected Behaviour: Successful build & loading of App

Bug / Unexpected Behaviour ISSUE 1: Instead of a successful build & loading of app, I am getting an error when I load the app using 'npx expo start' :

LOG MediaDevices _registerEvents invoked ERROR TypeError: Super expression must either be null or a function, js engine: hermes at ContextNavigator (http://:8081/appEntry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:157441:24) at ExpoRoot (http://:8081/appEntry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:157397:28) at appEntry at withDevTools(appEntry) (http://:8081/appEntry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:136391:27) at RCTView at View (http://:8081/appEntry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:70438:43) at RCTView at View (http://192.168.1.3:8081/appEntry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:70438:43) at AppContainer (http://:8081/appEntry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:70249:36) at main(RootComponent) (http://:8081/appEntry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:117888:28)

RELATED ISSUE 2: Further, any component (even a dummy component with no logic) that imports Daily or DailyMediaView results in WARNING :

[Layout children]: No route named MyDailyComponent exists in nested children".

Both the Issue 1 (Error) & Issue 2 (Warning) go away if we remove the Import statement of Daily & DailyMediaView from the component.

My import statement of Daily looks like this:

import Daily, { DailyMediaView } from '@daily-co/react-native-daily-js';

The above import statement worked without any issues in Expo SDK 49 and Expo Router V2.

System information

  1. Using Expo SDK 50.0.15, Expo Router 3.4.8.
  2. Windows 10
  3. Following dependencies used: "@config-plugins/react-native-webrtc": "^8.0.0", "@daily-co/config-plugin-rn-daily-js": "^0.0.5", "@daily-co/react-native-daily-js": "^0.59.0", "@daily-co/react-native-webrtc": "^118.0.3-daily.2",
  4. Test device was on Android version 14

Tried to use the react-native-daily-js@0.60.0, but same issue happens

filipi87 commented 7 months ago

Hi @badhrin,

It looks like one of our user has already faced this same issue while migrating to Expo 50. More details here.

And to solve this, they needed to upgrade the event-target-shim version to match the same one requested by react-native-webrtc, version 6.0.2. More details here.

Let me know if this will fix your issue as well.

You can also take a look in our demo app, which is already using Expo 50.

badhrin commented 7 months ago

@filipi87 - Thank you for the response. Fixed the issue. To help others in the future, please see if you can update the documentation at https://www.npmjs.com/package/@daily-co/config-plugin-rn-daily-js to include this 'event-target-shim' version check.

I will rebuild completely, test & then close this issue if all works. Please give me a day. Thanks.

badhrin commented 7 months ago

@filipi87 - Thank you for the response. Fixed the issue. To help others in the future, please see if you can update the documentation at https://www.npmjs.com/package/@daily-co/config-plugin-rn-daily-js to include this 'event-target-shim' version check.

I will rebuild completely, test & then close this issue if all works. Please give me a day. Thanks.

badhrin commented 7 months ago

@filipi87 - Thank you. Tested it & updating 'event-target-shim' fixed the issue.

filipi87 commented 7 months ago

That is great to hear @badhrin. And thanks for your suggestion, I will add a troubleshooting session inside our plugin. 🙂