react-native expo bare setup code example
Example: install expo on react native bare project
npm install react-native-unimodules
Configuation ANDROID:
android/app/build.gradle :
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
addUnimodulesDependencies()
android/app/src/main/java/com/myapp/MainApplication.java :
import com.myapp.generated.BasePackageList;
import java.util.Arrays;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.SingletonModule;
public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), null);
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
List<ReactPackage> unimodules = Arrays.<ReactPackage>asList(
new ModuleRegistryAdapter(mModuleRegistryProvider)
);
packages.addAll(unimodules);
}
}
}
android/build.gradle :
minSdkVersion = 21
android/settings.gradle :
apply from: '../node_modules/react-native-unimodules/gradle.groovy';
includeUnimodulesProjects()