Last active
September 19, 2019 21:24
-
-
Save brentvatne/a3bd2e5b7615daee418d596e89393557 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.doingmything; | |
import android.app.Application; | |
import android.util.Log; | |
import com.doingmything.generated.BasePackageList; | |
import org.unimodules.adapters.react.ModuleRegistryAdapter; | |
import org.unimodules.adapters.react.ReactModuleRegistryProvider; | |
import org.unimodules.core.interfaces.SingletonModule; | |
import com.facebook.react.PackageList; | |
import com.facebook.hermes.reactexecutor.HermesExecutorFactory; | |
import com.facebook.react.bridge.JavaScriptExecutorFactory; | |
import com.facebook.react.ReactApplication; | |
import com.facebook.react.ReactNativeHost; | |
import com.facebook.react.ReactPackage; | |
import com.facebook.soloader.SoLoader; | |
import java.util.Arrays; | |
import java.util.List; | |
public class MainApplication extends Application implements ReactApplication { | |
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), Arrays.<SingletonModule>asList()); | |
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { | |
@Override | |
public boolean getUseDeveloperSupport() { | |
return BuildConfig.DEBUG; | |
} | |
@Override | |
protected List<ReactPackage> getPackages() { | |
@SuppressWarnings("UnnecessaryLocalVariable") | |
List<ReactPackage> packages = new PackageList(this).getPackages(); | |
// Packages that cannot be autolinked yet can be added manually here, for example: | |
// packages.add(new MyReactNativePackage()); | |
// Add unimodules | |
List<ReactPackage> unimodules = Arrays.<ReactPackage>asList( | |
new ModuleRegistryAdapter(mModuleRegistryProvider) | |
); | |
packages.addAll(unimodules); | |
return packages; | |
} | |
@Override | |
protected String getJSMainModuleName() { | |
return "index"; | |
} | |
}; | |
@Override | |
public ReactNativeHost getReactNativeHost() { | |
return mReactNativeHost; | |
} | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
SoLoader.init(this, /* native exopackage */ false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment