📝 docs(README.md): remove extra newline for cleaner formatting

🔧 refactor(MainActivity.java, MainApplication.java): wrap ReactActivityDelegate and ReactNativeHost with Expo wrappers for better Expo compatibility
🔧 refactor(MyAwesomeProject.xcodeproj): update project settings for better compatibility with newer iOS versions and Expo
🔧 refactor(AppDelegate.h): change AppDelegate superclass to EXAppDelegateWrapper for Expo compatibility
🔧 refactor(Podfile): add Expo autolinking and patching, update iOS platform version for Expo compatibility
🔧 refactor(package.json): update Expo and related packages versions for better compatibility and add new Expo related dependencies
🔧 refactor(build.gradle, settings.gradle): update Android build tools and NDK versions, add Expo autolinking for better Expo compatibility
This commit is contained in:
Djalim Simaila 2024-03-27 10:34:34 +01:00
parent 871fabefc0
commit 11035e3a05
9 changed files with 55 additions and 21 deletions

View File

@ -1,2 +1,3 @@
# ClipSync-Mobile
hello

View File

@ -1,4 +1,5 @@
package com.myawesomeproject;
import expo.modules.ReactActivityDelegateWrapper;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
@ -23,13 +24,13 @@ public class MainActivity extends ReactActivity {
*/
@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
);
));
}
}

View File

@ -1,4 +1,7 @@
package com.myawesomeproject;
import android.content.res.Configuration;
import expo.modules.ApplicationLifecycleDispatcher;
import expo.modules.ReactNativeHostWrapper;
import android.app.Application;
import com.facebook.react.PackageList;
@ -13,7 +16,7 @@ import java.util.List;
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;
@ -42,7 +45,7 @@ public class MainApplication extends Application implements ReactApplication {
protected Boolean isHermesEnabled() {
return BuildConfig.IS_HERMES_ENABLED;
}
};
});
@Override
public ReactNativeHost getReactNativeHost() {
@ -58,5 +61,12 @@ public class MainApplication extends Application implements ReactApplication {
DefaultNewArchitectureEntryPoint.load();
}
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
ApplicationLifecycleDispatcher.onApplicationCreate(this);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
}

View File

@ -6,16 +6,16 @@ buildscript {
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
cmakeVersion = "3.28.1"
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
ndkVersion = "26.1.10909125"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.android.tools.build:gradle:7.4.1")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}

View File

@ -2,3 +2,6 @@ rootProject.name = 'MyAwesomeProject'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
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()

View File

@ -19,7 +19,7 @@
/* Begin PBXContainerItemProxy section */
00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
containerPortal = 83CBB9F71A601CBA00E9B192;
proxyType = 1;
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
remoteInfo = MyAwesomeProject;
@ -113,7 +113,7 @@
name = Libraries;
sourceTree = "<group>";
};
83CBB9F61A601CBA00E9B192 = {
83CBB9F61A601CBA00E9B192 /* PBXGroup */ = {
isa = PBXGroup;
children = (
13B07FAE1A68108700A75B9A /* MyAwesomeProject */,
@ -197,14 +197,14 @@
/* End PBXNativeTarget section */
/* Begin PBXProject section */
83CBB9F71A601CBA00E9B192 /* Project object */ = {
83CBB9F71A601CBA00E9B192 = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1210;
TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
TestTargetID = 13B07F861A680F5B00A75B9A;
TestTargetID = 13B07F861A680F5B00A75B9A /* MyAwesomeProject */;
};
13B07F861A680F5B00A75B9A = {
LastSwiftMigration = 1120;
@ -219,7 +219,7 @@
en,
Base,
);
mainGroup = 83CBB9F61A601CBA00E9B192;
mainGroup = 83CBB9F61A601CBA00E9B192 /* PBXGroup */;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectRoot = "";
@ -438,7 +438,7 @@
"$(inherited)",
);
INFOPLIST_FILE = MyAwesomeProjectTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -462,7 +462,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = MyAwesomeProjectTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -580,7 +580,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)",
@ -644,7 +644,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)",
@ -698,5 +698,5 @@
};
/* End XCConfigurationList section */
};
rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
rootObject = 83CBB9F71A601CBA00E9B192;
}

View File

@ -1,6 +1,7 @@
#import <RCTAppDelegate.h>
#import <Expo/Expo.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : RCTAppDelegate
@interface AppDelegate : EXAppDelegateWrapper
@end

View File

@ -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!
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
@ -22,6 +23,19 @@ if linkage != nil
end
target 'MyAwesomeProject' do
use_expo_modules!
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
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.

View File

@ -16,12 +16,16 @@
"@react-navigation/native-stack": "^6.9.12",
"@reduxjs/toolkit": "^1.9.3",
"axios": "^1.3.4",
"expo": "^48.0.9",
"expo": "^48.0.0",
"expo-cli": "^6.3.2",
"expo-constants": "^14.4.2",
"expo-modules-core": "^1.5.12",
"react": "18.2.0",
"react-native": "0.71.4",
"react-native-async-storage": "^0.0.1",
"react-native-paper": "^5.6.0",
"react-native-safe-area-context": "^4.9.0",
"react-native-safe-area-view": "^1.1.1",
"react-native-simple-toast": "^2.0.0",
"react-native-vector-icons": "^9.2.0",
"react-redux": "^8.0.5",