react-native
version >0.26
$ npm install https://github.com/Instabug/instabug-reactnative --save
$ react-native link instabug-reactnative
- Open your app
.xcodeproj
file - Add the following line to your "Podfile":
pod 'Instabug', '~> 6.0.0'
- run
pod install
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainApplication.java
-
Add
import com.instabug.reactlibrary.RNInstabugReactnativePackage;
to the imports at the top of the file
-
Add
new RNInstabugReactnativePackage("YOUR_ANDROID_APPLICATION_TOKEN",MainApplication.this,"INVOCATION_EVENT");
to the list returned by the getPackages()
method
2. Append the following lines to android/settings.gradle
:
```gradle
include ':instabug-reactnative'
project(':instabug-reactnative').projectDir = new File(rootProject.projectDir, '../node_modules/instabug-reactnative/android')
```
-
Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':instabug-reactnative')
import Instabug from'instabug-reactnative';
class testApp extends Component {
constructor() {
super();
Instabug.startWithToken('YOUR_TOKEN', Instabug.invocationEvent.floatingButton);
}
...
}
You can check the rest of the APIs here Wiki.
If your app doesn't already access the microphone or photo library, you'll need to add the following 2 keys to your app's info.plist file:
NSMicrophoneUsageDescription
NSPhotoLibraryUsageDescription
Usage
To initialize Instabug in your app, you only need to link instabug-reactnative correctly by overwriting
"YOUR_ANDROID_TOKEN" text by your android app token, "button" text by your desired invocation event, "light" text by your desired color theme, and can take a wide range of optional parameters for configuration.
- Open up
android/app/src/main/java/[...]/MainApplication.java
after linking the plugin, you should find the getPackages method looks like
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNInstabugReactnativePackage("YOUR_ANDROID_TOKEN",MainApplication.this,"button","light")
);
}
The invocation event can be specified as one of the following values:
value | native equivalent | description |
---|---|---|
'shake' | InstabugInvocationEvent.SHAKE | Shaking the device while in any screen to show the feedback form. |
'button' | InstabugInvocationEvent.FLOATING_BUTTON | Shows a floating button on top of all views, when pressed it takes a screenshot. |
'screenshot' | InstabugInvocationEvent.SCREENSHOT_GESTURE | Taking a screenshot using the Home+Lock buttons while in any screen to show the feedback form, substituted with IBGInvocationEventShake on iOS 6.1.3 and earlier. |
'swipe' | InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT | Swiping two fingers left while in any screen to show the feedback form. |
'none' | InstabugInvocationEvent.NONE | No event will be registered to show the feedback form, you'll need to code your own and call the method invoke. |
The InstabugColorTheme can be specified as one of the following values:
value | native equivalent | description |
---|---|---|
'light' | InstabugColorTheme.InstabugColorThemeLight | light theme is color theme to use for the SDK's UI |
'dark' | InstabugColorTheme.InstabugColorThemeDark | Dark theme is color theme to use for the SDK's UI |
This software is released under MIT License.
© 2016 Instabug. All rights reserved.