Skip to content

Instantly share code, notes, and snippets.

@EvanBacon
Last active November 29, 2021 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save EvanBacon/74ebb2321c614b58ff33130c5ec5496c to your computer and use it in GitHub Desktop.
Save EvanBacon/74ebb2321c614b58ff33130c5ec5496c to your computer and use it in GitHub Desktop.
Diff between SDK 42 & SDK 43 AppDelegate.m for user reference when updating dangerous Expo config plugins
diff --git a/templates/expo-template-bare-minimum/android/app/build.gradle b/templates/expo-template-bare-minimum/android/app/build.gradle
index 22354f0505..5af8ced73c 100644
--- a/templates/expo-template-bare-minimum/android/app/build.gradle
+++ b/templates/expo-template-bare-minimum/android/app/build.gradle
@@ -79,12 +79,10 @@ import com.android.build.OutputFile
project.ext.react = [
enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
+ cliPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute().text.trim(), "../cli.js"),
]
-apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
-apply from: "../../node_modules/react-native/react.gradle"
-apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle"
-apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
+apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute().text.trim(), "../react.gradle")
/**
* Set this to true to create two separate APKs instead of one:
@@ -187,6 +185,32 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
+
+ def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
+ def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
+ def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
+
+ // If your app supports Android versions before Ice Cream Sandwich (API level 14)
+ // All fresco packages should use the same version
+ if (isGifEnabled || isWebpEnabled) {
+ implementation 'com.facebook.fresco:fresco:2.0.0'
+ implementation 'com.facebook.fresco:imagepipeline-okhttp3:2.0.0'
+ }
+
+ if (isGifEnabled) {
+ // For animated gif support
+ implementation 'com.facebook.fresco:animated-gif:2.0.0'
+ }
+
+ if (isWebpEnabled) {
+ // For webp support
+ implementation 'com.facebook.fresco:webpsupport:2.0.0'
+ if (isWebpAnimatedEnabled) {
+ // Animated webp support
+ implementation 'com.facebook.fresco:animated-webp:2.0.0'
+ }
+ }
+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
@@ -198,12 +222,10 @@ dependencies {
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
- addUnimodulesDependencies()
if (enableHermes) {
- def hermesPath = "../../node_modules/hermes-engine/android/";
- debugImplementation files(hermesPath + "hermes-debug.aar")
- releaseImplementation files(hermesPath + "hermes-release.aar")
+ debugImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute().text.trim(), "../android/hermes-debug.aar"))
+ releaseImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute().text.trim(), "../android/hermes-release.aar"))
} else {
implementation jscFlavor
}
@@ -216,4 +238,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
into 'libs'
}
-apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
+apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute().text.trim(), "../native_modules.gradle");
+applyNativeModulesAppBuildGradle(project)
diff --git a/templates/expo-template-bare-minimum/android/build.gradle b/templates/expo-template-bare-minimum/android/build.gradle
index 4ff87f3b39..d815d27437 100644
--- a/templates/expo-template-bare-minimum/android/build.gradle
+++ b/templates/expo-template-bare-minimum/android/build.gradle
@@ -9,6 +9,7 @@ buildscript {
}
repositories {
google()
+ mavenCentral()
jcenter()
}
dependencies {
@@ -24,14 +25,15 @@ allprojects {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
- url("$rootDir/../node_modules/react-native/android")
+ url(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute().text.trim(), "../android"))
}
maven {
// Android JSC is installed from npm
- url("$rootDir/../node_modules/jsc-android/dist")
+ url(new File(["node", "--print", "require.resolve('jsc-android/package.json')"].execute().text.trim(), "../dist"))
}
google()
+ mavenCentral()
jcenter()
maven { url 'https://www.jitpack.io' }
}
diff --git a/templates/expo-template-bare-minimum/android/settings.gradle b/templates/expo-template-bare-minimum/android/settings.gradle
index 9ca2c96106..429185dcd4 100644
--- a/templates/expo-template-bare-minimum/android/settings.gradle
+++ b/templates/expo-template-bare-minimum/android/settings.gradle
@@ -1,9 +1,9 @@
rootProject.name = 'HelloWorld'
-apply from: '../node_modules/react-native-unimodules/gradle.groovy'
-includeUnimodulesProjects()
+apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute().text.trim(), "../scripts/autolinking.gradle");
+useExpoModules()
-apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
+apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute().text.trim(), "../native_modules.gradle");
applyNativeModulesSettingsGradle(settings)
include ':app'
diff --git a/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml b/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
index 136676d7c5..764b402b52 100644
--- a/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
+++ b/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
@@ -8,25 +8,20 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- END OPTIONAL PERMISSIONS -->
- <application
- android:name=".MainApplication"
- android:label="@string/app_name"
- android:icon="@mipmap/ic_launcher"
- android:roundIcon="@mipmap/ic_launcher_round"
- android:allowBackup="false"
- android:theme="@style/AppTheme"
- android:usesCleartextTraffic="true"
- >
+
+ <queries>
+ <!-- Support checking for http(s) links via the Linking API -->
+ <intent>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="https" />
+ </intent>
+ </queries>
+
+ <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="YOUR-APP-URL-HERE"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="YOUR-APP-SDK-VERSION-HERE"/>
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name"
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
- android:launchMode="singleTask"
- android:windowSoftInputMode="adjustResize"
- android:theme="@style/Theme.App.SplashScreen"
- >
+ <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
diff --git a/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.h b/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.h
index 1a1a48f662..f7d2972042 100644
--- a/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.h
+++ b/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.h
@@ -1,10 +1,9 @@
#import <Foundation/Foundation.h>
-#import <EXUpdates/EXUpdatesAppController.h>
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
-#import <UMCore/UMAppDelegateWrapper.h>
+#import <Expo/Expo.h>
-@interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate, EXUpdatesAppControllerDelegate>
+@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate>
@end
diff --git a/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m b/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m
index d7da3a9556..1b72e8cf15 100644
--- a/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m
+++ b/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m
@@ -4,12 +4,7 @@
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLinkingManager.h>
-
-#import <UMCore/UMModuleRegistry.h>
-#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
-#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
-#import <EXSplashScreen/EXSplashScreenService.h>
-#import <UMCore/UMModuleRegistryProvider.h>
+#import <React/RCTConvert.h>
#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
#import <FlipperKit/FlipperClient.h>
@@ -30,13 +25,6 @@ static void InitializeFlipper(UIApplication *application) {
}
#endif
-@interface AppDelegate () <RCTBridgeDelegate>
-
-@property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
-@property (nonatomic, strong) NSDictionary *launchOptions;
-
-@end
-
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -45,57 +33,40 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
InitializeFlipper(application);
#endif
- self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
- self.launchOptions = launchOptions;
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- #ifdef DEBUG
- [self initializeReactNativeApp];
- #else
- EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
- controller.delegate = self;
- [controller startAndShowLaunchScreen:self.window];
- #endif
-
- [super application:application didFinishLaunchingWithOptions:launchOptions];
-
- return YES;
-}
-
-- (RCTBridge *)initializeReactNativeApp
-{
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
- rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
+ id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
+ if (rootViewBackgroundColor != nil) {
+ rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
+ } else {
+ rootView.backgroundColor = [UIColor whiteColor];
+ }
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
- return bridge;
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
+
+ return YES;
}
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
- NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
- // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
- return extraModules;
+ // If you'd like to export some custom RCTBridgeModules, add them here!
+ return @[];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#ifdef DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
- return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
-- (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success {
- appController.bridge = [self initializeReactNativeApp];
- EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]];
- [splashScreenService showSplashScreenFor:self.window.rootViewController];
-}
-
// Linking API
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
return [RCTLinkingManager application:application openURL:url options:options];
diff --git a/templates/expo-template-bare-minimum/android/gradle.properties b/templates/expo-template-bare-minimum/android/gradle.properties
index 6af23af41e..8eac5b6986 100644
--- a/templates/expo-template-bare-minimum/android/gradle.properties
+++ b/templates/expo-template-bare-minimum/android/gradle.properties
@@ -31,3 +31,11 @@ FLIPPER_VERSION=0.54.0
# The hosted JavaScript engine
# Supported values: expo.jsEngine = "hermes" | "jsc"
expo.jsEngine=jsc
+
+# Enable GIF support in React Native images (~200 B increase)
+expo.gif.enabled=true
+# Enable webp support in React Native images (~85 KB increase)
+expo.webp.enabled=true
+# Enable animated webp support (~3.4 MB increase)
+# Disabled by default because iOS doesn't support animated webp
+expo.webp.animated=false
\ No newline at end of file
diff --git a/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainActivity.java b/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainActivity.java
index a6f936702c..0552dc593f 100644
--- a/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainActivity.java
+++ b/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainActivity.java
@@ -7,8 +7,7 @@ import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
-import expo.modules.splashscreen.singletons.SplashScreen;
-import expo.modules.splashscreen.SplashScreenImageResizeMode;
+import expo.modules.ReactActivityDelegateWrapper;
public class MainActivity extends ReactActivity {
@Override
@@ -18,28 +17,26 @@ public class MainActivity extends ReactActivity {
// This is required for expo-splash-screen.
setTheme(R.style.AppTheme);
super.onCreate(null);
- // SplashScreen.show(...) has to be called after super.onCreate(...)
- // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
- SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
}
+ /**
+ * Returns the name of the main component registered from JavaScript.
+ * This is used to schedule rendering of the component.
+ */
+ @Override
+ protected String getMainComponentName() {
+ return "main";
+ }
- /**
- * Returns the name of the main component registered from JavaScript.
- * This is used to schedule rendering of the component.
- */
- @Override
- protected String getMainComponentName() {
- return "main";
- }
-
- @Override
- protected ReactActivityDelegate createReactActivityDelegate() {
- return new ReactActivityDelegate(this, getMainComponentName()) {
- @Override
- protected ReactRootView createRootView() {
- return new RNGestureHandlerEnabledRootView(MainActivity.this);
- }
- };
- }
+ @Override
+ protected ReactActivityDelegate createReactActivityDelegate() {
+ return new ReactActivityDelegateWrapper(
+ this,
+ new ReactActivityDelegate(this, getMainComponentName()) {
+ @Override
+ protected ReactRootView createRootView() {
+ return new RNGestureHandlerEnabledRootView(MainActivity.this);
+ }
+ });
+ }
}
diff --git a/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainApplication.java b/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainApplication.java
index fe547ed446..9344a48676 100644
--- a/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainApplication.java
+++ b/templates/expo-template-bare-minimum/android/app/src/main/java/com/helloworld/MainApplication.java
@@ -2,38 +2,29 @@ package com.helloworld;
import android.app.Application;
import android.content.Context;
-import android.net.Uri;
+import android.content.res.Configuration;
+import androidx.annotation.NonNull;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
-import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
-import com.helloworld.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.updates.UpdatesController;
+import expo.modules.ApplicationLifecycleDispatcher;
+import expo.modules.ReactNativeHostWrapper;
import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
import java.util.List;
-import javax.annotation.Nullable;
public class MainApplication extends Application implements ReactApplication {
- private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
- new BasePackageList().getPackageList()
- );
-
- private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
+ private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(
+ this,
+ new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
@@ -41,8 +32,10 @@ public class MainApplication extends Application implements ReactApplication {
@Override
protected List<ReactPackage> getPackages() {
+ @SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
- packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
+ // Packages that cannot be autolinked yet can be added manually here, for example:
+ // packages.add(new MyReactNativePackage());
return packages;
}
@@ -55,25 +48,7 @@ public class MainApplication extends Application implements ReactApplication {
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}
-
- @Override
- protected @Nullable String getJSBundleFile() {
- if (BuildConfig.DEBUG) {
- return super.getJSBundleFile();
- } else {
- return UpdatesController.getInstance().getLaunchAssetFile();
- }
- }
-
- @Override
- protected @Nullable String getBundleAssetName() {
- if (BuildConfig.DEBUG) {
- return super.getBundleAssetName();
- } else {
- return UpdatesController.getInstance().getBundleAssetName();
- }
- }
- };
+ });
@Override
public ReactNativeHost getReactNativeHost() {
@@ -85,11 +60,14 @@ public class MainApplication extends Application implements ReactApplication {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
- if (!BuildConfig.DEBUG) {
- UpdatesController.initialize(this);
- }
-
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
+ ApplicationLifecycleDispatcher.onApplicationCreate(this);
+ }
+
+ @Override
+ public void onConfigurationChanged(@NonNull Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
/**
diff --git a/templates/expo-template-bare-minimum/package.json b/templates/expo-template-bare-minimum/package.json
index 4ceeaa7738..ee2c4a79de 100644
--- a/templates/expo-template-bare-minimum/package.json
+++ b/templates/expo-template-bare-minimum/package.json
@@ -1,7 +1,7 @@
{
"name": "expo-template-bare-minimum",
"description": "This bare project template includes a minimal setup for using unimodules with React Native.",
- "version": "42.0.11",
+ "version": "43.0.5",
"main": "index.js",
"scripts": {
"android": "react-native run-android",
@@ -10,20 +10,20 @@
"start": "react-native start"
},
"dependencies": {
- "expo": "~42.0.1",
- "expo-splash-screen": "~0.11.2",
- "expo-status-bar": "~1.0.4",
- "expo-updates": "~0.8.1",
- "react": "16.13.1",
- "react-dom": "16.13.1",
- "react-native": "~0.63.4",
+ "expo": "~43.0.0-beta.3",
+ "expo-splash-screen": "~0.13.1",
+ "expo-status-bar": "~1.1.0",
+ "expo-updates": "~0.10.2",
+ "react": "17.0.1",
+ "react-dom": "17.0.1",
+ "react-native": "0.64.2",
"react-native-gesture-handler": "~1.10.2",
"react-native-reanimated": "~2.2.0",
- "react-native-screens": "~3.4.0",
- "react-native-unimodules": "0.14.10",
- "react-native-web": "~0.13.12"
+ "react-native-safe-area-context": "3.3.2",
+ "react-native-screens": "~3.8.0",
+ "react-native-web": "0.17.1"
},
"devDependencies": {
- "@babel/core": "^7.9.0"
+ "@babel/core": "^7.12.9"
}
}
diff --git a/templates/expo-template-bare-minimum/ios/Podfile b/templates/expo-template-bare-minimum/ios/Podfile
index 28e8fbab33..64c0223c9e 100644
--- a/templates/expo-template-bare-minimum/ios/Podfile
+++ b/templates/expo-template-bare-minimum/ios/Podfile
@@ -1,21 +1,41 @@
-require_relative '../node_modules/react-native/scripts/react_native_pods'
-require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
-require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
+require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
+require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
+require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
-platform :ios, '11.0'
+platform :ios, '12.0'
+
+require 'json'
+podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}
target 'HelloWorld' do
- use_unimodules!
+ use_expo_modules!
config = use_native_modules!
- use_react_native!(:path => config["reactNativePath"])
+ use_react_native!(
+ :path => config[:reactNativePath],
+ :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes'
+ )
# Uncomment to opt-in to using Flipper
#
# if !ENV['CI']
# use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
- # post_install do |installer|
- # flipper_post_install(installer)
- # end
# end
+
+ post_install do |installer|
+ react_native_post_install(installer)
+
+ # Workaround `Cycle inside FBReactNativeSpec` error for react-native 0.64
+ # Reference: https://github.com/software-mansion/react-native-screens/issues/842#issuecomment-812543933
+ installer.pods_project.targets.each do |target|
+ if (target.name&.eql?('FBReactNativeSpec'))
+ target.build_phases.each do |build_phase|
+ if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
+ target.build_phases.move(build_phase, 0)
+ end
+ end
+ end
+ end
+ end
+
end
diff --git a/templates/expo-template-bare-minimum/ios/Podfile.properties.json b/templates/expo-template-bare-minimum/ios/Podfile.properties.json
new file mode 100644
index 0000000000..f6d872e81a
--- /dev/null
+++ b/templates/expo-template-bare-minimum/ios/Podfile.properties.json
@@ -0,0 +1,3 @@
+{
+ "expo.jsEngine": "jsc"
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment