React Native WebRTC TypeError

58 views Asked by At

I don't understand how to properly import components from webrtc into a project file without errors. When importing the lines:

import { RTCPeerConnection, RTCIceCandidate, RTCSessionDescription, RTCView, mediaDevices } from 'react-native-webrtc';

both from all components and a single component gives an error:

ERROR TypeError: Superexpression must be either null or a function, engine js: hermes ERROR Invariant Violation: "main" was not registered. This can happen if:

  • Metro (local dev server) is running from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • Module failed to load due to an error and AppRegistry.registerComponent was not called., js engine: hermes

Solutions taken:

  • reinstalling the library
  • project rebuild
  • restart Metro

Ideally, nothing else can influence this error, because exactly the same error occurs if you build a clean project with only this library and try to import it.

I will be very grateful for your help. I am trying to solve the problem for the second day. Thank you!

1

There are 1 answers

0
moises zurita On

That's because you're using the latest version of webrtc, and it's not fully compatible for some reason, you need to downgrade the version. Use npm i [email protected]