react-native-navigation 8.5.0 → 8.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReactNativeNavigation.podspec +9 -33
- package/android/src/androidTest/java/com/reactnativenavigation/TestApplication.kt +0 -2
- package/android/src/main/java/com/reactnativenavigation/views/touch/OverlayTouchDelegate.kt +14 -3
- package/android/src/test/java/com/reactnativenavigation/TestApplication.kt +29 -0
- package/autolink/fixtures/rn79/AppDelegate.swift.template +48 -0
- package/autolink/fixtures/rn79/MainActivity.kt.template +22 -0
- package/autolink/fixtures/rn79/MainApplication.kt.template +44 -0
- package/autolink/fixtures/rn79/build.gradle.template +21 -0
- package/autolink/postlink/__helpers__/fixtures.js +2 -0
- package/autolink/postlink/__helpers__/generate_version_header.js +117 -0
- package/autolink/postlink/__helpers__/reactNativeVersion.js +160 -0
- package/autolink/postlink/__snapshots__/{appDelegateLinker.test.js.snap → appDelegateLinker77.test.js.snap} +2 -2
- package/autolink/postlink/__snapshots__/appDelegateLinker79.test.js.snap +39 -0
- package/autolink/postlink/appDelegateLinker.js +76 -2
- package/autolink/postlink/appDelegateLinker77.test.js +51 -0
- package/autolink/postlink/appDelegateLinker79.test.js +32 -0
- package/autolink/postlink/path.js +0 -2
- package/ios/RNNAppDelegate.h +33 -1
- package/ios/RNNAppDelegate.mm +75 -68
- package/ios/ReactNativeNavigation.xcodeproj/project.pbxproj +5 -1
- package/package.json +17 -15
- package/android/src/test/java/com/reactnativenavigation/TestApplication.java +0 -43
- package/autolink/postlink/appDelegateLinker.test.js +0 -45
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
require 'json'
|
|
2
|
-
require 'find'
|
|
3
2
|
|
|
4
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
5
|
-
|
|
6
4
|
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
7
5
|
|
|
8
|
-
# Detect if this is a Swift project by looking for user AppDelegate.swift files
|
|
9
|
-
start_dir = File.expand_path('../', __dir__)
|
|
10
|
-
swift_delegate_path = nil
|
|
11
|
-
Find.find(start_dir) do |path|
|
|
12
|
-
if path =~ /AppDelegate\.swift$/
|
|
13
|
-
swift_delegate_path = path
|
|
14
|
-
break
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
swift_project = swift_delegate_path && File.exist?(swift_delegate_path)
|
|
19
|
-
|
|
20
|
-
# Debug output
|
|
21
|
-
if swift_project
|
|
22
|
-
puts "ReactNativeNavigation: Swift AppDelegate detected - enabling Swift-compatible configuration"
|
|
23
|
-
else
|
|
24
|
-
puts "ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration"
|
|
25
|
-
end
|
|
26
|
-
|
|
27
6
|
Pod::Spec.new do |s|
|
|
28
7
|
s.name = "ReactNativeNavigation"
|
|
8
|
+
s.prepare_command = 'node autolink/postlink/__helpers__/generate_version_header.js'
|
|
29
9
|
s.version = package['version']
|
|
30
10
|
s.summary = package['description']
|
|
31
11
|
|
|
@@ -40,13 +20,12 @@ Pod::Spec.new do |s|
|
|
|
40
20
|
s.subspec 'Core' do |ss|
|
|
41
21
|
s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
|
|
42
22
|
s.source_files = 'ios/**/*.{h,m,mm,cpp}'
|
|
43
|
-
s.exclude_files = "ios/ReactNativeNavigationTests/**/*.*", "
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
end
|
|
23
|
+
s.exclude_files = "ios/ReactNativeNavigationTests/**/*.*", "ios/OCMock/**/*.*"
|
|
24
|
+
|
|
25
|
+
s.public_header_files = [
|
|
26
|
+
'ios/RNNAppDelegate.h',
|
|
27
|
+
'ios/ReactNativeVersionExtracted.h'
|
|
28
|
+
]
|
|
50
29
|
end
|
|
51
30
|
|
|
52
31
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DFOLLY_CFG_NO_COROUTINES=1'
|
|
@@ -58,11 +37,8 @@ Pod::Spec.new do |s|
|
|
|
58
37
|
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
59
38
|
}
|
|
60
39
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
xcconfig_settings["DEFINES_MODULE"] = "YES"
|
|
64
|
-
end
|
|
65
|
-
|
|
40
|
+
xcconfig_settings["DEFINES_MODULE"] = "YES"
|
|
41
|
+
|
|
66
42
|
s.pod_target_xcconfig = xcconfig_settings
|
|
67
43
|
|
|
68
44
|
if fabric_enabled
|
|
@@ -3,10 +3,8 @@ package com.reactnativenavigation
|
|
|
3
3
|
import com.facebook.react.ReactHost
|
|
4
4
|
import com.facebook.react.ReactNativeHost
|
|
5
5
|
import com.facebook.react.ReactPackage
|
|
6
|
-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
|
|
7
6
|
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
8
7
|
import com.facebook.react.shell.MainReactPackage
|
|
9
|
-
import com.reactnativenavigation.NavigationPackage
|
|
10
8
|
import com.reactnativenavigation.react.NavigationReactNativeHost
|
|
11
9
|
|
|
12
10
|
class TestApplication : NavigationApplication() {
|
|
@@ -4,7 +4,6 @@ import android.view.MotionEvent
|
|
|
4
4
|
import android.view.View
|
|
5
5
|
import android.view.ViewGroup
|
|
6
6
|
import androidx.annotation.VisibleForTesting
|
|
7
|
-
import com.facebook.react.views.debuggingoverlay.DebuggingOverlay
|
|
8
7
|
import com.reactnativenavigation.options.params.Bool
|
|
9
8
|
import com.reactnativenavigation.options.params.NullBool
|
|
10
9
|
import com.reactnativenavigation.react.ReactView
|
|
@@ -57,7 +56,19 @@ open class OverlayTouchDelegate(
|
|
|
57
56
|
return false
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
private fun debuggingOverlay(childItem: View?): Boolean
|
|
61
|
-
childItem is ViewGroup
|
|
59
|
+
private fun debuggingOverlay(childItem: View?): Boolean {
|
|
60
|
+
if (childItem !is ViewGroup) return false
|
|
61
|
+
val firstChild = childItem.getChildAt(0) ?: return false
|
|
62
|
+
return isDebuggingOverlay(firstChild)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun isDebuggingOverlay(view: View): Boolean {
|
|
66
|
+
return try {
|
|
67
|
+
val className = view.javaClass.name
|
|
68
|
+
className == "com.facebook.react.views.debuggingoverlay.DebuggingOverlay"
|
|
69
|
+
} catch (e: Exception) {
|
|
70
|
+
false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
62
73
|
|
|
63
74
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package com.reactnativenavigation
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import androidx.appcompat.R
|
|
5
|
+
import com.facebook.react.ReactApplication
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactNativeHost
|
|
8
|
+
import com.facebook.react.ReactPackage
|
|
9
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
10
|
+
|
|
11
|
+
class TestApplication : Application(), ReactApplication {
|
|
12
|
+
override val reactNativeHost: ReactNativeHost = object : ReactNativeHost(this) {
|
|
13
|
+
override fun getUseDeveloperSupport(): Boolean {
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override fun getPackages(): MutableList<ReactPackage> {
|
|
18
|
+
return mutableListOf()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override fun onCreate() {
|
|
23
|
+
super.onCreate()
|
|
24
|
+
setTheme(R.style.Theme_AppCompat)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override val reactHost: ReactHost
|
|
28
|
+
get() = getDefaultReactHost(this, reactNativeHost)
|
|
29
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
import React
|
|
3
|
+
import React_RCTAppDelegate
|
|
4
|
+
import ReactAppDependencyProvider
|
|
5
|
+
|
|
6
|
+
@main
|
|
7
|
+
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
8
|
+
var window: UIWindow?
|
|
9
|
+
|
|
10
|
+
var reactNativeDelegate: ReactNativeDelegate?
|
|
11
|
+
var reactNativeFactory: RCTReactNativeFactory?
|
|
12
|
+
|
|
13
|
+
func application(
|
|
14
|
+
_ application: UIApplication,
|
|
15
|
+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
16
|
+
) -> Bool {
|
|
17
|
+
let delegate = ReactNativeDelegate()
|
|
18
|
+
let factory = RCTReactNativeFactory(delegate: delegate)
|
|
19
|
+
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
20
|
+
|
|
21
|
+
reactNativeDelegate = delegate
|
|
22
|
+
reactNativeFactory = factory
|
|
23
|
+
|
|
24
|
+
window = UIWindow(frame: UIScreen.main.bounds)
|
|
25
|
+
|
|
26
|
+
factory.startReactNative(
|
|
27
|
+
withModuleName: "RN79",
|
|
28
|
+
in: window,
|
|
29
|
+
launchOptions: launchOptions
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
|
|
37
|
+
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
|
38
|
+
self.bundleURL()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override func bundleURL() -> URL? {
|
|
42
|
+
#if DEBUG
|
|
43
|
+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
|
|
44
|
+
#else
|
|
45
|
+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
|
|
46
|
+
#endif
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.app
|
|
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 = "rn770"
|
|
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
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.app
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import com.facebook.react.PackageList
|
|
5
|
+
import com.facebook.react.ReactApplication
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactNativeHost
|
|
8
|
+
import com.facebook.react.ReactPackage
|
|
9
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
|
|
10
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
11
|
+
import com.facebook.react.defaults.DefaultReactNativeHost
|
|
12
|
+
import com.facebook.react.soloader.OpenSourceMergedSoMapping
|
|
13
|
+
import com.facebook.soloader.SoLoader
|
|
14
|
+
|
|
15
|
+
class MainApplication : Application(), ReactApplication {
|
|
16
|
+
|
|
17
|
+
override val reactNativeHost: ReactNativeHost =
|
|
18
|
+
object : DefaultReactNativeHost(this) {
|
|
19
|
+
override fun getPackages(): List<ReactPackage> =
|
|
20
|
+
PackageList(this).packages.apply {
|
|
21
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
22
|
+
// add(MyReactNativePackage())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun getJSMainModuleName(): String = "index"
|
|
26
|
+
|
|
27
|
+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
|
|
28
|
+
|
|
29
|
+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
30
|
+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override val reactHost: ReactHost
|
|
34
|
+
get() = getDefaultReactHost(applicationContext, reactNativeHost)
|
|
35
|
+
|
|
36
|
+
override fun onCreate() {
|
|
37
|
+
super.onCreate()
|
|
38
|
+
SoLoader.init(this, OpenSourceMergedSoMapping)
|
|
39
|
+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
40
|
+
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
|
41
|
+
load()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext {
|
|
3
|
+
buildToolsVersion = "35.0.0"
|
|
4
|
+
minSdkVersion = 24
|
|
5
|
+
compileSdkVersion = 35
|
|
6
|
+
targetSdkVersion = 35
|
|
7
|
+
ndkVersion = "27.1.12297006"
|
|
8
|
+
kotlinVersion = "2.0.21"
|
|
9
|
+
}
|
|
10
|
+
repositories {
|
|
11
|
+
google()
|
|
12
|
+
mavenCentral()
|
|
13
|
+
}
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath("com.android.tools.build:gradle")
|
|
16
|
+
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
17
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
@@ -21,4 +21,6 @@ module.exports = {
|
|
|
21
21
|
prepareFixtureDuplicate,
|
|
22
22
|
prepareFixtureDuplicate77: ({ userFixtureFileName, patchedFixtureFileName }) =>
|
|
23
23
|
prepareFixtureDuplicate({ rnVersion: '77', userFixtureFileName, patchedFixtureFileName }),
|
|
24
|
+
prepareFixtureDuplicate79: ({ userFixtureFileName, patchedFixtureFileName }) =>
|
|
25
|
+
prepareFixtureDuplicate({ rnVersion: '79', userFixtureFileName, patchedFixtureFileName }),
|
|
24
26
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { getReactNativeVersion, findProjectPackageJson } = require('./reactNativeVersion');
|
|
5
|
+
|
|
6
|
+
// Logging helper that writes to both stderr and a log file
|
|
7
|
+
function log(message) {
|
|
8
|
+
console.error(message);
|
|
9
|
+
|
|
10
|
+
// Also write to a log file for debugging if stderr is suppressed
|
|
11
|
+
try {
|
|
12
|
+
const logFile = path.join(__dirname, '../../../ios/rnn_version_detection.log');
|
|
13
|
+
const timestamp = new Date().toISOString();
|
|
14
|
+
fs.appendFileSync(logFile, `[${timestamp}] ${message}\n`, 'utf8');
|
|
15
|
+
} catch (e) {
|
|
16
|
+
// Ignore log file errors
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function generateVersionHeader() {
|
|
21
|
+
const startDir = __dirname;
|
|
22
|
+
|
|
23
|
+
log(`[RNN] === React Native Version Detection ===`);
|
|
24
|
+
log(`[RNN] Script location (__dirname): ${startDir}`);
|
|
25
|
+
log(`[RNN] Working directory (cwd): ${process.cwd()}`);
|
|
26
|
+
|
|
27
|
+
const packageJsonPath = findProjectPackageJson();
|
|
28
|
+
|
|
29
|
+
if (!packageJsonPath) {
|
|
30
|
+
log('[RNN] ❌ ERROR: Project package.json not found');
|
|
31
|
+
log('[RNN] This usually means the script could not locate your React Native project.');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
log(`[RNN] ✓ Found package.json: ${packageJsonPath}`);
|
|
36
|
+
|
|
37
|
+
// Determine actual source of version
|
|
38
|
+
const projectRoot = path.dirname(packageJsonPath);
|
|
39
|
+
const rnPackageJsonPath = path.join(projectRoot, 'node_modules', 'react-native', 'package.json');
|
|
40
|
+
let versionSource = packageJsonPath;
|
|
41
|
+
let versionSourceType = 'package.json';
|
|
42
|
+
|
|
43
|
+
if (fs.existsSync(rnPackageJsonPath)) {
|
|
44
|
+
versionSource = rnPackageJsonPath;
|
|
45
|
+
versionSourceType = 'node_modules/react-native/package.json (installed version)';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const versionInfo = getReactNativeVersion();
|
|
49
|
+
|
|
50
|
+
if (!versionInfo) {
|
|
51
|
+
log('[RNN] ❌ ERROR: react-native not found in package.json or node_modules');
|
|
52
|
+
log('[RNN] Make sure react-native is installed and listed as a dependency.');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
log(`[RNN] ✓ React Native ${versionInfo.raw} (source: ${versionSourceType})`);
|
|
57
|
+
|
|
58
|
+
const { major, minor, patch } = versionInfo;
|
|
59
|
+
|
|
60
|
+
// Generate header content
|
|
61
|
+
const headerContent = `//
|
|
62
|
+
// ReactNativeVersionExtracted.h
|
|
63
|
+
// React Native version: ${versionInfo.raw}
|
|
64
|
+
// Generated on: ${new Date().toISOString()}
|
|
65
|
+
// Source: ${versionSource}
|
|
66
|
+
//
|
|
67
|
+
|
|
68
|
+
#ifndef ReactNativeVersionExtracted_h
|
|
69
|
+
#define ReactNativeVersionExtracted_h
|
|
70
|
+
|
|
71
|
+
static const int REACT_NATIVE_VERSION_MAJOR = ${major};
|
|
72
|
+
static const int REACT_NATIVE_VERSION_MINOR = ${minor};
|
|
73
|
+
static const int REACT_NATIVE_VERSION_PATCH = ${patch};
|
|
74
|
+
|
|
75
|
+
#define RN_VERSION_MAJOR ${major}
|
|
76
|
+
#define RN_VERSION_MINOR ${minor}
|
|
77
|
+
#define RN_VERSION_PATCH ${patch}
|
|
78
|
+
|
|
79
|
+
#endif
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
// Find RNN root by looking upwards from script location for RNN's package.json
|
|
83
|
+
let currentDir = __dirname;
|
|
84
|
+
let rnnPackageJson = null;
|
|
85
|
+
|
|
86
|
+
for (let i = 0; i < 5; i++) {
|
|
87
|
+
const potential = path.join(currentDir, 'package.json');
|
|
88
|
+
if (fs.existsSync(potential)) {
|
|
89
|
+
const pkg = JSON.parse(fs.readFileSync(potential, 'utf8'));
|
|
90
|
+
// This is RNN's package.json if name matches
|
|
91
|
+
if (pkg.name === 'react-native-navigation') {
|
|
92
|
+
rnnPackageJson = currentDir;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
currentDir = path.resolve(currentDir, '..');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!rnnPackageJson) {
|
|
100
|
+
log('[RNN] ❌ ERROR: Could not find react-native-navigation root directory');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const outputFile = path.join(rnnPackageJson, 'ios/ReactNativeVersionExtracted.h');
|
|
105
|
+
|
|
106
|
+
fs.writeFileSync(outputFile, headerContent, 'utf8');
|
|
107
|
+
log(`[RNN] ✅ Generated header: ${outputFile}`);
|
|
108
|
+
log(`[RNN] ✅ Version constants: ${major}.${minor}.${patch}`);
|
|
109
|
+
log(`[RNN] === Completed Successfully ===`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Run if called directly
|
|
113
|
+
if (require.main === module) {
|
|
114
|
+
generateVersionHeader();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
module.exports = { generateVersionHeader };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
var fs = require('fs');
|
|
3
|
+
var nodePath = require('path');
|
|
4
|
+
var { warnn } = require('../log');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Find the project root package.json
|
|
8
|
+
* @returns {string|null} Path to project's package.json or null if not found
|
|
9
|
+
*/
|
|
10
|
+
function findProjectPackageJson() {
|
|
11
|
+
var searchDirs = [process.cwd(), __dirname];
|
|
12
|
+
|
|
13
|
+
// PRIORITY: Check if we're in RNN's own directory structure (workspace/CI scenario)
|
|
14
|
+
// In this case, __dirname would be like: /path/to/rnn/autolink/postlink/__helpers__
|
|
15
|
+
// And we want to find: /path/to/rnn/playground/package.json
|
|
16
|
+
var currentPath = __dirname;
|
|
17
|
+
|
|
18
|
+
// Walk up to find RNN root (containing this autolink folder)
|
|
19
|
+
for (var k = 0; k < 5; k++) {
|
|
20
|
+
// Check if this looks like RNN root by checking for playground subdirectory
|
|
21
|
+
var playgroundPath = nodePath.join(currentPath, 'playground');
|
|
22
|
+
var playgroundPackageJson = nodePath.join(playgroundPath, 'package.json');
|
|
23
|
+
|
|
24
|
+
if (fs.existsSync(playgroundPackageJson)) {
|
|
25
|
+
try {
|
|
26
|
+
var pkg = JSON.parse(fs.readFileSync(playgroundPackageJson, 'utf8'));
|
|
27
|
+
if ((pkg.dependencies && pkg.dependencies['react-native']) ||
|
|
28
|
+
(pkg.devDependencies && pkg.devDependencies['react-native'])) {
|
|
29
|
+
// Found it! Prioritize this path
|
|
30
|
+
searchDirs.unshift(playgroundPath);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
} catch (e) { }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var parent = nodePath.dirname(currentPath);
|
|
37
|
+
if (parent === currentPath) break;
|
|
38
|
+
currentPath = parent;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// If we're inside a package (like in node_modules or a workspace),
|
|
42
|
+
// also try searching from common project locations
|
|
43
|
+
currentPath = __dirname;
|
|
44
|
+
for (var k = 0; k < 10; k++) {
|
|
45
|
+
var basename = nodePath.basename(currentPath);
|
|
46
|
+
|
|
47
|
+
// If we're in node_modules, the parent is likely the project root
|
|
48
|
+
if (basename === 'node_modules') {
|
|
49
|
+
searchDirs.push(nodePath.dirname(currentPath));
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// If we find a workspace scenario (e.g., we're in the workspace root but project is in subdirectory)
|
|
54
|
+
// Check for common subdirectories like 'playground', 'example', 'app'
|
|
55
|
+
var commonProjectDirs = ['playground', 'example', 'app', 'demo'];
|
|
56
|
+
for (var m = 0; m < commonProjectDirs.length; m++) {
|
|
57
|
+
var potentialProjectDir = nodePath.join(currentPath, commonProjectDirs[m]);
|
|
58
|
+
if (fs.existsSync(potentialProjectDir)) {
|
|
59
|
+
searchDirs.push(potentialProjectDir);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var parent = nodePath.dirname(currentPath);
|
|
64
|
+
if (parent === currentPath) break;
|
|
65
|
+
currentPath = parent;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for (var j = 0; j < searchDirs.length; j++) {
|
|
69
|
+
var searchDir = searchDirs[j];
|
|
70
|
+
for (var i = 0; i < 10; i++) {
|
|
71
|
+
var packagePath = nodePath.join(searchDir, 'package.json');
|
|
72
|
+
if (fs.existsSync(packagePath)) {
|
|
73
|
+
try {
|
|
74
|
+
var pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
75
|
+
if ((pkg.dependencies && pkg.dependencies['react-native']) ||
|
|
76
|
+
(pkg.devDependencies && pkg.devDependencies['react-native'])) {
|
|
77
|
+
// Exclude react-native-navigation's own package.json to avoid false positives
|
|
78
|
+
// in workspace/monorepo scenarios
|
|
79
|
+
if (pkg.name !== 'react-native-navigation') {
|
|
80
|
+
return packagePath;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
} catch (e) { }
|
|
84
|
+
}
|
|
85
|
+
var parent = nodePath.dirname(searchDir);
|
|
86
|
+
if (parent === searchDir) break;
|
|
87
|
+
searchDir = parent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get React Native version as parsed object from node_modules
|
|
96
|
+
* @returns {Object|null} { major, minor, patch, raw } or null
|
|
97
|
+
*/
|
|
98
|
+
function getReactNativeVersion() {
|
|
99
|
+
var projectPackageJsonPath = findProjectPackageJson();
|
|
100
|
+
if (!projectPackageJsonPath) {
|
|
101
|
+
warnn('Could not find package.json to detect React Native version');
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var projectRoot = nodePath.dirname(projectPackageJsonPath);
|
|
106
|
+
|
|
107
|
+
// First, try to read from node_modules/react-native/package.json (actual installed version)
|
|
108
|
+
var rnPackageJsonPath = nodePath.join(projectRoot, 'node_modules', 'react-native', 'package.json');
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
if (fs.existsSync(rnPackageJsonPath)) {
|
|
112
|
+
var rnPackageJson = JSON.parse(fs.readFileSync(rnPackageJsonPath, 'utf8'));
|
|
113
|
+
var rnVersion = rnPackageJson.version;
|
|
114
|
+
|
|
115
|
+
if (rnVersion) {
|
|
116
|
+
var parts = rnVersion.split('.');
|
|
117
|
+
return {
|
|
118
|
+
major: parseInt(parts[0]) || 0,
|
|
119
|
+
minor: parseInt(parts[1]) || 0,
|
|
120
|
+
patch: parseInt(parts[2]) || 0,
|
|
121
|
+
raw: rnVersion
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} catch (e) {
|
|
126
|
+
// Fall through to backup method
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Fallback: read from project's package.json dependencies
|
|
130
|
+
try {
|
|
131
|
+
var packageJson = JSON.parse(fs.readFileSync(projectPackageJsonPath, 'utf8'));
|
|
132
|
+
var rnVersion = packageJson.dependencies && packageJson.dependencies['react-native'] ||
|
|
133
|
+
packageJson.devDependencies && packageJson.devDependencies['react-native'];
|
|
134
|
+
|
|
135
|
+
if (!rnVersion) {
|
|
136
|
+
warnn('React Native not found in package.json or node_modules');
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Parse version (remove ^, ~, >=, etc.)
|
|
141
|
+
var cleanVersion = rnVersion.replace(/^[\^~>=<]+/, '');
|
|
142
|
+
var parts = cleanVersion.split('.');
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
major: parseInt(parts[0]) || 0,
|
|
146
|
+
minor: parseInt(parts[1]) || 0,
|
|
147
|
+
patch: parseInt(parts[2]) || 0,
|
|
148
|
+
raw: rnVersion
|
|
149
|
+
};
|
|
150
|
+
} catch (e) {
|
|
151
|
+
warnn('Error detecting React Native version: ' + e.message);
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
module.exports = {
|
|
157
|
+
findProjectPackageJson: findProjectPackageJson,
|
|
158
|
+
getReactNativeVersion: getReactNativeVersion
|
|
159
|
+
};
|
|
160
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`appDelegateLinker should work for RN 0.77 with Objective-C 1`] = `
|
|
3
|
+
exports[`appDelegateLinker should work for RN 0.77 & 0.78 with Objective-C 1`] = `
|
|
4
4
|
"#import "AppDelegate.h"
|
|
5
5
|
#import <ReactNativeNavigation/ReactNativeNavigation.h>
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@ exports[`appDelegateLinker should work for RN 0.77 with Objective-C 1`] = `
|
|
|
36
36
|
@end "
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
|
-
exports[`appDelegateLinker should work for RN 0.77 with Swift 1`] = `
|
|
39
|
+
exports[`appDelegateLinker should work for RN 0.77 & 0.78 with Swift 1`] = `
|
|
40
40
|
"import UIKit
|
|
41
41
|
import React
|
|
42
42
|
import ReactNativeNavigation
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`appDelegateLinker should work with Swift bridgeless RN 0.79 1`] = `
|
|
4
|
+
"import UIKit
|
|
5
|
+
import React
|
|
6
|
+
import ReactNativeNavigation
|
|
7
|
+
import ReactAppDependencyProvider
|
|
8
|
+
|
|
9
|
+
@main
|
|
10
|
+
class AppDelegate: RNNAppDelegate {
|
|
11
|
+
|
|
12
|
+
override func application(
|
|
13
|
+
_ application: UIApplication,
|
|
14
|
+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
15
|
+
) -> Bool {
|
|
16
|
+
self.reactNativeDelegate = ReactNativeDelegate()
|
|
17
|
+
super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
return true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
|
|
26
|
+
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
|
27
|
+
self.bundleURL()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override func bundleURL() -> URL? {
|
|
31
|
+
#if DEBUG
|
|
32
|
+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
|
|
33
|
+
#else
|
|
34
|
+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
|
|
35
|
+
#endif
|
|
36
|
+
}
|
|
37
|
+
}"
|
|
38
|
+
`;
|
|
39
|
+
|
|
@@ -10,6 +10,9 @@ class AppDelegateLinker {
|
|
|
10
10
|
this.appDelegateHeaderPath = path.appDelegateHeader;
|
|
11
11
|
this.removeUnneededImportsSuccess = false;
|
|
12
12
|
this.removeApplicationLaunchContentSuccess = false;
|
|
13
|
+
const rnVersion = this._getReactNativeVersion();
|
|
14
|
+
infon('Found React Native version: ' + (rnVersion ? rnVersion.raw : 'unknown'));
|
|
15
|
+
this.isRN79orHigher = rnVersion && (rnVersion.major > 0 || rnVersion.minor >= 79);
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
link() {
|
|
@@ -20,7 +23,7 @@ class AppDelegateLinker {
|
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
logn('Linking AppDelegate
|
|
26
|
+
logn('Linking AppDelegate: ' + this.appDelegatePath);
|
|
24
27
|
|
|
25
28
|
// New flow for Swift
|
|
26
29
|
if (nodePath.extname(this.appDelegatePath) === '.swift') {
|
|
@@ -194,16 +197,87 @@ class AppDelegateLinker {
|
|
|
194
197
|
|
|
195
198
|
// SWIFT implementation
|
|
196
199
|
_extendRNNAppDelegateSwift(content) {
|
|
197
|
-
|
|
200
|
+
let newContent = content;
|
|
201
|
+
|
|
202
|
+
newContent = newContent
|
|
198
203
|
.replace(
|
|
199
204
|
/import React_RCTAppDelegate/,
|
|
200
205
|
'import ReactNativeNavigation'
|
|
201
206
|
)
|
|
207
|
+
|
|
208
|
+
// add this ONLY for < RN079
|
|
209
|
+
if (!this.isRN79orHigher) {
|
|
210
|
+
newContent = this._updateRNNAppDelegateSwift_77_78(newContent);
|
|
211
|
+
} else {
|
|
212
|
+
newContent = this._updateRNNAppDelegateSwift_79(newContent);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return newContent;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
_updateRNNAppDelegateSwift_77_78(content) {
|
|
219
|
+
return content
|
|
202
220
|
.replace(
|
|
203
221
|
/class AppDelegate: RCTAppDelegate/,
|
|
204
222
|
'class AppDelegate: RNNAppDelegate'
|
|
205
223
|
)
|
|
206
224
|
}
|
|
225
|
+
_updateRNNAppDelegateSwift_79(content) {
|
|
226
|
+
let newContent = content;
|
|
227
|
+
newContent = newContent
|
|
228
|
+
.replace(
|
|
229
|
+
'class AppDelegate: UIResponder, UIApplicationDelegate',
|
|
230
|
+
'class AppDelegate: RNNAppDelegate'
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
newContent = newContent
|
|
234
|
+
.replace(/^\s*var window: UIWindow\?\s*$/gm, '')
|
|
235
|
+
.replace(/^\s*var reactNativeDelegate: ReactNativeDelegate\?\s*$/gm, '')
|
|
236
|
+
.replace(/^\s*var reactNativeFactory: RCTReactNativeFactory\?\s*$/gm, '')
|
|
237
|
+
|
|
238
|
+
newContent = newContent
|
|
239
|
+
.replace(
|
|
240
|
+
/func application/,
|
|
241
|
+
'override func application'
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
newContent = newContent
|
|
245
|
+
.replace(
|
|
246
|
+
/let delegate = ReactNativeDelegate\(\)/,
|
|
247
|
+
'self.reactNativeDelegate = ReactNativeDelegate\(\)'
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
newContent = newContent
|
|
251
|
+
.replace(
|
|
252
|
+
/let factory = RCTReactNativeFactory\(delegate: delegate\)/,
|
|
253
|
+
'super.application\(application, didFinishLaunchingWithOptions: launchOptions\)'
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
newContent = newContent
|
|
257
|
+
.replace(/^\s*delegate.dependencyProvider = RCTAppDependencyProvider\(\)\s*$/gm, '')
|
|
258
|
+
newContent = newContent
|
|
259
|
+
.replace(/^\s*reactNativeDelegate = delegate\s*$/gm, '')
|
|
260
|
+
newContent = newContent
|
|
261
|
+
.replace(/^\s*reactNativeFactory = factory\s*$/gm, '')
|
|
262
|
+
newContent = newContent
|
|
263
|
+
.replace(/^\s*window = UIWindow\(frame: UIScreen.main.bounds\)\s*$/gm, '')
|
|
264
|
+
newContent = newContent
|
|
265
|
+
.replace(
|
|
266
|
+
/factory\.startReactNative\([\s\S]*?withModuleName:\s*".*?"[\s\S]*?\)/g,
|
|
267
|
+
''
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
return newContent;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Get React Native version from package.json
|
|
275
|
+
* @returns {Object} { major, minor, patch } or null
|
|
276
|
+
*/
|
|
277
|
+
_getReactNativeVersion() {
|
|
278
|
+
const { getReactNativeVersion } = require('./__helpers__/reactNativeVersion');
|
|
279
|
+
return getReactNativeVersion();
|
|
280
|
+
}
|
|
207
281
|
}
|
|
208
282
|
|
|
209
283
|
module.exports = AppDelegateLinker;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import * as mockHelpers from './__helpers__/fixtures';
|
|
3
|
+
|
|
4
|
+
jest.mock('./log');
|
|
5
|
+
|
|
6
|
+
const { getReactNativeVersion } = require('./__helpers__/reactNativeVersion');
|
|
7
|
+
const rnVersion = getReactNativeVersion();
|
|
8
|
+
const shouldSkip = rnVersion && rnVersion.minor >= 79;
|
|
9
|
+
|
|
10
|
+
// Conditionally skip entire test suite based on RN version
|
|
11
|
+
(shouldSkip ? describe.skip : describe)('appDelegateLinker', () => {
|
|
12
|
+
it('should work for RN 0.77 & 0.78 with Objective-C', () => {
|
|
13
|
+
jest.mock('./path', () => {
|
|
14
|
+
const appDelegatePath = mockHelpers.prepareFixtureDuplicate77({
|
|
15
|
+
userFixtureFileName: 'AppDelegate.mm.template',
|
|
16
|
+
patchedFixtureFileName: 'rnn-tests_AppDelegate.mm',
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
appDelegate: appDelegatePath,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const AppDelegateLinker = require('./appDelegateLinker');
|
|
24
|
+
const linker = new AppDelegateLinker();
|
|
25
|
+
|
|
26
|
+
linker.link();
|
|
27
|
+
const appDelegateContent = fs.readFileSync(linker.appDelegatePath, 'utf8');
|
|
28
|
+
expect(appDelegateContent).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should work for RN 0.77 & 0.78 with Swift', () => {
|
|
32
|
+
jest.mock('./path', () => {
|
|
33
|
+
const tmpAppDelegatePath = mockHelpers.prepareFixtureDuplicate77({
|
|
34
|
+
userFixtureFileName: 'AppDelegate.swift.template',
|
|
35
|
+
patchedFixtureFileName: 'rnn-tests_AppDelegate.swift',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
appDelegate: tmpAppDelegatePath,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const AppDelegateLinker = require('./appDelegateLinker');
|
|
44
|
+
const linker = new AppDelegateLinker();
|
|
45
|
+
linker.link();
|
|
46
|
+
|
|
47
|
+
const appDelegateContent = fs.readFileSync(linker.appDelegatePath, 'utf8');
|
|
48
|
+
expect(appDelegateContent).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import * as mockHelpers from './__helpers__/fixtures';
|
|
3
|
+
|
|
4
|
+
jest.mock('./log');
|
|
5
|
+
|
|
6
|
+
const { getReactNativeVersion } = require('./__helpers__/reactNativeVersion');
|
|
7
|
+
const rnVersion = getReactNativeVersion();
|
|
8
|
+
const shouldSkip = !rnVersion || rnVersion.minor < 79;
|
|
9
|
+
|
|
10
|
+
// Conditionally skip entire test suite based on RN version
|
|
11
|
+
(shouldSkip ? describe.skip : describe)('appDelegateLinker', () => {
|
|
12
|
+
it('should work with Swift bridgeless RN 0.79', () => {
|
|
13
|
+
jest.mock('./path', () => {
|
|
14
|
+
const tmpAppDelegatePath = mockHelpers.prepareFixtureDuplicate79({
|
|
15
|
+
userFixtureFileName: 'AppDelegate.swift.template',
|
|
16
|
+
patchedFixtureFileName: 'rnn-tests_AppDelegate79.swift',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
appDelegate: tmpAppDelegatePath,
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const AppDelegateLinker = require('./appDelegateLinker');
|
|
25
|
+
const linker = new AppDelegateLinker();
|
|
26
|
+
linker.link();
|
|
27
|
+
|
|
28
|
+
const appDelegateContent = fs.readFileSync(linker.appDelegatePath, 'utf8');
|
|
29
|
+
expect(appDelegateContent).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
@@ -9,8 +9,6 @@ var mainApplicationKotlin = glob.sync('**/MainApplication.kt', ignoreFolders)[0]
|
|
|
9
9
|
exports.mainApplicationKotlin = mainApplicationKotlin;
|
|
10
10
|
exports.rootGradle = mainApplicationKotlin.replace(/android\/app\/.*\.kt/, 'android/build.gradle');
|
|
11
11
|
|
|
12
|
-
var reactNativeVersion = require('../../../react-native/package.json').version;
|
|
13
|
-
infon('Found React Native version: ' + reactNativeVersion);
|
|
14
12
|
infon('Locating the AppDelegate.mm file ...');
|
|
15
13
|
exports.appDelegate = glob.sync(
|
|
16
14
|
'**/AppDelegate.mm',
|
package/ios/RNNAppDelegate.h
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <React/CoreModulesPlugins.h>
|
|
3
|
+
#import <ReactNativeNavigation/ReactNativeVersionExtracted.h>
|
|
3
4
|
|
|
5
|
+
#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
|
|
4
6
|
#if __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>)
|
|
5
7
|
#import <React-RCTAppDelegate/RCTAppDelegate.h>
|
|
6
8
|
#elif __has_include(<React_RCTAppDelegate/RCTAppDelegate.h>)
|
|
7
|
-
// for importing the header from framework, the dash will be transformed to underscore
|
|
8
9
|
#import <React_RCTAppDelegate/RCTAppDelegate.h>
|
|
9
10
|
#endif
|
|
10
11
|
|
|
12
|
+
#import <React/RCTBridge.h>
|
|
13
|
+
#else
|
|
14
|
+
#if __has_include(<React-RCTAppDelegate/RCTDefaultReactNativeFactoryDelegate.h>)
|
|
15
|
+
#import <React-RCTAppDelegate/RCTDefaultReactNativeFactoryDelegate.h>
|
|
16
|
+
#elif __has_include(<React_RCTAppDelegate/RCTDefaultReactNativeFactoryDelegate.h>)
|
|
17
|
+
#import <React_RCTAppDelegate/RCTDefaultReactNativeFactoryDelegate.h>
|
|
18
|
+
#endif
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#if __has_include(<ReactAppDependencyProvider/RCTAppDependencyProvider.h>)
|
|
22
|
+
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#if __has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>)
|
|
26
|
+
#import <React-RCTAppDelegate/RCTReactNativeFactory.h>
|
|
27
|
+
#elif __has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>)
|
|
28
|
+
#import <React_RCTAppDelegate/RCTReactNativeFactory.h>
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#import <React/RCTBundleURLProvider.h>
|
|
32
|
+
|
|
33
|
+
#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
|
|
11
34
|
@interface RNNAppDelegate : RCTAppDelegate
|
|
35
|
+
#else
|
|
36
|
+
@interface RNNAppDelegate : UIResponder <UIApplicationDelegate>
|
|
37
|
+
@property(nonatomic, strong) UIWindow *window;
|
|
38
|
+
|
|
39
|
+
@property(nonatomic, strong) RCTDefaultReactNativeFactoryDelegate *reactNativeDelegate;
|
|
40
|
+
|
|
41
|
+
@property(nonatomic, strong) RCTReactNativeFactory *reactNativeFactory;
|
|
42
|
+
@property(nonatomic) BOOL bridgelessEnabled;
|
|
43
|
+
#endif
|
|
12
44
|
|
|
13
45
|
@end
|
package/ios/RNNAppDelegate.mm
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
1
|
#import "RNNAppDelegate.h"
|
|
3
2
|
#import <ReactNativeNavigation/ReactNativeNavigation.h>
|
|
4
3
|
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
|
5
4
|
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
|
|
6
5
|
|
|
7
|
-
|
|
8
6
|
#import "RCTAppSetupUtils.h"
|
|
9
7
|
#import <React/CoreModulesPlugins.h>
|
|
10
8
|
#import <React/RCTCxxBridgeDelegate.h>
|
|
@@ -14,17 +12,7 @@
|
|
|
14
12
|
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
|
15
13
|
#import <ReactCommon/RCTTurboModuleManager.h>
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
#if __has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>)
|
|
20
|
-
#import <React-RCTAppDelegate/RCTAppDelegate.h>
|
|
21
|
-
#import <React-RCTAppDelegate/RCTReactNativeFactory.h>
|
|
22
|
-
#elif __has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>)
|
|
23
|
-
#import <React_RCTAppDelegate/RCTAppDelegate.h>
|
|
24
|
-
#import <React_RCTAppDelegate/RCTReactNativeFactory.h>
|
|
25
|
-
#else
|
|
26
|
-
// RN 0.77 support
|
|
27
|
-
#define RN077
|
|
15
|
+
#if __has_include(<react/config/ReactNativeConfig.h>)
|
|
28
16
|
#import <react/config/ReactNativeConfig.h>
|
|
29
17
|
#endif
|
|
30
18
|
|
|
@@ -39,100 +27,119 @@
|
|
|
39
27
|
|
|
40
28
|
#import <React/RCTComponentViewFactory.h>
|
|
41
29
|
|
|
30
|
+
|
|
42
31
|
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|
43
32
|
|
|
33
|
+
#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
|
|
44
34
|
@interface RNNAppDelegate () <RCTTurboModuleManagerDelegate,
|
|
45
|
-
|
|
35
|
+
RCTComponentViewFactoryComponentProvider> {
|
|
46
36
|
}
|
|
47
37
|
@end
|
|
38
|
+
#else
|
|
39
|
+
@interface RNNAppDelegate () {
|
|
40
|
+
}
|
|
41
|
+
@end
|
|
42
|
+
#endif
|
|
48
43
|
|
|
49
44
|
@implementation RNNAppDelegate
|
|
50
45
|
|
|
51
46
|
- (BOOL)application:(UIApplication *)application
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
#
|
|
47
|
+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
48
|
+
|
|
49
|
+
#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
|
|
55
50
|
[self _setUpFeatureFlags];
|
|
56
|
-
|
|
51
|
+
#if RN_VERSION_MINOR == 77
|
|
52
|
+
self.rootViewFactory = [self createRCTRootViewFactory];
|
|
53
|
+
#else
|
|
54
|
+
self.reactNativeFactory = [[RCTReactNativeFactory alloc] init];
|
|
55
|
+
self.reactNativeFactory.rootViewFactory = [self createRCTRootViewFactory];
|
|
56
|
+
#endif
|
|
57
|
+
|
|
57
58
|
[RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider = self;
|
|
58
59
|
RCTAppSetupPrepareApp(application, self.newArchEnabled);
|
|
59
60
|
RCTSetNewArchEnabled(TRUE);
|
|
60
|
-
#else
|
|
61
|
-
self.reactNativeFactory = [RCTReactNativeFactory new];
|
|
62
|
-
self.reactNativeFactory = [self.reactNativeFactory initWithDelegate:self];
|
|
63
|
-
#endif
|
|
64
61
|
|
|
65
62
|
RCTEnableTurboModuleInterop(YES);
|
|
66
63
|
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
|
67
|
-
|
|
64
|
+
|
|
68
65
|
self.rootViewFactory.reactHost = [self.rootViewFactory createReactHost:launchOptions];
|
|
69
|
-
|
|
66
|
+
|
|
70
67
|
[ReactNativeNavigation bootstrapWithHost:self.rootViewFactory.reactHost];
|
|
71
|
-
|
|
68
|
+
#else
|
|
69
|
+
self.reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:self.reactNativeDelegate];
|
|
70
|
+
self.reactNativeDelegate.dependencyProvider = [RCTAppDependencyProvider new];
|
|
71
|
+
|
|
72
|
+
RCTAppSetupPrepareApp(application, YES);
|
|
73
|
+
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
|
74
|
+
|
|
75
|
+
self.reactNativeFactory.rootViewFactory.reactHost = [self.reactNativeFactory.rootViewFactory createReactHost:launchOptions];
|
|
76
|
+
|
|
77
|
+
[ReactNativeNavigation bootstrapWithHost:self.reactNativeFactory.rootViewFactory.reactHost];
|
|
78
|
+
#endif
|
|
79
|
+
|
|
72
80
|
return YES;
|
|
73
81
|
}
|
|
74
82
|
|
|
83
|
+
|
|
84
|
+
#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
|
|
75
85
|
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
|
|
87
|
+
format:@"Subclasses must implement a valid sourceURLForBridge method"];
|
|
88
|
+
return nil;
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
- (BOOL)concurrentRootEnabled {
|
|
82
|
-
|
|
92
|
+
return true;
|
|
83
93
|
}
|
|
84
94
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
#ifdef RN077
|
|
88
95
|
- (RCTRootViewFactory *)createRCTRootViewFactory
|
|
89
96
|
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
__weak __typeof(self) weakSelf = self;
|
|
98
|
+
RCTBundleURLBlock bundleUrlBlock = ^{
|
|
99
|
+
RCTAppDelegate *strongSelf = weakSelf;
|
|
100
|
+
return strongSelf.bundleURL;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
RCTRootViewFactoryConfiguration *configuration =
|
|
104
|
+
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock
|
|
105
|
+
newArchEnabled:self.newArchEnabled];
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
|
|
105
111
|
#pragma mark - Feature Flags
|
|
106
112
|
class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
public:
|
|
114
|
+
bool enableBridgelessArchitecture() override
|
|
115
|
+
{
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
bool enableFabricRenderer() override
|
|
119
|
+
{
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
bool useTurboModules() override
|
|
123
|
+
{
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
bool useNativeViewConfigsInBridgelessMode() override
|
|
127
|
+
{
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
bool enableFixForViewCommandRace() override
|
|
133
|
+
{
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
128
136
|
};
|
|
129
137
|
|
|
130
138
|
- (void)_setUpFeatureFlags
|
|
131
139
|
{
|
|
132
140
|
facebook::react::ReactNativeFeatureFlags::override(
|
|
133
|
-
|
|
141
|
+
std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
|
|
134
142
|
}
|
|
135
143
|
#endif
|
|
136
144
|
|
|
137
145
|
@end
|
|
138
|
-
|
|
@@ -238,8 +238,9 @@
|
|
|
238
238
|
507ACB1223F44D1E00829911 /* RNNComponentView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 507ACB1023F44D1E00829911 /* RNNComponentView.mm */; };
|
|
239
239
|
507ACB1523F44E5200829911 /* RNNComponentRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 507ACB1323F44E5200829911 /* RNNComponentRootView.h */; };
|
|
240
240
|
507ACB1623F44E5200829911 /* RNNComponentRootView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 507ACB1423F44E5200829911 /* RNNComponentRootView.mm */; };
|
|
241
|
-
507DBBDB2A31DE8400F1FC74 /* RNNAppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 507DBBD92A31DE8400F1FC74 /* RNNAppDelegate.h */; };
|
|
241
|
+
507DBBDB2A31DE8400F1FC74 /* RNNAppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 507DBBD92A31DE8400F1FC74 /* RNNAppDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
242
242
|
507DBBDC2A31DE8400F1FC74 /* RNNAppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 507DBBDA2A31DE8400F1FC74 /* RNNAppDelegate.mm */; };
|
|
243
|
+
507DBBDD2A31DE8400F1FC75 /* ReactNativeVersionExtracted.h in Headers */ = {isa = PBXBuildFile; fileRef = 507DBBDE2A31DE8400F1FC76 /* ReactNativeVersionExtracted.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
243
244
|
507E7D57201DDD3000444E6C /* RNNSharedElementAnimationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 507E7D55201DDD3000444E6C /* RNNSharedElementAnimationOptions.h */; };
|
|
244
245
|
507E7D58201DDD3000444E6C /* RNNSharedElementAnimationOptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 507E7D56201DDD3000444E6C /* RNNSharedElementAnimationOptions.mm */; };
|
|
245
246
|
507F43C51FF4F17C00D9425B /* RNNTopTabsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */; };
|
|
@@ -735,6 +736,7 @@
|
|
|
735
736
|
507ACB1423F44E5200829911 /* RNNComponentRootView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNComponentRootView.mm; sourceTree = "<group>"; };
|
|
736
737
|
507DBBD92A31DE8400F1FC74 /* RNNAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNAppDelegate.h; sourceTree = "<group>"; };
|
|
737
738
|
507DBBDA2A31DE8400F1FC74 /* RNNAppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNNAppDelegate.mm; sourceTree = "<group>"; };
|
|
739
|
+
507DBBDE2A31DE8400F1FC76 /* ReactNativeVersionExtracted.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReactNativeVersionExtracted.h; sourceTree = "<group>"; };
|
|
738
740
|
507E7D55201DDD3000444E6C /* RNNSharedElementAnimationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSharedElementAnimationOptions.h; sourceTree = "<group>"; };
|
|
739
741
|
507E7D56201DDD3000444E6C /* RNNSharedElementAnimationOptions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSharedElementAnimationOptions.mm; sourceTree = "<group>"; };
|
|
740
742
|
507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabsViewController.h; sourceTree = "<group>"; };
|
|
@@ -1588,6 +1590,7 @@
|
|
|
1588
1590
|
7BA500741E2544B9001B9E1B /* ReactNativeNavigation.mm */,
|
|
1589
1591
|
507DBBD92A31DE8400F1FC74 /* RNNAppDelegate.h */,
|
|
1590
1592
|
507DBBDA2A31DE8400F1FC74 /* RNNAppDelegate.mm */,
|
|
1593
|
+
507DBBDE2A31DE8400F1FC76 /* ReactNativeVersionExtracted.h */,
|
|
1591
1594
|
5030B62023D5B4CA008F1642 /* Color+Interpolation.h */,
|
|
1592
1595
|
5030B61F23D5B4CA008F1642 /* Color+Interpolation.mm */,
|
|
1593
1596
|
5030B62623D5B54D008F1642 /* LNInterpolable.h */,
|
|
@@ -1857,6 +1860,7 @@
|
|
|
1857
1860
|
5050465421F8F4490035497A /* RNNReactComponentRegistry.h in Headers */,
|
|
1858
1861
|
506BF65C2600AE4200A22755 /* CenterTransition.h in Headers */,
|
|
1859
1862
|
507DBBDB2A31DE8400F1FC74 /* RNNAppDelegate.h in Headers */,
|
|
1863
|
+
507DBBDD2A31DE8400F1FC75 /* ReactNativeVersionExtracted.h in Headers */,
|
|
1860
1864
|
504AFE741FFFF0540076E904 /* RNNTopTabsOptions.h in Headers */,
|
|
1861
1865
|
50E38DD723A7A2BE009817F6 /* AnimatedViewFactory.h in Headers */,
|
|
1862
1866
|
E8E5182E1F83A48B000467AC /* RNNTransitionStateHolder.h in Headers */,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-navigation",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
4
4
|
"description": "React Native Navigation - truly native navigation for iOS and Android",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"nativePackage": true,
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"hoist-non-react-statics": "3.
|
|
79
|
-
"lodash": "4.17.
|
|
78
|
+
"hoist-non-react-statics": "3.3.2",
|
|
79
|
+
"lodash": "4.17.21",
|
|
80
80
|
"prop-types": "15.x.x",
|
|
81
81
|
"react-lifecycles-compat": "^3.0.4",
|
|
82
82
|
"tslib": "1.9.3"
|
|
@@ -88,21 +88,21 @@
|
|
|
88
88
|
"@babel/preset-env": "^7.25.3",
|
|
89
89
|
"@babel/runtime": "^7.25.0",
|
|
90
90
|
"@babel/types": "7.25.0",
|
|
91
|
-
"@react-native-community/cli": "
|
|
92
|
-
"@react-native-community/cli-platform-android": "
|
|
93
|
-
"@react-native-community/cli-platform-ios": "
|
|
91
|
+
"@react-native-community/cli": "18.0.0",
|
|
92
|
+
"@react-native-community/cli-platform-android": "18.0.0",
|
|
93
|
+
"@react-native-community/cli-platform-ios": "18.0.0",
|
|
94
94
|
"@react-native-community/datetimepicker": "^8.2.0",
|
|
95
95
|
"@react-native-community/netinfo": "^11.4.1",
|
|
96
|
-
"@react-native/babel-preset": "0.
|
|
97
|
-
"@react-native/eslint-config": "0.
|
|
98
|
-
"@react-native/metro-config": "0.
|
|
99
|
-
"@react-native/typescript-config": "0.
|
|
96
|
+
"@react-native/babel-preset": "0.79.7",
|
|
97
|
+
"@react-native/eslint-config": "0.79.7",
|
|
98
|
+
"@react-native/metro-config": "0.79.7",
|
|
99
|
+
"@react-native/typescript-config": "0.79.7",
|
|
100
100
|
"@testing-library/jest-native": "^5.4.2",
|
|
101
101
|
"@testing-library/react-native": "^13.0.1",
|
|
102
102
|
"@types/hoist-non-react-statics": "^3.3.6",
|
|
103
103
|
"@types/jasmine": "3.5.10",
|
|
104
104
|
"@types/jest": "^29.5.13",
|
|
105
|
-
"@types/lodash": "^4.
|
|
105
|
+
"@types/lodash": "^4.17.20",
|
|
106
106
|
"@types/react": "^18.2.6",
|
|
107
107
|
"@types/react-test-renderer": "^18.0.0",
|
|
108
108
|
"@typescript-eslint/eslint-plugin": "8.21.0",
|
|
@@ -124,11 +124,12 @@
|
|
|
124
124
|
"pngjs": "^6.0.0",
|
|
125
125
|
"prettier": "2.8.8",
|
|
126
126
|
"react": "19.0.0",
|
|
127
|
-
"react-native": "0.
|
|
127
|
+
"react-native": "0.79.7",
|
|
128
128
|
"react-native-builder-bob": "^0.40.13",
|
|
129
129
|
"react-native-fast-image": "^8.6.3",
|
|
130
130
|
"react-native-gesture-handler": "^2.22.1",
|
|
131
|
-
"react-native-reanimated": "
|
|
131
|
+
"react-native-reanimated": "4.1.5",
|
|
132
|
+
"react-native-worklets": "0.5.0",
|
|
132
133
|
"react-redux": "9.1.2",
|
|
133
134
|
"react-test-renderer": "19.0.0",
|
|
134
135
|
"redux": "^5.0.1",
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
"workspaces": [
|
|
144
145
|
"playground"
|
|
145
146
|
],
|
|
146
|
-
"packageManager": "yarn@
|
|
147
|
+
"packageManager": "yarn@4.12.0",
|
|
147
148
|
"husky": {
|
|
148
149
|
"hooks": {
|
|
149
150
|
"pre-commit": "lint-staged"
|
|
@@ -151,7 +152,8 @@
|
|
|
151
152
|
},
|
|
152
153
|
"lint-staged": {
|
|
153
154
|
"*.{js,ts,tsx}": "eslint --fix",
|
|
154
|
-
"*.{h,m,mm}": "node ./scripts/check-clang-format"
|
|
155
|
+
"*.{h,m,mm}": "node ./scripts/check-clang-format",
|
|
156
|
+
"yarn.lock": "./scripts/clean-yarn-lock.sh"
|
|
155
157
|
},
|
|
156
158
|
"codegenConfig": {
|
|
157
159
|
"name": "rnnavigation",
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation;
|
|
2
|
-
|
|
3
|
-
import android.app.Application;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.ReactApplication;
|
|
6
|
-
import com.facebook.react.ReactHost;
|
|
7
|
-
import com.facebook.react.ReactNativeHost;
|
|
8
|
-
import com.facebook.react.ReactPackage;
|
|
9
|
-
import com.facebook.react.defaults.DefaultReactHost;
|
|
10
|
-
|
|
11
|
-
import java.util.Collections;
|
|
12
|
-
import java.util.List;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
public class TestApplication extends Application implements ReactApplication {
|
|
16
|
-
private final ReactNativeHost host = new ReactNativeHost(this) {
|
|
17
|
-
@Override
|
|
18
|
-
public boolean getUseDeveloperSupport() {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Override
|
|
23
|
-
protected List<ReactPackage> getPackages() {
|
|
24
|
-
return Collections.emptyList();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
@Override
|
|
29
|
-
public void onCreate() {
|
|
30
|
-
super.onCreate();
|
|
31
|
-
setTheme(androidx.appcompat.R.style.Theme_AppCompat);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@Override
|
|
35
|
-
public ReactNativeHost getReactNativeHost() {
|
|
36
|
-
return host;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@Override
|
|
40
|
-
public ReactHost getReactHost() {
|
|
41
|
-
return DefaultReactHost.getDefaultReactHost(this, getReactNativeHost());
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import * as mockHelpers from './__helpers__/fixtures';
|
|
3
|
-
|
|
4
|
-
jest.mock('./log');
|
|
5
|
-
|
|
6
|
-
describe('appDelegateLinker', () => {
|
|
7
|
-
it('should work for RN 0.77 with Objective-C', () => {
|
|
8
|
-
jest.mock('./path', () => {
|
|
9
|
-
const appDelegatePath = mockHelpers.prepareFixtureDuplicate77({
|
|
10
|
-
userFixtureFileName: 'AppDelegate.mm.template',
|
|
11
|
-
patchedFixtureFileName: 'rnn-tests_AppDelegate.mm',
|
|
12
|
-
});
|
|
13
|
-
return {
|
|
14
|
-
appDelegate: appDelegatePath,
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const AppDelegateLinker = require('./appDelegateLinker');
|
|
19
|
-
const linker = new AppDelegateLinker();
|
|
20
|
-
|
|
21
|
-
linker.link();
|
|
22
|
-
const appDelegateContent = fs.readFileSync(linker.appDelegatePath, 'utf8');
|
|
23
|
-
expect(appDelegateContent).toMatchSnapshot();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should work for RN 0.77 with Swift', () => {
|
|
27
|
-
jest.mock('./path', () => {
|
|
28
|
-
const tmpAppDelegatePath = mockHelpers.prepareFixtureDuplicate77({
|
|
29
|
-
userFixtureFileName: 'AppDelegate.swift.template',
|
|
30
|
-
patchedFixtureFileName: 'rnn-tests_AppDelegate.swift',
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
appDelegate: tmpAppDelegatePath,
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const AppDelegateLinker = require('./appDelegateLinker');
|
|
39
|
-
const linker = new AppDelegateLinker();
|
|
40
|
-
linker.link();
|
|
41
|
-
|
|
42
|
-
const appDelegateContent = fs.readFileSync(linker.appDelegatePath, 'utf8');
|
|
43
|
-
expect(appDelegateContent).toMatchSnapshot();
|
|
44
|
-
});
|
|
45
|
-
});
|