HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

SDK 11.0 Migration Guide for React Native

This page covers the migration steps from previous versions of the SDK to Instabug Version 11.0+ for React Native apps.

Start the SDK from JavaScript only

Users are now able to initialize the SDK completely from JavaScript rather than having to write the initialization code for Android in the Java/Kotlin files. Android initialization is now consistent with how you used to initialize the SDK for iOS by using the same API i.e. Instabug.start.

Migrate the initialization code to JS

When migrating to the new initialization method, you'll need to follow the below steps:

  1. Remove Instabug’s native Android initialization code from android/app/src/main/java/<your_package>/MainApplication.java

  2. Initialize Instabug in your JavaScript, depending on the platforms you use:

import Instabug from 'instabug-reactnative';

Instabug.start('APP_TOKEN', [Instabug.invocationEvent.floatingButton]);
import { Platform } from 'react-native';
import Instabug from 'instabug-reactnative';

if (Platform.OS === 'ios') {
  Instabug.start('IOS_APP_TOKEN', [Instabug.invocationEvent.floatingButton]);
} else if (Platform.OS === 'android') {
  Instabug.start('ANDROID_APP_TOKEN', [Instabug.invocationEvent.floatingButton]);
}
import { Platform } from 'react-native';
import Instabug from 'instabug-reactnative';

if (Platform.OS === 'ios') {
  Instabug.start('APP_TOKEN', [Instabug.invocationEvent.floatingButton]);
}
  1. Use JavaScript APIs instead of the native Android builder methods.
Builder method (Native Android)JavaScript API
Builder.setInvocationEvent("button")Instabug.start("APP_TOKEN", Instabug.invocationEvent.floatingButton)
For other invocation events, check out the docs here.
Builder.setPrimaryColor("#1D82DC")Instabug.setPrimaryColor("#1D82DC")
Builder.setFloatingEdge("left") and Builder.setFloatingButtonOffsetFromTop(250)BugReporting.setFloatingButtonEdge(Instabug.floatingButtonEdge.left, 250)

Remove deprecated APIs

For the full list of the removed APIs and their alternatives (if applicable), please check the tables below.

Instabug

RemovedAlternative
startWithTokenstart
setAutoScreenRecordingEnabledBugReporting.setAutoScreenRecordingEnabled
setAutoScreenRecordingMaxDurationBugReporting.setAutoScreenRecordingMaxDuration
setCrashReportingEnabledCrashReporting.setEnabled
setDidSelectPromptOptionHandlerBugReporting.setDidSelectPromptOptionHandler
getUnreadMessagesCountReplies.getUnreadRepliesCount
setPushNotificationsEnabledReplies.setPushNotificationsEnabled
setEmailFieldRequiredForActionsBugReporting.setOptions
setFloatingButtonEdgeBugReporting.setFloatingButtonEdge
setStringToKeysetString
setEnabledAttachmentTypesBugReporting.setEnabledAttachmentTypes
identifyUserWithEmailBugReporting.identifyUser
logUserEventWithNamelogUserEvent
setChatNotificationEnabledReplies.setInAppNotificationsEnabled
setOnNewMessageHandlerReplies.setOnNewReplyReceivedHandler
setViewHierarchyEnabledBugReporting.setViewHierarchyEnabled
setSurveysEnabledSurveys.setEnabled
setEnableInAppNotificationSoundReplies.setInAppNotificationSound
reportJSExceptionCrashReporting.reportJSException
setVideoRecordingFloatingButtonPositionBugReporting.setVideoRecordingFloatingButtonPosition
setShouldShowSurveysWelcomeScreenSurveys.setShouldShowWelcomeScreen
invocationOptions enumBugReporting.option enum
strings.startChats-
strings.chatsNoConversationsHeadlineText-
strings.chatsHeaderTitle-

Bug Reporting

RemovedAlternative
invocationOptions enumoption enum
showWithOptionsshow
setInvocationOptionssetOptions

Replies

RemovedAlternative
setOnNewReplyReceivedCallbacksetOnNewReplyReceivedHandler

Surveys

RemovedAlternative
onShowCallbacksetOnShowHandler
onDismissCallbacksetOnDismissHandler

Removed APIs not marked as Deprecated

The below APIs were removed as well but were not marked as deprecated previously.

  1. Surveys.setThresholdForReshowingSurveyAfterDismiss
  2. Renamed BugReporting.setAutoScreenRecordingMaxDuration to BugReporting.setAutoScreenRecordingDurationIOS to target iOS only as the native Android API has been removed from the native SDK.
  3. Removed the string keys surveysCustomThanksTitle and surveysCustomThanksSubtitle