Skip to content

Commit

Permalink
Upgrade Expo in the example app to use API 47 (#2393)
Browse files Browse the repository at this point in the history
## Description

This PR updates the version of Expo used in the Example app.

## Test plan

Build the apps.
  • Loading branch information
j-piasecki committed Feb 1, 2023
1 parent 0bfaee1 commit 5184dfe
Show file tree
Hide file tree
Showing 10 changed files with 2,302 additions and 414 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.example;
import expo.modules.ReactActivityDelegateWrapper;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
Expand All @@ -23,13 +24,13 @@ protected String getMainComponentName() {
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new DefaultReactActivityDelegate(
return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(
this,
getMainComponentName(),
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
// If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
);
));
}
}
14 changes: 12 additions & 2 deletions example/android/app/src/main/java/com/example/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package com.example;
import android.content.res.Configuration;
import expo.modules.ApplicationLifecycleDispatcher;
import expo.modules.ReactNativeHostWrapper;

import android.app.Application;
import com.facebook.react.PackageList;
Expand All @@ -17,7 +20,7 @@
public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost =
new DefaultReactNativeHost(this) {
new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand Down Expand Up @@ -51,7 +54,7 @@ protected boolean isNewArchEnabled() {
protected Boolean isHermesEnabled() {
return BuildConfig.IS_HERMES_ENABLED;
}
};
});

@Override
public ReactNativeHost getReactNativeHost() {
Expand All @@ -70,5 +73,12 @@ public void onCreate() {
DefaultNewArchitectureEntryPoint.load();
}
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
ApplicationLifecycleDispatcher.onApplicationCreate(this);
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
}
3 changes: 3 additions & 0 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ project(':react-native-gesture-handler').projectDir = new File(rootProject.proje

includeBuild('../node_modules/react-native-gradle-plugin')


apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
52 changes: 48 additions & 4 deletions example/ios/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
2DCD954D1E0B4F2C00145EB5 /* ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ExampleTests.m */; };
2F1D662A185DD3E2F0338B89 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE9C1D91E37ADD17F7A703C /* ExpoModulesProvider.swift */; };
3610E109E3F6073725279D70 /* libPods-Example-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E62DF0349116432B5D02950 /* libPods-Example-tvOSTests.a */; };
400FB76F50DA8968079AA333 /* libPods-Example-ExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 71ADDDC51AF7F6FE7B343819 /* libPods-Example-ExampleTests.a */; };
5EB3A081104A1A13FD30D49C /* libPods-Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CF9B1F588CBFCEC2DA261371 /* libPods-Example.a */; };
73306277A9ADAC65961EC68F /* libPods-Example-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FB05F131CCFB9A046171ACF /* libPods-Example-tvOS.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
EF4B1C90A49E5F01CB0F5304 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 348A103064CE474B5026E041 /* ExpoModulesProvider.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -56,6 +58,8 @@
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = "<group>"; };
2D02E47B1E0B4A5D006451C7 /* Example-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* Example-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Example-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
348A103064CE474B5026E041 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-Example-ExampleTests/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
3CE9C1D91E37ADD17F7A703C /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-Example/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
4DB2D12D66B5397160762CAB /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
4FB05F131CCFB9A046171ACF /* libPods-Example-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
55726943FB7CA3950AB60EFD /* Pods-Example-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-Example-tvOSTests/Pods-Example-tvOSTests.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -141,6 +145,14 @@
name = Example;
sourceTree = "<group>";
};
19EC2249A7C6F13F3DDD6A6C /* Example */ = {
isa = PBXGroup;
children = (
3CE9C1D91E37ADD17F7A703C /* ExpoModulesProvider.swift */,
);
name = Example;
sourceTree = "<group>";
};
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -170,6 +182,7 @@
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
BFD7C1243C4B42792CA781B0 /* Pods */,
F6E36B3556DBEA8619B4A5DA /* ExpoModulesProviders */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand All @@ -187,6 +200,14 @@
name = Products;
sourceTree = "<group>";
};
8419259CDE3B4CE6F9890EDC /* ExampleTests */ = {
isa = PBXGroup;
children = (
348A103064CE474B5026E041 /* ExpoModulesProvider.swift */,
);
name = ExampleTests;
sourceTree = "<group>";
};
BFD7C1243C4B42792CA781B0 /* Pods */ = {
isa = PBXGroup;
children = (
Expand All @@ -202,6 +223,15 @@
path = Pods;
sourceTree = "<group>";
};
F6E36B3556DBEA8619B4A5DA /* ExpoModulesProviders */ = {
isa = PBXGroup;
children = (
19EC2249A7C6F13F3DDD6A6C /* Example */,
8419259CDE3B4CE6F9890EDC /* ExampleTests */,
);
name = ExpoModulesProviders;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -394,10 +424,12 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -426,10 +458,12 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -619,6 +653,7 @@
buildActionMask = 2147483647;
files = (
00E356F31AD99517003FC87E /* ExampleTests.m in Sources */,
EF4B1C90A49E5F01CB0F5304 /* ExpoModulesProvider.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -629,6 +664,7 @@
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
110A0048258675A500B148CB /* MBFingerTipWindow.m in Sources */,
2F1D662A185DD3E2F0338B89 /* ExpoModulesProvider.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -675,13 +711,14 @@
"$(inherited)",
);
INFOPLIST_FILE = ExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"$(inherited)",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
Expand All @@ -695,13 +732,14 @@
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = ExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"$(inherited)",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
Expand All @@ -726,6 +764,7 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.Example;
PRODUCT_NAME = Example;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -752,6 +791,7 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.Example;
PRODUCT_NAME = Example;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -780,6 +820,7 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
Expand Down Expand Up @@ -808,6 +849,7 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
Expand Down Expand Up @@ -835,6 +877,7 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
Expand Down Expand Up @@ -862,6 +905,7 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
Expand Down Expand Up @@ -918,7 +962,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
Expand Down Expand Up @@ -973,7 +1017,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
Expand Down
3 changes: 2 additions & 1 deletion example/ios/Example/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <RCTAppDelegate.h>
#import <Expo/Expo.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : RCTAppDelegate
@interface AppDelegate : EXAppDelegateWrapper

@end
6 changes: 3 additions & 3 deletions example/ios/Example/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ - (BOOL)concurrentRootEnabled
// InitializeFlipper(application);
// #endif

// RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
// RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
// RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
// RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge
// moduleName:@"Example"
// initialProperties:nil];

Expand All @@ -77,7 +77,7 @@ - (BOOL)concurrentRootEnabled
// MBFingerTipWindow *window = [[MBFingerTipWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
// window.alwaysShowTouches = YES;
// self.window = window;
// UIViewController *rootViewController = [UIViewController new];
// UIViewController *rootViewController = [self.reactDelegate createRootViewController];
// rootViewController.view = rootView;
// self.window.rootViewController = rootViewController;
// [self.window makeKeyAndVisible];
Expand Down
11 changes: 10 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, min_ios_version_supported
platform :ios, '13.0'
prepare_react_native_project!

flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
Expand All @@ -13,6 +14,14 @@ if linkage != nil
end

target 'Example' do
use_expo_modules!
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
config = use_native_modules!

# Flags change depending on the env values.
Expand Down
Loading

0 comments on commit 5184dfe

Please sign in to comment.