converting bare react to expo 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 {
//Add the line below as a class variable
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() {
//Add thoses lines(24 to 27) below in the getPackages function
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()