Is react-native-webrtc compatible with react-native-web?

I’m using Expo’s bare-workflow on an empty project to test the compatibility issues I’m facing. When I try to publish the project to the browser using expo start:web, I get an error like the following

/home/ben/github/react-native-rtc-barebones/node_modules/react-native-webrtc/ScreenCapturePickerView.js
Attempted import error: 'requireNativeComponent' is not exported from 'react-native-web/dist/index'.

/home/ben/github/react-native-rtc-barebones/node_modules/react-native-webrtc/RTCView.js
Attempted import error: 'requireNativeComponent' is not exported from 'react-native-web/dist/index'.

I simply created the project with expo init and selected blank typescript. I then added the react-native-webrtc dependency version 1.89.1.

As an aside, I’m developing on a Windows 10 machine with an iPhone. If I’m not able to use the browser with react-native-webrtc, do I have any options for development other than buying an android phone / buying a macbook?

If this is the case, I was thinking about trying out the RTCPeerConnection from the standard Javascript WebAPI’s, knowing that I’ll have to switch it out for react-native-webrtc once I get a device to develop with.

This repository demonstrates the problem. Clone it and run with npm run web.

Thanks!

Hey, did you figure this out? I want to simultaneously run both React-Native-Web & Native Application builds using Expo Managed Workflow and this import is giving me the same error on Web only.

@junaiddarajat @BenHunt

Did you ever figure this out? Running into the same issue using expo managed workflow, react-native-web 0.18 and latest versions of RN and react-native-webrtc

Hey @super-potion
Yeah, it all works! Notably thanks to Expo Config-Plugins, so just get latest Expo SDK, and put in react-native-webrtc config-plugin (official; by Evan Bacon); here is its link: @config-plugins/react-native-webrtc - npm

Ensure you follow the versioning.

All the best!

1 Like