Using React Native

If you’re using React Native, you can embed Whereby rooms with just a few simple steps as laid out in this guide.

Before starting, you will need to add the corresponding permissions to be able to access both the camera and microphone as described in the Android and iOS sections.

Follow this guide to add and setup the react-native-webview library in your React Native project.

Finally, add the WebView component to your code, setup the properties and fill the room URL and parameters.

It's been reported that the Whereby camera and microphone modals that appear on hover, don't always properly close while running in the Android Simulator. If you experience this issue, try running your application on a physical device.

Here is a short example:

import React, { Component } from 'react';
import { WebView } from 'react-native-webview';

const roomUrl = ''; // Replace by your own
const roomParameters = '?needancestor&skipMediaPermissionPrompt';

export default class App extends Component {
  render() {
    return (
      <WebView
        startInLoadingState
        source={{ uri: roomUrl + roomParameters }}
        // If using html as source, you need to include baseUrl: "https://whereby.com" as a secondary prop
        mediaPlaybackRequiresUserAction={false}
        mediaCapturePermissionGrantType={'grant'}

        // iOS specific:
        allowsInlineMediaPlayback

        // Android specific:
        javaScriptEnabled
        domStorageEnabled
      />
    );
  }
}

Last updated