Skip to content

Commit

Permalink
chore: expo update
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Nov 21, 2024
1 parent 18d5ad9 commit 6ac6d80
Show file tree
Hide file tree
Showing 13 changed files with 2,208 additions and 124 deletions.
7 changes: 7 additions & 0 deletions apps/wallet/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]

// EXPO
// Bundle with Expo CLI
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim())
cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
bundleCommand = "export:embed"
// END EXPO
}

/**
Expand Down
10 changes: 8 additions & 2 deletions apps/wallet/android/app/src/main/java/com/yoroi/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.yoroi

// EXPO
import expo.modules.ReactActivityDelegateWrapper
// END EXPO

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
Expand All @@ -17,6 +21,8 @@ class MainActivity : ReactActivity() {
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
// EXPO
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}
ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled))
// END EXPO
}
42 changes: 30 additions & 12 deletions apps/wallet/android/app/src/main/java/com/yoroi/MainApplication.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package com.yoroi

// EXPO
import android.content.res.Configuration
import expo.modules.ApplicationLifecycleDispatcher
import expo.modules.ReactNativeHostWrapper
// END EXPO

import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
Expand All @@ -13,24 +19,26 @@ import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {

// EXPO - ReactNativeHostWrapper // getDefaultReactHost
override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}
ReactNativeHostWrapper(this, object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}

override fun getJSMainModuleName(): String = "index"
override fun getJSMainModuleName(): String = "index"

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
})

override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)
get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)
// END EXPO

override fun onCreate() {
super.onCreate()
Expand All @@ -39,5 +47,15 @@ class MainApplication : Application(), ReactApplication {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
// EXPO
ApplicationLifecycleDispatcher.onApplicationCreate(this)
// END EXPO
}

// EXPO
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
}
// END EXPO
}
5 changes: 5 additions & 0 deletions apps/wallet/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ rootProject.name = 'yoroi'
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')

// EXPO
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
// END EXPO
15 changes: 15 additions & 0 deletions apps/wallet/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# EXPO
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
# END EXPO

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
Expand All @@ -15,6 +19,17 @@ if linkage != nil
end

target 'yoroi' do
# EXPO
use_expo_modules!
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
# END EXPO

config = use_native_modules!

use_react_native!(
Expand Down
Loading

0 comments on commit 6ac6d80

Please sign in to comment.