From a4bbd841367ce2fc7609993c103e821ad466ca60 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Wed, 29 Apr 2020 13:04:59 +0200 Subject: [PATCH] Completely removed expo from android project --- android/app/build.gradle | 15 ---------- .../application/MainApplication.java | 15 ---------- .../generated/BasePackageList.java | 16 ---------- android/settings.gradle | 3 -- babel.config.js | 12 ++------ index.js | 8 ++--- metro.config.js | 17 +++++++++++ package.json | 30 +++++++++---------- 8 files changed, 35 insertions(+), 81 deletions(-) delete mode 100644 android/app/src/main/java/fr/amicaleinsat/application/generated/BasePackageList.java create mode 100644 metro.config.js diff --git a/android/app/build.gradle b/android/app/build.gradle index f2abdae..0b9bd63 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -80,10 +80,7 @@ project.ext.react = [ enableHermes: true, ] -apply from: '../../node_modules/react-native-unimodules/gradle.groovy' apply from: "../../node_modules/react-native/react.gradle" - - apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" /** @@ -194,18 +191,6 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules - addUnimodulesDependencies([exclude: [ - 'expo-camera', - 'expo-barcode-scanner', - 'expo-error-recovery', - 'expo-image-loader', - 'expo-keep-awake', - 'expo-linear-gradient', - 'expo-location', - 'expo-web-browser', - 'expo-sqlite', - 'expo-image-loader', - ]]) if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; diff --git a/android/app/src/main/java/fr/amicaleinsat/application/MainApplication.java b/android/app/src/main/java/fr/amicaleinsat/application/MainApplication.java index fe0277b..01abb07 100644 --- a/android/app/src/main/java/fr/amicaleinsat/application/MainApplication.java +++ b/android/app/src/main/java/fr/amicaleinsat/application/MainApplication.java @@ -9,16 +9,6 @@ import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; -import fr.amicaleinsat.application.generated.BasePackageList; - -import org.unimodules.adapters.react.ReactAdapterPackage; -import org.unimodules.adapters.react.ModuleRegistryAdapter; -import org.unimodules.adapters.react.ReactModuleRegistryProvider; -import org.unimodules.core.interfaces.Package; -import org.unimodules.core.interfaces.SingletonModule; -import expo.modules.constants.ConstantsPackage; -import expo.modules.permissions.PermissionsPackage; -import expo.modules.filesystem.FileSystemPackage; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -26,10 +16,6 @@ import java.util.List; import javax.annotation.Nullable; 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 @@ -40,7 +26,6 @@ public class MainApplication extends Application implements ReactApplication { @Override protected List getPackages() { List packages = new PackageList(this).getPackages(); - packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider)); return packages; } diff --git a/android/app/src/main/java/fr/amicaleinsat/application/generated/BasePackageList.java b/android/app/src/main/java/fr/amicaleinsat/application/generated/BasePackageList.java deleted file mode 100644 index e899302..0000000 --- a/android/app/src/main/java/fr/amicaleinsat/application/generated/BasePackageList.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.amicaleinsat.application.generated; - -import java.util.Arrays; -import java.util.List; -import org.unimodules.core.interfaces.Package; - -public class BasePackageList { - public List getPackageList() { - return Arrays.asList( - new expo.modules.constants.ConstantsPackage(), - new expo.modules.filesystem.FileSystemPackage(), - new expo.modules.font.FontLoaderPackage(), - new expo.modules.permissions.PermissionsPackage() - ); - } -} diff --git a/android/settings.gradle b/android/settings.gradle index 4d5b74a..634b331 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,8 +1,5 @@ rootProject.name = 'Campus' -apply from: '../node_modules/react-native-unimodules/gradle.groovy' -includeUnimodulesProjects() - apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) diff --git a/babel.config.js b/babel.config.js index b462e8c..f842b77 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,11 +1,3 @@ -module.exports = function(api) { - api.cache(true); - return { - presets: ['babel-preset-expo', '@babel/preset-flow'], - env: { - production: { - plugins: ['react-native-paper/babel'], - }, - }, - }; +module.exports = { + presets: ['module:metro-react-native-babel-preset'], }; diff --git a/index.js b/index.js index 5036e53..afe81fd 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,4 @@ -import {registerRootComponent} from 'expo'; - +import {AppRegistry} from 'react-native'; import App from './App'; -// registerRootComponent calls AppRegistry.registerComponent('main', () => App); -// It also ensures that whether you load the app in the Expo client or in a native build, -// the environment is set up appropriately -registerRootComponent(App); +AppRegistry.registerComponent('main', () => App); \ No newline at end of file diff --git a/metro.config.js b/metro.config.js new file mode 100644 index 0000000..783f349 --- /dev/null +++ b/metro.config.js @@ -0,0 +1,17 @@ +/** + * Metro configuration for React Native + * https://github.com/facebook/react-native + * + * @format + */ + +module.exports = { + transformer: { + getTransformOptions: async () => ({ + transform: { + experimentalImportSupport: false, + inlineRequires: false, + }, + }), + }, +}; diff --git a/package.json b/package.json index 19b0c1b..477c4f8 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { + "name": "campus", + "version": "2.0.0", + "private": true, "scripts": { "start": "react-native start", "android": "react-native run-android", "ios": "react-native run-ios", - "web": "expo start --web", "test": "jest", - "testw": "jest --watch", - "testc": "jest --coverage" + "lint": "eslint ." }, "jest": { "preset": "react-native", @@ -24,7 +25,6 @@ "@react-navigation/drawer": "^5.1.1", "@react-navigation/native": "^5.0.9", "@react-navigation/stack": "^5.1.1", - "expo": "^37.0.0", "i18n-js": "^3.3.0", "react": "~16.9.0", "react-dom": "16.9.0", @@ -49,7 +49,6 @@ "react-native-safe-area-context": "0.7.3", "react-native-screens": "~2.2.0", "react-native-splash-screen": "^3.2.0", - "react-native-unimodules": "~0.9.0", "react-native-vector-icons": "^6.6.0", "react-native-web": "~0.11.7", "react-native-webview": "8.1.1", @@ -57,15 +56,14 @@ "react-navigation-header-buttons": "^3.0.5" }, "devDependencies": { - "@babel/core": "^7.9.0", - "babel-jest": "~25.2.6", - "jest": "^25.1.0", - "react-test-renderer": "^16.13.1", - "@babel/cli": "^7.8.4", - "@babel/preset-flow": "^7.9.0", - "babel-preset-expo": "^8.1.0", - "flow-bin": "^0.122.0", - "jest-extended": "^0.11.5" - }, - "private": true + "@babel/core": "^7.6.2", + "@babel/runtime": "^7.6.2", + "@react-native-community/eslint-config": "^0.0.5", + "babel-jest": "^24.9.0", + "eslint": "^6.5.1", + "jest": "^24.9.0", + "metro-react-native-babel-preset": "^0.58.0", + "react-test-renderer": "16.9.0", + "flow-bin": "^0.122.0" + } }