Skip to content

Commit bd5dac0

Browse files
authored
Merge branch 'master' into feat/8011-android-enable-more-tests
2 parents 1794ba5 + 8cb9e6a commit bd5dac0

270 files changed

Lines changed: 18832 additions & 824 deletions

File tree

Some content is hidden

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

ReactNativeNavigation.podspec

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
require 'json'
2+
require 'find'
23

34
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
45

56
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
67

78
# Detect if this is a Swift project by looking for user AppDelegate.swift files
8-
dependency_paths = ['/node_modules/', '/Pods/', '/build/', '/Build/', '/DerivedData/']
9-
swift_project = Dir.glob('**/AppDelegate.swift')
10-
.reject { |file| dependency_paths.any? { |path| file.include?(path) } }
11-
.any?
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)
1219

1320
# Debug output
1421
if swift_project
1522
puts "ReactNativeNavigation: Swift AppDelegate detected - enabling Swift-compatible configuration"
16-
else
23+
else
1724
puts "ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration"
1825
end
1926

@@ -43,19 +50,19 @@ Pod::Spec.new do |s|
4350
end
4451

4552
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'
46-
53+
4754
# Base xcconfig settings
4855
xcconfig_settings = {
4956
'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"',
5057
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
5158
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
5259
}
53-
60+
5461
# Only add DEFINES_MODULE for Swift projects
5562
if swift_project
5663
xcconfig_settings["DEFINES_MODULE"] = "YES"
5764
end
58-
65+
5966
s.pod_target_xcconfig = xcconfig_settings
6067

6168
if fabric_enabled

autolink/fixtures/rn68/MainActivity.java.template

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

autolink/fixtures/rn69/MainActivity.java.template

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

autolink/fixtures/rn71/MainActivity.java.template

Lines changed: 0 additions & 35 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.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+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const prepareFixtureDuplicate = ({ rnVersion, userFixtureFileName, patchedFixtureFileName }) => {
2+
const fs = require('node:fs');
3+
const path = require('node:path');
4+
const os = require('node:os');
5+
6+
const userFixtureRelPath = _getRelativeFixturePath(rnVersion, userFixtureFileName);
7+
8+
const userFixturePath = path.resolve(userFixtureRelPath);
9+
const patchedFixturePath = path.resolve(os.tmpdir(), patchedFixtureFileName);
10+
fs.copyFileSync(userFixturePath, patchedFixturePath);
11+
12+
return patchedFixturePath;
13+
};
14+
15+
const _getRelativeFixturePath = (rnVersion, fixtureFileName) => {
16+
const path = require('node:path');
17+
return path.join('autolink', 'fixtures', `rn${rnVersion}`, fixtureFileName);
18+
};
19+
20+
module.exports = {
21+
prepareFixtureDuplicate,
22+
prepareFixtureDuplicate77: ({ userFixtureFileName, patchedFixtureFileName }) =>
23+
prepareFixtureDuplicate({ rnVersion: '77', userFixtureFileName, patchedFixtureFileName }),
24+
};

autolink/postlink/__mocks__/log.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
log: console.log,
3+
logn: console.log,
4+
warn: console.log,
5+
warnn: console.log,
6+
info: console.log,
7+
infon: console.log,
8+
debug: console.log,
9+
debugn: console.log,
10+
errorn: console.log,
11+
};

autolink/postlink/__snapshots__/activityLinker.test.js.snap

Lines changed: 7 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,14 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`activityLinker should work for RN 0.68 1`] = `
4-
"package com.app;
3+
exports[`activityLinker should work for RN 0.77 1`] = `
4+
"package com.app
55
6-
import com.reactnativenavigation.NavigationActivity;
7-
import com.facebook.react.ReactActivityDelegate;
8-
import com.facebook.react.ReactRootView;
6+
import com.reactnativenavigation.NavigationActivity
7+
import com.facebook.react.ReactActivityDelegate
8+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
9+
import com.facebook.react.defaults.DefaultReactActivityDelegate
910
10-
public class MainActivity extends NavigationActivity {
11-
12-
13-
14-
15-
16-
public static class MainActivityDelegate extends ReactActivityDelegate {
17-
public MainActivityDelegate(NavigationActivity activity, String mainComponentName) {
18-
super(activity, mainComponentName);
19-
}
20-
21-
@Override
22-
protected ReactRootView createRootView() {
23-
ReactRootView reactRootView = new ReactRootView(getContext());
24-
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
25-
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
26-
return reactRootView;
27-
}
28-
}
29-
}
30-
"
31-
`;
32-
33-
exports[`activityLinker should work for RN 0.69 1`] = `
34-
"package com.app;
35-
36-
import com.reactnativenavigation.NavigationActivity;
37-
import com.facebook.react.ReactActivityDelegate;
38-
import com.facebook.react.ReactRootView;
39-
40-
public class MainActivity extends NavigationActivity {
41-
42-
43-
44-
45-
46-
public static class MainActivityDelegate extends ReactActivityDelegate {
47-
public MainActivityDelegate(NavigationActivity activity, String mainComponentName) {
48-
super(activity, mainComponentName);
49-
}
50-
51-
@Override
52-
protected ReactRootView createRootView() {
53-
ReactRootView reactRootView = new ReactRootView(getContext());
54-
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
55-
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
56-
return reactRootView;
57-
}
58-
59-
@Override
60-
protected boolean isConcurrentRootEnabled() {
61-
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
62-
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
63-
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
64-
}
65-
}
66-
}
67-
"
68-
`;
69-
70-
71-
exports[`activityLinker should work for RN 0.71 1`] = `
72-
"package com.app;
73-
74-
import com.reactnativenavigation.NavigationActivity;
75-
import com.facebook.react.ReactActivityDelegate;
76-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
77-
import com.facebook.react.defaults.DefaultReactActivityDelegate;
78-
79-
public class MainActivity extends NavigationActivity {
11+
class MainActivity : NavigationActivity() {
8012
8113
8214

0 commit comments

Comments
 (0)