Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,59 +1,71 @@
package com.reactnative;

import android.app.Application;

import androidx.annotation.NonNull;

import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactHost;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactHost;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.soloader.SoLoader;

import java.util.List;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new DefaultReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
private final ReactNativeHost mReactNativeHost = new DefaultReactNativeHost(this) {
@Override
public List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new BacktraceDemoPackage());
return packages;
}

@Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new BacktraceDemoPackage());
return packages;
}
@Override
public String getJSMainModuleName() {
return "index";
}

@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
public boolean isNewArchEnabled() {
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}

@Override
public Boolean isHermesEnabled() {
return BuildConfig.IS_HERMES_ENABLED;
}
};

@NonNull
@Override
protected String getJSMainModuleName() {
return "index";
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
protected boolean isNewArchEnabled() {
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
public ReactHost getReactHost() {
return DefaultReactHost.getDefaultReactHost(getApplicationContext(), mReactNativeHost);
}

@Override
protected Boolean isHermesEnabled() {
return BuildConfig.IS_HERMES_ENABLED;
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for
// this app.
DefaultNewArchitectureEntryPoint.load();
public void onCreate() {
super.onCreate();
SoLoader.init(this, false);
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for
// this app.
DefaultNewArchitectureEntryPoint.load();
}
}
}
}
14 changes: 6 additions & 8 deletions examples/sdk/reactNative/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ BacktraceClient.initialize({
prop2: 123,
},
},
database: __DEV__
? undefined
: {
enable: true,
captureNativeCrashes: true,
createDatabaseDirectory: true,
path: `${BacktraceClient.applicationDataPath}/backtrace`,
},
database: {
enable: true,
captureNativeCrashes: true,
createDatabaseDirectory: true,
path: `${BacktraceClient.applicationDataPath}/backtrace`,
},
});

AppRegistry.registerComponent(appName, () => App);
Loading