Skip to content

Commit

Permalink
Migrate proj to RN 0.69.2 (#26)
Browse files Browse the repository at this point in the history
* Upgrade react-native to 0.69.2
   - Tested on iOS build

* Upgrade reanimated to v3 for Android build
   - Related software-mansion/react-native-reanimated#3310

* Update packages to recent
   - Tested on iOS, Android and web

* Remove all useless tests for now

* Add Sponsor page

* Fix craco build

   - Related rails/webpacker#3008

* Downgrade react-native-reanimated on deploy
  • Loading branch information
hyochan committed Jul 21, 2022
1 parent d33f5a5 commit f97e2e5
Show file tree
Hide file tree
Showing 59 changed files with 1,894 additions and 2,778 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/deploy-pull-request.yml
Expand Up @@ -12,6 +12,9 @@ jobs:
- name: Install packages
run: yarn

- name: Downgrade reanimated
run: yarn add react-native-reanimated

- name: Build craco
run: SKIP_PREFLIGHT_CHECK=true yarn build
env:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Expand Up @@ -15,6 +15,9 @@ jobs:
- name: Install packages
run: yarn

- name: Downgrade reanimated
run: yarn add react-native-reanimated

- name: Build craco
run: SKIP_PREFLIGHT_CHECK=true yarn build
env:
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Expand Up @@ -20,6 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local
project.xcworkspace

# Android/IntelliJ
Expand Down Expand Up @@ -53,9 +54,10 @@ buck-out/
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
@@ -1 +1 @@
2.7.4
2.7.5
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,4 +1,4 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.4'
ruby '2.7.5'
gem 'cocoapods', '~> 1.11', '>= 1.11.2'
15 changes: 10 additions & 5 deletions android/app/build.gradle
Expand Up @@ -152,7 +152,8 @@ android {
"GENERATED_SRC_DIR=$buildDir/generated/source",
"PROJECT_BUILD_DIR=$buildDir",
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"NODE_MODULES_DIR=$rootDir/../node_modules"
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
cppFlags "-std=c++17"
// Make sure this target name is the same you specify inside the
Expand Down Expand Up @@ -272,9 +273,9 @@ dependencies {
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
exclude group:'com.facebook.fbjni'
}
} else {
implementation jscFlavor
}
Expand All @@ -287,7 +288,11 @@ if (isNewArchitectureEnabled()) {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.facebook.react:react-native"))
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
.using(project(":ReactAndroid"))
.because("On New Architecture we're building React Native from source")
substitute(module("com.facebook.react:hermes-engine"))
.using(project(":ReactAndroid:hermes-engine"))
.because("On New Architecture we're building Hermes from source")
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions android/app/src/main/java/com/dooboolab/app/MainActivity.java
Expand Up @@ -54,6 +54,13 @@ protected ReactRootView createRootView() {
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
return reactRootView;
}

@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
}

@Override
Expand Down
Expand Up @@ -15,8 +15,8 @@
import com.facebook.react.bridge.UIManager;
import com.facebook.react.fabric.ComponentFactory;
import com.facebook.react.fabric.CoreComponentsRegistry;
import com.facebook.react.fabric.EmptyReactNativeConfig;
import com.facebook.react.fabric.FabricJSIModuleProvider;
import com.facebook.react.fabric.ReactNativeConfig;
import com.facebook.react.uimanager.ViewManagerRegistry;
import com.dooboolab.app.BuildConfig;
import com.dooboolab.app.newarchitecture.components.MainComponentsRegistry;
Expand Down Expand Up @@ -92,7 +92,7 @@ public JSIModuleProvider<UIManager> getJSIModuleProvider() {
return new FabricJSIModuleProvider(
reactApplicationContext,
componentFactory,
new EmptyReactNativeConfig(),
ReactNativeConfig.DEFAULT_CONFIG,
viewManagerRegistry);
}
});
Expand Down
3 changes: 1 addition & 2 deletions android/app/src/main/jni/Android.mk
Expand Up @@ -21,8 +21,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_SHARED_LIBRARIES := \
libfabricjni \
libfbjni \
libfolly_futures \
libfolly_json \
libfolly_runtime \
libglog \
libjsi \
libreact_codegen_rncore \
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Expand Up @@ -14,9 +14,9 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2")
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 2 additions & 0 deletions android/settings.gradle
Expand Up @@ -6,6 +6,8 @@ includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
include(":ReactAndroid")
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
include(":ReactAndroid:hermes-engine")
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
}

include ':react-native-vector-icons'
Expand Down
3 changes: 3 additions & 0 deletions babel.config.js
Expand Up @@ -24,6 +24,9 @@ const babel = {
'@babel/plugin-syntax-class-properties',
'babel-plugin-styled-components',
'react-native-reanimated/plugin',
['@babel/plugin-proposal-class-properties', {loose: true}],
['@babel/plugin-proposal-private-methods', {loose: true}],
['@babel/plugin-proposal-private-property-in-object', {loose: true}],
],
};

Expand Down
12 changes: 5 additions & 7 deletions ios/Podfile
@@ -1,9 +1,11 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

production = ENV["PRODUCTION"] == "1"

target 'dooboolab' do
config = use_native_modules!

Expand All @@ -13,8 +15,10 @@ target 'dooboolab' do
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:production => production,
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.enabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
Expand All @@ -24,12 +28,6 @@ target 'dooboolab' do
# Pods for testing
end

# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()

post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
Expand Down

0 comments on commit f97e2e5

Please sign in to comment.