react-native-webrtc: [EXPO 50] Super Expression must either be null or a function

I’m using expo 50 dev client on Android

Whenever I write :

    import { mediaDevices } from "react-native-webrtc";

    const devices = await mediaDevices.getUserMedia({ video: true });

from MediaStreamTrackEvent.ts 18:43

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 34 (22 by maintainers)

Most upvoted comments

Yep, I’ll work on the downgrade as soon as I have some spare cycles…

I tried installing latest event-target-shim to my root project and it worked fine without breaking the app as it overrides default event-target-shim package installed while setting up the app. Still any update or workaround for this one without installing it explicitly?

I’d merge a PR with this workaround 😃

FWIW Changing the import form import { Event, EventTarget } from "event-target-shim" to import { Event, EventTarget } from "event-target-shim/index" fixed the issue for me

Would definitely be a viable solution vs reverting and using directive comments to ignore the compiler hell 😆

Maybe that’s an option indeed. Would you be able to submit a pr to that end?

Should be easy to revert since it’ll be 1 commit I hope…

It’s not a simple patch because the API changed.

Can you please share the whole backtrace?

Hey @saghul , I do not have the entire backtrace, or a full repro, but I’m pretty certain this is, to at least some extent, linked to this issue: https://github.com/react-native-webrtc/react-native-webrtc/issues/1488

It seems like starting from RN 0.73, there’s a mismatch in the expected version of event-target-shim. As you know, react-native-webrtc uses 6.0.2 of that dependency, but it seems like RN expects a different one (presumably 5.x), hence causing the error you see in the above issue. You can see additional discussion about this issue in the linked issue (#1488) as well as this one: https://github.com/GetStream/stream-video-js/issues/1231 (I think GetStream uses a fork of react-native-webrtc). I tried all of the proposed solutions I came across so far, but ultimately I was unable to completely fix it, there was always some kind of hermes failure on launch whenever I tried consuming react-native-webrtc.

There’s also a pending PR in https://github.com/expo/config-plugins/pull/211 which also highlights this issue.

I hope this gives at least a little direction on what might be the root issue here.