Skip to content

Commit

Permalink
feat: redo rn 73 support (#7864)
Browse files Browse the repository at this point in the history
* 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 <mobile1@wix.com>
  • Loading branch information
gosha212 and mobile1-internal authored Apr 7, 2024
1 parent 5777096 commit bf6f379
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 164 deletions.
61 changes: 0 additions & 61 deletions .buildkite/pipeline.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
10 changes: 8 additions & 2 deletions ReactNativeNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ Pod::Spec.new do |s|

s.module_name = 'ReactNativeNavigation'
s.default_subspec = 'Core'

s.subspec 'Core' do |ss|
s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
s.source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
end

if fabric_enabled
install_modules_dependencies(s)

folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
fabric_flags = fabric_enabled ? '-DRCT_NEW_ARCH_ENABLED' : ''

s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core"',
'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"',
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
}

s.compiler_flags = folly_compiler_flags + ' ' + '-DRCT_NEW_ARCH_ENABLED'
s.requires_arc = true

Expand All @@ -45,6 +50,7 @@ Pod::Spec.new do |s|
s.dependency "React-runtimeexecutor"
s.dependency "React-rncore"
end

s.dependency 'React-Core'
s.dependency 'React-CoreModules'
s.dependency 'React-RCTImage'
Expand Down
15 changes: 12 additions & 3 deletions lib/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB )
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')
android {
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
buildToolsVersion = "33.0.0"
buildToolsVersion = "34.0.0"
defaultConfig {
minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
Expand Down Expand Up @@ -56,7 +56,7 @@ android {
def repeatLength = output.length()
println '\n\n' + ('-' * repeatLength) + '\n' + output + '\n' + ('-' * repeatLength) + '\n'

println "see report at file://${t.reports.html.destination}/index.html"
println "see report at file://${t.reports.html.outputLocation}/index.html"
}
}
}
Expand All @@ -66,7 +66,11 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
if (reactNativeMinorVersion() >= 73) {
jvmTarget = JavaVersion.VERSION_17
} else {
jvmTarget = JavaVersion.VERSION_11
}
}

flavorDimensions "RNN.reactNativeVersion"
Expand Down Expand Up @@ -122,6 +126,11 @@ android {
}
}

int reactNativeMinorVersion() {
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
reactNativeVersionComponents[1].toInteger()
}

String resolveFlavor() {
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ open class ButtonPresenter(private val context: Context, private val button: But

class WixAccessibilityDelegateCompat: AccessibilityDelegateCompat(){
override fun onInitializeAccessibilityNodeInfo(
host: View?,
info: AccessibilityNodeInfoCompat?
host: View,
info: AccessibilityNodeInfoCompat
) {
super.onInitializeAccessibilityNodeInfo(host, info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

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

import com.reactnativenavigation.R;

public class EnvironmentTest extends BaseTest {
@Test
public void assertJ() {
Expand All @@ -33,7 +35,7 @@ public void supportDesign() {

@Test
public void androidR() {
assertThat(R.string.bottom_sheet_behavior).isNotZero();
assertThat(com.google.android.material.R.string.bottom_sheet_behavior).isNotZero();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Collections;
import java.util.List;


public class TestApplication extends Application implements ReactApplication {
private final ReactNativeHost host = new ReactNativeHost(this) {
@Override
Expand All @@ -25,7 +26,7 @@ protected List<ReactPackage> getPackages() {
@Override
public void onCreate() {
super.onCreate();
setTheme(R.style.Theme_AppCompat);
setTheme(androidx.appcompat.R.style.Theme_AppCompat);
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions lib/ios/RNNAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#import "RCTLegacyInteropComponents.h"
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTLegacyViewManagerInteropComponentView.h>
#import <React/RCTRuntimeExecutorFromBridge.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
Expand Down
4 changes: 2 additions & 2 deletions lib/ios/RNNReactView.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef RCT_NEW_ARCH_ENABLED
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfaceHostingProxyRootView.h>
#else
#import <React/RCTRootView.h>
#endif
Expand Down Expand Up @@ -32,7 +32,7 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);

#ifdef RCT_NEW_ARCH_ENABLED
@interface RNNReactView
: RCTFabricSurfaceHostingProxyRootView <RCTRootViewDelegate, RNNComponentProtocol>
: RCTSurfaceHostingProxyRootView <RCTRootViewDelegate, RNNComponentProtocol>
#else
@interface RNNReactView : RCTRootView <RCTRootViewDelegate, RNNComponentProtocol>
#endif
Expand Down
10 changes: 6 additions & 4 deletions lib/ios/RNNReactView.m → lib/ios/RNNReactView.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#import "RNNReactView.h"
#import <React/RCTRootContentView.h>

#ifdef RCT_NEW_ARCH_ENABLED
#import <React/RCTFabricSurface.h>
#endif

@implementation RNNReactView {
BOOL _isAppeared;
}
Expand All @@ -11,10 +15,8 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
eventEmitter:(RNNEventEmitter *)eventEmitter
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
self = [super initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties
sizeMeasureMode:sizeMeasureMode];
RCTFabricSurface *surface = [[RCTFabricSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
self = [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
#else
- (instancetype)initWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
Expand Down
4 changes: 4 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const path = require('node:path');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');

const config = {
projectRoot: `${__dirname}`,
resolver: {
enableGlobalPackages: true,
},
watchFolders: [__dirname],
};

Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-navigation",
"version": "7.38.4",
"version": "7.38.6",
"description": "React Native Navigation - truly native navigation for iOS and Android",
"license": "MIT",
"nativePackage": true,
Expand Down Expand Up @@ -76,7 +76,10 @@
"@babel/plugin-proposal-export-namespace-from": "7.10.1",
"@babel/runtime": "7.22.6",
"@babel/types": "7.22.5",
"@react-native/metro-config": "^0.73.0",
"@babel/preset-env": "^7.22.9",
"@react-native/metro-config": "^0.73.2",
"@react-native/babel-preset": "^0.73.18",
"@react-native/typescript-config": "^0.73.1",
"@react-native-community/blur": "^3.6.0",
"@react-native-community/datetimepicker": "^3.4.7",
"@react-native-community/eslint-config": "2.0.0",
Expand All @@ -94,7 +97,7 @@
"@typescript-eslint/parser": "4.33.0",
"babel-jest": "^27.0.0",
"clang-format": "^1.4.0",
"detox": "20.18.3",
"detox": "20.19.5",
"detox-testing-library-rnn-adapter": "^2.0.3",
"eslint": "7.32.0",
"eslint-config-prettier": "6.11.0",
Expand All @@ -109,7 +112,7 @@
"pngjs": "^6.0.0",
"prettier": "2.1.2",
"react": "18.2.0",
"react-native": "0.72.3",
"react-native": "0.73.3",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "^2.10.1",
"react-native-reanimated": "^3.8.1",
Expand Down
6 changes: 4 additions & 2 deletions playground/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ def jscFlavor = 'org.webkit:android-jsc:+'
android {
compileSdkVersion rootProject.ext.get("compileSdkVersion")

namespace "com.reactnativenavigation.playground"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

defaultConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import com.reactnativenavigation.R;

public class FragmentComponent implements ExternalComponent {
private final FrameLayout content;
Expand Down
18 changes: 14 additions & 4 deletions playground/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

buildscript {
ext {
kotlinVersion = "1.7.10"
kotlinVersion = "1.8.10"
RNNKotlinVersion = kotlinVersion
detoxKotlinVersion = kotlinVersion
compileSdkVersion = 33
buildToolsVersion = "33.0.0"
compileSdkVersion = 34
buildToolsVersion = "34.0.0"
minSdkVersion = 21
targetSdkVersion = 33
targetSdkVersion = 34
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
Expand Down Expand Up @@ -36,3 +36,13 @@ allprojects {
}
}
}

subprojects {
afterEvaluate { p ->
if (p.hasProperty('android')) {
android {
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jul 28 13:48:47 IDT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
20 changes: 5 additions & 15 deletions playground/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ if linkage != nil
use_frameworks! :linkage => linkage.to_sym
end

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


def all_pods
config = use_native_modules!
Expand All @@ -38,18 +35,11 @@ def all_pods
end

post_install do |installer|
__apply_Xcode_15_3_flipper_post_install_workaround(installer)

react_native_post_install(installer, "../../node_modules/react-native", :mac_catalyst_enabled => false)

__apply_Xcode_12_5_M1_post_install_workaround(installer)

# This is to resolve "'shared_timed_mutex' is unavailable: introduced in iOS 10.0" error
installer.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
end
end
react_native_post_install(
installer,
"../../node_modules/react-native",
:mac_catalyst_enabled => false
)
end

def __apply_Xcode_15_3_flipper_post_install_workaround(installer)
Expand Down
Loading

0 comments on commit bf6f379

Please sign in to comment.