This repository is the final implementation of How to build a React Native video chat app with Sendbird Calls tutorial.
This is a sample React Native app that demonstrates implementation of Sendbird Calls within a React Native application, being able to call another user and receive incoming calls with Push Notifications enabled for both Android and iOS.
The project is using react-native-webview
to make the above possible.
In order to use Sendbird Calls, you need to create a Sendbird application on the Sendbird Dashboard. You will then need the App ID of your Sendbird application, also found in the Sendbird Dashboard, in order to login to the Calls SDK.
From the root of the project run:
npm i && cd ios && pod install
This is the web app that goes inside WebView inside the React Native project.
From the root of the project run:
cd SendbirdCalls && npm i && npm run build
npm run ios
npm run android
⚠️ If you are testing the Android version on an emulator, make sure you close all emulator instances before runningnpm run android
, otherwise the metro server will be disconnected from the app in the emulator. When no emulator is running already, React Native scripts should start an emulator automatically and connect to the metro server successfully.
When working in the SendbirdCalls
directory which is not directly linked to react-native
scripts, you may want to automatically build the website and reload the Android emulator or device on each save/change of the files. To do that, run the following command:
cd SendbirdCalls && npm run watch
Error: "JSON value '1' of type NSNumber cannot be converted to NSString"
Remove allowReadAccessToURLs
attribute from the WebView
component if you have it set - Read more here.
Error after running
react-native run-ios
on macOS: "Build error domain=com.apple.CoreSimulator.SimError, code=405"
Run the same command with simulator name supplied:
react-native run-ios --simulator="iPhone 13"
White screen or HTTPS error
Need to visit the URL of the local server on http://localhost/
and not the IP that is returned from the StaticServer
component (i.e. 192.168.18.1
)
White screen or HTTPS error
-
Need to enable Cleartext traffic within
AndroidManifest.xml
(Follow “Enable Cleartext traffic on Android” step) - Read more here. -
If testing on an emulator with no Google Play services connected and auto-updates, make sure you update Google Play services and Android System WebView from Play store (Will auto-update on devices running Android Lollipop and above).
-
If you don’t see Android System WebView under Updates, you may have to enable it on the device from the App info section of the device settings. If you can’t enable it either, you may have to temporarily disable Chrome before enabling and updating the Android System WebView.
Error: “Unable to load script.Make sure you are either running a Metro server or that your bundle 'index.android.bundle' is packaged correctly for release”
Make sure you close all emulator instances before running npm run android
. React Native scripts should start an emulator automatically and connect to the metro server successfully.
Webview loads with error: "net::ERR_CONNECTION_REFUSED"
Need to set the localOnly
parameter to true
when creating a new static server (new StaticServer(PORT, path, {localOnly: true})
)