Skip to content

Commit ce61c9b

Browse files
authored
Compatibility with the New Architecture #341
ref DEV-2483
2 parents e64eeef + 23ffe95 commit ce61c9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3631
-1928
lines changed

example/reactnative/.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23-
ios/.xcode.env.local
23+
**/.xcode.env.local
2424

2525
# Android/IntelliJ
2626
#
@@ -60,11 +60,19 @@ yarn-error.log
6060
*.jsbundle
6161

6262
# Ruby / CocoaPods
63-
/ios/Pods/
63+
**/Pods/
6464
/vendor/bundle/
6565

6666
# Temporary files created by Metro to check the health of the file watcher
6767
.metro-health-check*
6868

6969
# testing
7070
/coverage
71+
72+
# Yarn
73+
.yarn/*
74+
!.yarn/patches
75+
!.yarn/plugins
76+
!.yarn/releases
77+
!.yarn/sdks
78+
!.yarn/versions

example/reactnative/Gemfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
gem 'cocoapods', '~> 1.15'
7-
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9+
gem 'xcodeproj', '< 1.26.0'

example/reactnative/Gemfile.lock

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ PLATFORMS
9393
ruby
9494

9595
DEPENDENCIES
96-
activesupport (>= 6.1.7.3, < 7.1.0)
97-
cocoapods (~> 1.15)
96+
activesupport (>= 6.1.7.5, != 7.1.0)
97+
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
98+
xcodeproj (< 1.26.0)
9899

99100
RUBY VERSION
100101
ruby 3.0.7p220

example/reactnative/android/app/build.gradle

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

45
import com.android.build.OutputFile
@@ -9,14 +10,14 @@ import com.android.build.OutputFile
910
*/
1011
react {
1112
/* Folders */
12-
// The root of your project, i.e. where "package.json" lives. Default is '..'
13-
// root = file("../")
14-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
15-
// reactNativeDir = file("../node_modules/react-native")
16-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
17-
// codegenDir = file("../node_modules/react-native-codegen")
18-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
19-
// cliFile = file("../node_modules/react-native/cli.js")
13+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
14+
// root = file("../../")
15+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
16+
// reactNativeDir = file("../../node_modules/react-native")
17+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
18+
// codegenDir = file("../../node_modules/@react-native/codegen")
19+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
20+
// cliFile = file("../../node_modules/react-native/cli.js")
2021

2122
/* Variants */
2223
// The list of variants to that are debuggable. For those we're going to
@@ -50,6 +51,9 @@ react {
5051
//
5152
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5253
// hermesFlags = ["-O", "-output-source-map"]
54+
55+
/* Autolinking */
56+
autolinkLibrariesWithApp()
5357
}
5458

5559
/**
@@ -91,6 +95,7 @@ def reactNativeArchitectures() {
9195
android {
9296
ndkVersion rootProject.ext.ndkVersion
9397

98+
buildToolsVersion rootProject.ext.buildToolsVersion
9499
compileSdkVersion rootProject.ext.compileSdkVersion
95100

96101
namespace "com.reactnativeexample"
@@ -153,20 +158,12 @@ dependencies {
153158
// The version of react-native is set by the React Native Gradle Plugin
154159
implementation("com.facebook.react:react-android")
155160

156-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
157-
implementation "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5"
158-
159-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
160-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
161-
exclude group:'com.squareup.okhttp3', module:'okhttp'
162-
}
163-
164-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
165161
if (hermesEnabled.toBoolean()) {
166162
implementation("com.facebook.react:hermes-android")
167163
} else {
168164
implementation jscFlavor
169165
}
170-
}
171166

172-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
167+
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
168+
implementation "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5"
169+
}

example/reactnative/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44

5-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6-
75
<application
86
android:usesCleartextTraffic="true"
97
tools:targetApi="28"
10-
tools:ignore="GoogleAppIndexingWarning">
11-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12-
</application>
8+
tools:ignore="GoogleAppIndexingWarning"/>
139
</manifest>

example/reactnative/android/app/src/debug/java/com/reactnativeexample/ReactNativeFlipper.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

example/reactnative/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
android:icon="@mipmap/ic_launcher"
1212
android:label="@string/app_name"
1313
android:roundIcon="@mipmap/ic_launcher_round"
14-
android:theme="@style/AppTheme">
14+
android:theme="@style/AppTheme"
15+
android:supportsRtl="true">
1516
<activity
1617
android:name=".MainActivity"
1718
android:label="@string/app_name"

example/reactnative/android/app/src/main/java/com/reactnativeexample/MainActivity.java

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.reactnativeexample
2+
3+
import com.facebook.react.ReactActivity
4+
import com.facebook.react.ReactActivityDelegate
5+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6+
import com.facebook.react.defaults.DefaultReactActivityDelegate
7+
8+
class MainActivity : ReactActivity() {
9+
10+
/**
11+
* Returns the name of the main component registered from JavaScript. This is used to schedule
12+
* rendering of the component.
13+
*/
14+
override fun getMainComponentName(): String = "reactNativeExample"
15+
16+
/**
17+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19+
*/
20+
override fun createReactActivityDelegate(): ReactActivityDelegate =
21+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22+
}

example/reactnative/android/app/src/main/java/com/reactnativeexample/MainApplication.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)