Skip to content

Commit 40d1d1d

Browse files
committed
feat: use expo
1 parent f2b770a commit 40d1d1d

18 files changed

+1066
-1014
lines changed

.github/workflows/assemble_android_debug.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ env:
1919
# 打包类型
2020
BUILD_TYPE: debug
2121
# 版本名称
22-
ANDROID_VERSION_NAME: 1.4.7
22+
ANDROID_VERSION_NAME: 1.5.0
2323
# 版本号
24-
ANDROID_VERSION_CODE: 14700
24+
ANDROID_VERSION_CODE: 15000
2525
# 密钥库文件
2626
ANDROID_KEYSTORE_FILE: debug.keystore
2727
# 密钥库口令

.github/workflows/assemble_android_release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ env:
1919
# 打包类型
2020
BUILD_TYPE: release
2121
# 版本名称
22-
ANDROID_VERSION_NAME: 1.4.7
22+
ANDROID_VERSION_NAME: 1.5.0
2323
# 版本号
24-
ANDROID_VERSION_CODE: 14700
24+
ANDROID_VERSION_CODE: 15000
2525
# 密钥库文件
2626
ANDROID_KEYSTORE_FILE: release.keystore
2727
# 密钥库口令

.github/workflows/assemble_ios_debug.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
APP_ID: ${{secrets.APP_ID}}
1717
APP_NAME: Taro
1818
BUILD_TYPE: debug
19-
IOS_VERSION_NUMBER: 1.4.7
19+
IOS_VERSION_NUMBER: 1.5.0
2020
IOS_TEAM_ID: ${{secrets.TEAM_ID}}
2121
IOS_PROVISIONING_PROFILE_SPECIFIER: ${{secrets.DEBUG_PROVISIONING_PROFILE_SPECIFIER}}
2222
IOS_CODE_SIGN_IDENTITY: iPhone Developer

.github/workflows/assemble_ios_release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ env:
1616
APP_ID: ${{secrets.APP_ID}}
1717
APP_NAME: Taro
1818
BUILD_TYPE: release
19-
IOS_VERSION_NUMBER: 1.4.7
20-
IOS_BUILD_NUMBER: 1.4.7.1
19+
IOS_VERSION_NUMBER: 1.5.0
20+
IOS_BUILD_NUMBER: 1.5.0.1
2121
IOS_TEAM_ID: ${{secrets.TEAM_ID}}
2222
IOS_PROVISIONING_PROFILE_SPECIFIER: ${{secrets.RELEASE_PROVISIONING_PROFILE_SPECIFIER}}
2323
IOS_CODE_SIGN_IDENTITY: iPhone Distribution

android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ android.applicationVariants.all {
275275
processManifestTask.doLast {
276276
def processResources = output.getProcessResourcesProvider().get()
277277
def manifestPath = processResources.manifestFile
278-
def manifestFile = file(manifestPath)
279-
def parser = new XmlParser()
278+
def manifestFile = file(manifestPath)
279+
def parser = new groovy.xml.XmlParser()
280280
def rootNode = parser.parse(manifestFile)
281281
extraPermissionsForDebug.each {
282282
rootNode.appendNode("uses-permission", ["android:name": "android.permission.$it"])

android/app/src/main/java/com/tarodemo/MainActivity.java

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
package com.tarodemo;
2+
import expo.modules.ReactActivityDelegateWrapper;
3+
import com.facebook.react.ReactActivityDelegate;
24
import android.os.Bundle; // here
35
import com.facebook.react.ReactActivity;
46
import com.tarodemo.devmanager.TaroDevManager;
@@ -28,4 +30,11 @@ public void finish() {
2830
protected String getMainComponentName() {
2931
return "taroDemo";
3032
}
33+
34+
@Override
35+
protected ReactActivityDelegate createReactActivityDelegate() {
36+
return new ReactActivityDelegateWrapper(this,
37+
new ReactActivityDelegate(this, getMainComponentName())
38+
);
39+
}
3140
}

android/app/src/main/java/com/tarodemo/MainApplication.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.tarodemo;
22

3+
import android.content.res.Configuration;
4+
import expo.modules.ApplicationLifecycleDispatcher;
5+
import expo.modules.ReactNativeHostWrapper;
6+
37
import android.app.Application;
48
import android.content.Context;
59

@@ -17,7 +21,7 @@ public class MainApplication extends Application implements ReactApplication {
1721

1822
@Override
1923
public ReactNativeHost getReactNativeHost() {
20-
return TaroDevManager.getReactNativeHost();
24+
return new ReactNativeHostWrapper(this, TaroDevManager.getReactNativeHost());
2125
}
2226

2327
@Override
@@ -31,6 +35,7 @@ public void onCreate() {
3135
super.onCreate();
3236
SoLoader.init(this, /* native exopackage */ false);
3337
//initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
38+
ApplicationLifecycleDispatcher.onApplicationCreate(this);
3439
}
3540

3641
public static MainApplication getInstance(){
@@ -67,4 +72,10 @@ private static void initializeFlipper(
6772
}
6873
}
6974
}
75+
76+
@Override
77+
public void onConfigurationChanged(Configuration newConfig) {
78+
super.onConfigurationChanged(newConfig);
79+
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
80+
}
7081
}

android/app/src/main/java/com/tarodemo/devmanager/TaroReactNativeHost.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.tarodemo.devmanager
22

33
import android.app.Application
4-
import com.facebook.react.*
5-
import com.tarodemo.BuildConfig
6-
import com.tarodemo.generated.BasePackageList
4+
import com.facebook.react.PackageList
5+
import com.facebook.react.ReactInstanceManager
6+
import com.facebook.react.ReactNativeHost
7+
import com.facebook.react.ReactPackage
78

89
class TaroReactNativeHost(application: Application) : ReactNativeHost(application) {
910

android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ buildscript {
1616
mavenCentral()
1717
}
1818
dependencies {
19-
classpath("com.android.tools.build:gradle:4.2.2")
19+
classpath("com.android.tools.build:gradle:7.1.2")
2020
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21'
2121
// NOTE: Do not place your application dependencies here; they belong
2222
// in the individual module build.gradle files
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

android/settings.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
rootProject.name = 'taroDemo'
2-
apply from: '../node_modules/react-native-unimodules/gradle.groovy'; includeUnimodulesProjects()
32
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
43
include ':app'
4+
5+
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
6+
useExpoModules()

ios/Podfile

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
12
require_relative '../node_modules/react-native/scripts/react_native_pods'
23
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
34

4-
platform :ios, '11.0'
5+
platform :ios, '12.0'
56

67
target 'taroDemo' do
8+
use_expo_modules!
9+
post_integrate do |installer|
10+
begin
11+
expo_patch_react_imports!(installer)
12+
rescue => e
13+
Pod::UI.warn e
14+
end
15+
end
716
config = use_native_modules!
817

918
use_react_native!(

0 commit comments

Comments
 (0)