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

0 commit comments

Comments
 (0)