Installation
Beta
Requirements
- React Native 0.76.0+ (New Architecture required)
- React 18.2.0+
- iOS 14.0+
- Android API 26+ (Android 8.0)
Installation
npm install @upscopeio/react-native-sdk
iOS Setup
The React Native SDK depends on the native UpscopeSDK iOS framework, which must be added via Swift Package Manager:
- Open your iOS project in Xcode (
ios/YourApp.xcworkspace) - Go to File > Add Package Dependencies
- Enter
https://github.com/upscopeio/cobrowsing-ios.git - Select the version and add to your app target
Then install the CocoaPods bridge:
cd ios && pod install
Android Setup
No additional steps required. The native Android SDK is linked automatically via Gradle.
Initialization
Initialize the SDK early in your app, before any components that use Upscope hooks mount:
import Upscope from '@upscopeio/react-native-sdk';
Upscope.initialize({
apiKey: 'YOUR_API_KEY',
autoConnect: true,
});
Full Example
import React, { useEffect } from 'react';
import { SafeAreaView } from 'react-native';
import Upscope from '@upscopeio/react-native-sdk';
export default function App() {
useEffect(() => {
Upscope.initialize({
apiKey: 'YOUR_API_KEY',
autoConnect: true,
});
Upscope.updateConnection({
uniqueId: 'user-123',
callName: 'John Smith',
});
}, []);
return (
<SafeAreaView>
{/* Your app content */}
</SafeAreaView>
);
}
The SDK auto-connects by default. To disable this, set autoConnect: false and call Upscope.connect() manually when ready.
Public API Key
You can find your public API key in the installation page of your Co-Browsing API dashboard.
Full Device Screen Sharing
The React Native SDK supports full device screen sharing, but it requires platform-specific setup:
- iOS: Requires a Broadcast Upload Extension. See the iOS full device screen sharing guide.
- Android: Requires adding two permissions to your
AndroidManifest.xml. See the Android full device screen sharing guide.
Lookup Code on Shake
By default, shaking the device will display the lookup code in a dialog. This can be disabled via configuration options.