Upgrading version

We've listed the breaking changes between the two latest major versions to make your upgrading process easier.

Start method

From now, you can start Shake from javascript code for both Android and iOS by calling Shake.start() method. Client id and client secret keys are passed as parameters of Shake.start() method instead in .xml and .plist files.

Use:

index.js
import Shake from '@shakebugs/react-native-shake';
const initializeShake = () => {
Shake.start('client-id', 'client-secret');
}

Instead:

AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.shakebugs.APIClientID"
android:value="your-api-client-id" />
<meta-data
android:name="com.shakebugs.APIClientSecret"
android:value="your-api-client-secret" />
</application>
</manifest>
Info.plist
<?xml version="1.0" encoding="utf-8" ?>
<plist version="1.0">
<dict>
<key>Shake</key>
<dict>
<key>APIClientID</key>
<string>your-api-client-id</string>
<key>APIClientSecret</key>
<string>your-api-client-secret</string>
</dict>
</dict>
</plist>
MainApplication.java
import com.shakebugs.shake.Shake;
public class MainApplication extends Application implements ReactApplication {
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
Shake.start(this);
}
...
}
index.js
import Shake from '@shakebugs/react-native-shake';
const initializeShake = () => {
Shake.start();
}

Network tracker

Disabling and enabling network tracker is now done through Shake.setNetworkRequestsEnabled() method. If you want to enable network requests tracker, pass true as a parameter, otherwise pass false:

Use:

App.js
import Shake from '@shakebugs/react-native-shake';
const initializeShake = () => {
Shake.setNetworkRequestsEnabled(true);
Shake.start('client-id', 'client-secret');
}

Instead:

App.js
import Shake, { NetworkTracker } from '@shakebugs/react-native-shake';
const initializeShake = () => {
NetworkTracker.setEnabled(true);
Shake.start();
}

Quick facts

Quick facts are removed from SDK in favor of Metadata.

Use:

App.js
import Shake from '@shakebugs/react-native-shake';
const attachData = (user) => {
Shake.setMetadata('userId', user.id);
Shake.setMetadata('userName', user.name);
}

Instead:

App.js
import Shake from '@shakebugs/react-native-shake';
const attachData = (user) => {
Shake.setShakeReportData([], 'userId: ' + user.id + ' userName: ' + user.name);
}

Note that methods for sending silent reports and attaching files don't require quick facts anymore.