Skip to content

Commit bf6f379

Browse files
feat: redo rn 73 support (#7864)
* Redo rn 73 support * redo react native 73 support * Update package.json version to 7.38.5 [buildkite skip] * Added java 11 backward compatibility * Update package.json version to 7.38.6 [buildkite skip] * Fixed kotlin options --------- Co-authored-by: wixmobile <[email protected]>
1 parent 5777096 commit bf6f379

File tree

19 files changed

+107
-164
lines changed

19 files changed

+107
-164
lines changed

.buildkite/pipeline.yml

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

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
20

ReactNativeNavigation.podspec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,25 @@ Pod::Spec.new do |s|
1616

1717
s.module_name = 'ReactNativeNavigation'
1818
s.default_subspec = 'Core'
19-
19+
2020
s.subspec 'Core' do |ss|
2121
s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
2222
s.source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
2323
s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
2424
end
2525

2626
if fabric_enabled
27+
install_modules_dependencies(s)
28+
2729
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
2830
fabric_flags = fabric_enabled ? '-DRCT_NEW_ARCH_ENABLED' : ''
31+
2932
s.pod_target_xcconfig = {
30-
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core"',
33+
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core" "$(PODS_ROOT)/Headers/Private/Yoga"',
3134
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
35+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
3236
}
37+
3338
s.compiler_flags = folly_compiler_flags + ' ' + '-DRCT_NEW_ARCH_ENABLED'
3439
s.requires_arc = true
3540

@@ -45,6 +50,7 @@ Pod::Spec.new do |s|
4550
s.dependency "React-runtimeexecutor"
4651
s.dependency "React-rncore"
4752
end
53+
4854
s.dependency 'React-Core'
4955
s.dependency 'React-CoreModules'
5056
s.dependency 'React-RCTImage'

lib/android/app/build.gradle

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB )
2222
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')
2323
android {
2424
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
25-
buildToolsVersion = "33.0.0"
25+
buildToolsVersion = "34.0.0"
2626
defaultConfig {
2727
minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
2828
targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
@@ -56,7 +56,7 @@ android {
5656
def repeatLength = output.length()
5757
println '\n\n' + ('-' * repeatLength) + '\n' + output + '\n' + ('-' * repeatLength) + '\n'
5858

59-
println "see report at file://${t.reports.html.destination}/index.html"
59+
println "see report at file://${t.reports.html.outputLocation}/index.html"
6060
}
6161
}
6262
}
@@ -66,7 +66,11 @@ android {
6666
targetCompatibility JavaVersion.VERSION_1_8
6767
}
6868
kotlinOptions {
69-
jvmTarget = JavaVersion.VERSION_1_8
69+
if (reactNativeMinorVersion() >= 73) {
70+
jvmTarget = JavaVersion.VERSION_17
71+
} else {
72+
jvmTarget = JavaVersion.VERSION_11
73+
}
7074
}
7175

7276
flavorDimensions "RNN.reactNativeVersion"
@@ -122,6 +126,11 @@ android {
122126
}
123127
}
124128

129+
int reactNativeMinorVersion() {
130+
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
131+
reactNativeVersionComponents[1].toInteger()
132+
}
133+
125134
String resolveFlavor() {
126135
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
127136
Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()

lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ open class ButtonPresenter(private val context: Context, private val button: But
194194

195195
class WixAccessibilityDelegateCompat: AccessibilityDelegateCompat(){
196196
override fun onInitializeAccessibilityNodeInfo(
197-
host: View?,
198-
info: AccessibilityNodeInfoCompat?
197+
host: View,
198+
info: AccessibilityNodeInfoCompat
199199
) {
200200
super.onInitializeAccessibilityNodeInfo(host, info)
201201

lib/android/app/src/test/java/com/reactnativenavigation/EnvironmentTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
import static org.assertj.core.api.Java6Assertions.*;
1212

13+
import com.reactnativenavigation.R;
14+
1315
public class EnvironmentTest extends BaseTest {
1416
@Test
1517
public void assertJ() {
@@ -33,7 +35,7 @@ public void supportDesign() {
3335

3436
@Test
3537
public void androidR() {
36-
assertThat(R.string.bottom_sheet_behavior).isNotZero();
38+
assertThat(com.google.android.material.R.string.bottom_sheet_behavior).isNotZero();
3739
}
3840

3941
@Test

lib/android/app/src/test/java/com/reactnativenavigation/TestApplication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.Collections;
1010
import java.util.List;
1111

12+
1213
public class TestApplication extends Application implements ReactApplication {
1314
private final ReactNativeHost host = new ReactNativeHost(this) {
1415
@Override
@@ -25,7 +26,7 @@ protected List<ReactPackage> getPackages() {
2526
@Override
2627
public void onCreate() {
2728
super.onCreate();
28-
setTheme(R.style.Theme_AppCompat);
29+
setTheme(androidx.appcompat.R.style.Theme_AppCompat);
2930
}
3031

3132
@Override

lib/ios/RNNAppDelegate.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
#import "RCTLegacyInteropComponents.h"
77
#import <React/CoreModulesPlugins.h>
88
#import <React/RCTCxxBridgeDelegate.h>
9-
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
109
#import <React/RCTLegacyViewManagerInteropComponentView.h>
11-
#import <React/RCTRuntimeExecutorFromBridge.h>
1210
#import <React/RCTSurfacePresenter.h>
11+
#import <React/RCTSurfacePresenterStub.h>
1312
#import <React/RCTSurfacePresenterBridgeAdapter.h>
1413
#import <ReactCommon/RCTTurboModuleManager.h>
1514
#import <react/config/ReactNativeConfig.h>

lib/ios/RNNReactView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifdef RCT_NEW_ARCH_ENABLED
2-
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
2+
#import <React/RCTSurfaceHostingProxyRootView.h>
33
#else
44
#import <React/RCTRootView.h>
55
#endif
@@ -32,7 +32,7 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);
3232

3333
#ifdef RCT_NEW_ARCH_ENABLED
3434
@interface RNNReactView
35-
: RCTFabricSurfaceHostingProxyRootView <RCTRootViewDelegate, RNNComponentProtocol>
35+
: RCTSurfaceHostingProxyRootView <RCTRootViewDelegate, RNNComponentProtocol>
3636
#else
3737
@interface RNNReactView : RCTRootView <RCTRootViewDelegate, RNNComponentProtocol>
3838
#endif

lib/ios/RNNReactView.m renamed to lib/ios/RNNReactView.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#import "RNNReactView.h"
22
#import <React/RCTRootContentView.h>
33

4+
#ifdef RCT_NEW_ARCH_ENABLED
5+
#import <React/RCTFabricSurface.h>
6+
#endif
7+
48
@implementation RNNReactView {
59
BOOL _isAppeared;
610
}
@@ -11,10 +15,8 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
1115
eventEmitter:(RNNEventEmitter *)eventEmitter
1216
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
1317
reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
14-
self = [super initWithBridge:bridge
15-
moduleName:moduleName
16-
initialProperties:initialProperties
17-
sizeMeasureMode:sizeMeasureMode];
18+
RCTFabricSurface *surface = [[RCTFabricSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
19+
self = [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
1820
#else
1921
- (instancetype)initWithBridge:(RCTBridge *)bridge
2022
moduleName:(NSString *)moduleName

metro.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
const path = require('node:path');
12
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
23

34
const config = {
45
projectRoot: `${__dirname}`,
6+
resolver: {
7+
enableGlobalPackages: true,
8+
},
59
watchFolders: [__dirname],
610
};
711

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-navigation",
3-
"version": "7.38.4",
3+
"version": "7.38.6",
44
"description": "React Native Navigation - truly native navigation for iOS and Android",
55
"license": "MIT",
66
"nativePackage": true,
@@ -76,7 +76,10 @@
7676
"@babel/plugin-proposal-export-namespace-from": "7.10.1",
7777
"@babel/runtime": "7.22.6",
7878
"@babel/types": "7.22.5",
79-
"@react-native/metro-config": "^0.73.0",
79+
"@babel/preset-env": "^7.22.9",
80+
"@react-native/metro-config": "^0.73.2",
81+
"@react-native/babel-preset": "^0.73.18",
82+
"@react-native/typescript-config": "^0.73.1",
8083
"@react-native-community/blur": "^3.6.0",
8184
"@react-native-community/datetimepicker": "^3.4.7",
8285
"@react-native-community/eslint-config": "2.0.0",
@@ -94,7 +97,7 @@
9497
"@typescript-eslint/parser": "4.33.0",
9598
"babel-jest": "^27.0.0",
9699
"clang-format": "^1.4.0",
97-
"detox": "20.18.3",
100+
"detox": "20.19.5",
98101
"detox-testing-library-rnn-adapter": "^2.0.3",
99102
"eslint": "7.32.0",
100103
"eslint-config-prettier": "6.11.0",
@@ -109,7 +112,7 @@
109112
"pngjs": "^6.0.0",
110113
"prettier": "2.1.2",
111114
"react": "18.2.0",
112-
"react-native": "0.72.3",
115+
"react-native": "0.73.3",
113116
"react-native-fast-image": "^8.6.3",
114117
"react-native-gesture-handler": "^2.10.1",
115118
"react-native-reanimated": "^3.8.1",

playground/android/app/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ def jscFlavor = 'org.webkit:android-jsc:+'
1313
android {
1414
compileSdkVersion rootProject.ext.get("compileSdkVersion")
1515

16+
namespace "com.reactnativenavigation.playground"
17+
1618
compileOptions {
17-
sourceCompatibility JavaVersion.VERSION_1_8
18-
targetCompatibility JavaVersion.VERSION_1_8
19+
sourceCompatibility JavaVersion.VERSION_17
20+
targetCompatibility JavaVersion.VERSION_17
1921
}
2022

2123
defaultConfig {

playground/android/app/src/main/java/com/reactnativenavigation/playground/FragmentComponent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import androidx.annotation.NonNull;
1212
import androidx.fragment.app.FragmentActivity;
13+
import com.reactnativenavigation.R;
1314

1415
public class FragmentComponent implements ExternalComponent {
1516
private final FrameLayout content;

playground/android/build.gradle

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
buildscript {
44
ext {
5-
kotlinVersion = "1.7.10"
5+
kotlinVersion = "1.8.10"
66
RNNKotlinVersion = kotlinVersion
77
detoxKotlinVersion = kotlinVersion
8-
compileSdkVersion = 33
9-
buildToolsVersion = "33.0.0"
8+
compileSdkVersion = 34
9+
buildToolsVersion = "34.0.0"
1010
minSdkVersion = 21
11-
targetSdkVersion = 33
11+
targetSdkVersion = 34
1212
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
1313
ndkVersion = "23.1.7779620"
1414
}
@@ -36,3 +36,13 @@ allprojects {
3636
}
3737
}
3838
}
39+
40+
subprojects {
41+
afterEvaluate { p ->
42+
if (p.hasProperty('android')) {
43+
android {
44+
buildToolsVersion rootProject.ext.buildToolsVersion
45+
}
46+
}
47+
}
48+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Thu Jul 28 13:48:47 IDT 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

playground/ios/Podfile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ if linkage != nil
1515
use_frameworks! :linkage => linkage.to_sym
1616
end
1717

18-
# Execute the pre-install script before doing anything else
19-
system('node scripts/pre-install.js')
20-
2118

2219
def all_pods
2320
config = use_native_modules!
@@ -38,18 +35,11 @@ def all_pods
3835
end
3936

4037
post_install do |installer|
41-
__apply_Xcode_15_3_flipper_post_install_workaround(installer)
42-
43-
react_native_post_install(installer, "../../node_modules/react-native", :mac_catalyst_enabled => false)
44-
45-
__apply_Xcode_12_5_M1_post_install_workaround(installer)
46-
47-
# This is to resolve "'shared_timed_mutex' is unavailable: introduced in iOS 10.0" error
48-
installer.pods_project.targets.each do |t|
49-
t.build_configurations.each do |config|
50-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
51-
end
52-
end
38+
react_native_post_install(
39+
installer,
40+
"../../node_modules/react-native",
41+
:mac_catalyst_enabled => false
42+
)
5343
end
5444

5545
def __apply_Xcode_15_3_flipper_post_install_workaround(installer)

0 commit comments

Comments
 (0)