Commit Graph

76 Commits

Author SHA1 Message Date
Riccardo Cipolleschi 83e6eaf693 Prevent users from opting-out of the New Architecture (#53026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53026

This change prevents users from opting out of the New Architecure.

The change is non breaking with respect to building an app: all the functions are still there, even if they are unreachable, in case users will still call them explicitly.
We hardcoded all the values to enable the New Architecture, so there is no way to disable it.

This is a behavioral breaking change, though.

## Changelog:
[iOS][Removed] - Removed the opt-out from the New Architecture.

Reviewed By: cortinico

Differential Revision: D79090048

fbshipit-source-id: 9779bfedf50748d7adbef5f7ef038f469e30efc2
2025-08-05 11:37:24 -07:00
Christoph Purrer 06034554e4 Remove SampleTurboCxxModule example (#52442)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52442

Changelog: [Internal]

The sample is from an outdated approach of enabling C++ Modules in RN which is not recommended anymore.

Prefer C++ Turbo Modules if you need to expose / access C or C++ APIs in RN apps:

https://reactnative.dev/docs/the-new-architecture/pure-cxx-modules

It is not included in any RNTester app at this time

Reviewed By: cortinico

Differential Revision: D77771111

fbshipit-source-id: a4fe1d13fd0224babc46f54b921a036f7b237a48
2025-07-07 09:37:37 -07:00
David Richey 634f06688c Apply SWIFTFORMAT to fbsource
Summary:
```
hg files -I '**/*.swift' \
| arc lint \
  --take SWIFTFORMAT \
  --apply-patches \
  --no-paths-check \
  --paths-from - \
  --eden-prefetch \
  --output none \
  > /dev/null
```

Reviewed By: ebgraham

Differential Revision: D73276943

fbshipit-source-id: 5432642a217fc1fa37eb97409a2cc282f65c3117
2025-04-20 18:08:18 -07:00
Alex Hunt 094a22fa16 Split out CdpJson into separate library (#50170)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50170

This is needed in D71470038 and later, where submodules of `jsinspector-modern` need to operate with CDP message payloads. We functionally split out these files as a library to avaoid a dependency cycle.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D71551561

fbshipit-source-id: 527479399d7563883c1b6599f884b7857e79bd77
2025-03-20 20:07:37 -07:00
Riccardo Cipolleschi 8b33668c43 Add missing loadFromSource method in the DefaultRNFactoryDelegate (#49931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49931

This change fixes the app startup in the Old Architecture by implementing the loadSourceForBridge:onProgress:onComplete method in the RCTDefaultReactNativeFactoryDelegate object.

The method was missing here, so the Bridge was never trying to load the JS bundle from Metro, resulting in an empty app.

## Changelog:
[iOS][Fixed] - Implement the loadSourceForBridge:onProgress:onComplete in the RCTDefaultReactNativeFactoryDelegate.

Reviewed By: cortinico

Differential Revision: D70898811

fbshipit-source-id: 3e5d519a1965e92ace91ca6d5b316a9069279448
2025-03-10 11:05:39 -07:00
Oskar Kwaśniewski a033cf9d5e fix: remove UISceneDelegate from AppDelegate (#49628)
Summary:
After this change: https://github.com/facebook/react-native/pull/49078 UIWindowSceneDelegate is no longer needed.

This wasn't removed in the original PR.

## Changelog:

[iOS] [Removed] - Remove no longer needed UISceneDelegate

Pull Request resolved: https://github.com/facebook/react-native/pull/49628

Test Plan: CI GREEN

Reviewed By: cortinico

Differential Revision: D70102384

Pulled By: cipolleschi

fbshipit-source-id: e33185a4becd949a9f0ec1eabeeb4fe85ef3ee79
2025-02-25 05:03:12 -08:00
Oskar Kwaśniewski 74de9526ab chore(iOS): deprecate RCTAppDelegate (#49078)
Summary:
Recently, I've introduced `RCTReactNativeFactory` in this PR: https://github.com/facebook/react-native/issues/46298, which is a good successor for `RCTAppDelegate`.

### Why?

`RCTAppDelegate` introduced strong coupling between React Native and AppDelegate pattern. From iOS 13+ there is a newer equivalent (Scene Delegate) which is not possible to achieve with current architecture. The proposed solution involves migration to a `RCTReactNativeFactory` a class that encapsulates initialization logic of React Native.

This migration will make brownfield initialization easier by making it more flexible and simpler to integrate into already established apps.

### Deprecation plan

The plan I've discussed with cipolleschi involves:

- Deprecation of `RCTAppDelegate` in 0.79 (current main)
- Migration off `RCTAppDelegate` to SceneDelegate + `RCTReactNativeFactory` in 0.80

## Changelog:

[IOS] [DEPRECATED] - deprecate RCTAppDelegate

Pull Request resolved: https://github.com/facebook/react-native/pull/49078

Test Plan: Not needed

Reviewed By: cortinico

Differential Revision: D69061022

Pulled By: cipolleschi

fbshipit-source-id: b02a0ff3f26be9320da749f38c9cf083804f9f30
2025-02-17 09:12:17 -08:00
Oskar Kwaśniewski 081be01a5d feat: implement ReactNativeFactory (#46298)
Summary:
This PR implements ReactNativeFactory to encapsulate further the logic of creating an instance of React Native for iOS.

This will remove the strong coupling on the RCTAppDelegate and allow us to support Scene Delegate in the future.

The goal is to have a following API:

```objc
self.reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:self];

UIView *rootView = [self.reactNativeFactory.rootViewFactory viewWithModuleName:self.moduleName
                                                               initialProperties:self.initialProps
                                                                   launchOptions:launchOptions];

// Standard iOS stuff here
```

## Changelog:

[IOS] [ADDED] - implement ReactNativeFactory

Pull Request resolved: https://github.com/facebook/react-native/pull/46298

Test Plan: Test out all the methods of AppDelegate

Reviewed By: huntie

Differential Revision: D67451403

Pulled By: cipolleschi

fbshipit-source-id: 9e73cd996ffc27ca1e3e058b45fc899b1637bdba
2024-12-31 07:45:25 -08:00
zhongwuzw 8dfed7df4b RNTester: Fixes crash when app back to background (#48385)
Summary:
https://github.com/facebook/react-native/issues/48376 removed `applicationDidEnterBackground` from `RCTAppDelegate` but RNTester called it, leads to crash. cc cipolleschi can you please help to review?

## Changelog:

[INTERNAL] [FIXED] - RNTester: Fixes crash when app back to background

Pull Request resolved: https://github.com/facebook/react-native/pull/48385

Test Plan: RNTester iOS back to background not crash.

Reviewed By: cipolleschi

Differential Revision: D67657449

Pulled By: philIip

fbshipit-source-id: e6d806b2677050fa2faa273a7468055d9d21c2a3
2024-12-27 04:16:25 -08:00
Riccardo Cipolleschi 102062fbc7 Extract RCTAppDependencyProvider in a separate pod (#47761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47761

When breaking the last dependency, we created the `RCTApDependencyProvider` in the Codegen pod.

This is not an issue per sè. The problem comes in with the new template in Swift: ReactCodegen contains some headers with some C++ code that Swift can't really process.

That's why most libraries started failing in jobs like [this one](https://github.com/facebook/react-native/actions/runs/11906196751/job/33177904733): the template app was not able to load the `ReactCodegen` pod in the Swift app delegate.

Given that the app delegate only have to actually load the RCTAppDependencyProvider, I extracted that class in its own pod: ReactAppDependencyProvider.

The name of the pod does not follow the React-RCTXXX structure because that will create issues with the import statements and the `use_frameworks!`  use case.

> [!NOTE]
> We need to update the template and change the `import ReactCodegen` to `import ReactAppDependencyProvider`

## Changelog:
[iOS][Added] - Extract RCTAppDependencyProvider in the ReactAppDependencyProvider pod

Reviewed By: blakef

Differential Revision: D66241941

fbshipit-source-id: 6b888109c65d9560fff322ec84a16da78fbcd64b
2024-11-20 10:51:56 -08:00
Riccardo Cipolleschi 95fc906930 Pass the RCTAppDependencyProvider to the RCTAppDelegate (#47651)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47651

## This Change:

This change uses in the App's AppDelegate the newly generated `RCTAppDependencyProvider`, passing it to the `RCTAppDelegate`.

This change needs to be applied also to the template, when this stack lands.

## Context

React Native has a last temporal dependency on Codegen in the React-RCTAppDelegate pod.

The RCTAppDelegate has the responsibility to provide various dependencies to react native, like third party components and various modules. ReactCodegen is generated when the user create the project, while React-RCTAppDelegate eists in React Native itself.

This dependency means that we cannot prepare prebuilt for iOS for React Native because when we would have to create prebuilds, we would need the React Codegen, but we can't create a React codegen package that will fit all the apps, because React Codegen can contains App Specific modules and components and apps might have different dependencies.

## Changelog:
[iOS][Added] - Pass the `RCTAppDependencyProvider` to the `RCTAppDelegate`

Reviewed By: dmytrorykun

Differential Revision: D66074475

fbshipit-source-id: 93bf500fe37f115352ebd49d3d56955cbaeeea72
2024-11-18 08:06:13 -08:00
Riccardo Cipolleschi 8becc2514d Generate RCTThirdPartyComponentProvider (#47518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47518

This change reintroduce the generation of the `RCTThirdPartyComponentProvider` but in the right place and with the right patterns.

1. We are generating it in the user space, not in the node_modules (fixes the circular dependency)
2. We are not using weak function signature that have to be implicitly linked to some symbols found during compilation

The change needs to crawl the folder to retrieve the information it needs. We need to implement it this way not to be breaking with respect of the current implementation.

The assumption is that components have a function in their `.mm` file with this shape:
```objc
Class<RCTComponentViewProtocol> <componentName>Cls(void)
{
  return <ComponentViewClass>.class;
}
```
I verified on GH that all the libraries out there follow this pattern.

A better approach will let library owner to specify the association of `componentName, componentClass` in the `codegenConfig`.

We will implement that as the next step and we will support both for some versions for backward compatibility.

## Changelog
[iOS][Changed] - Change how components automatically register

Reviewed By: dmytrorykun

Differential Revision: D65614347

fbshipit-source-id: a378b8bc31c1ab3d49552f2f6a4c86c3b578746b
2024-11-12 07:38:03 -08:00
zhongwuzw 8cbc7c3357 Fixes rn-tester bundled images examples (#44482)
Summary:
Fixes rn-tester bundled images example

Before:
![image](https://github.com/facebook/react-native/assets/5061845/d33ae01b-f1de-4918-882e-b01be7e1df6f)
After:
![image](https://github.com/facebook/react-native/assets/5061845/19ff2702-e7b3-4cb0-b48b-46c270b1114d)

## Changelog:

[IOS] [FIXED] - Fixes rn-tester bundled images examples

Pull Request resolved: https://github.com/facebook/react-native/pull/44482

Test Plan: N/L

Reviewed By: dmytrorykun

Differential Revision: D65757405

Pulled By: cipolleschi

fbshipit-source-id: 29a82acacee58d803f2bfea93444adae6aee1b79
2024-11-12 04:18:17 -08:00
Alex Hunt e9e5fb0141 Remove unstable_fuseboxEnabled API (#45926)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45926

Removes the temporary `unstable_fuseboxEnabled` API on both platforms. Fusebox is enabled by default on `main` since https://github.com/facebook/react-native/pull/45469.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D60893243

fbshipit-source-id: 7ca4550eafb979730c0c5829df4c200f11e0df30
2024-08-07 06:40:13 -07:00
Alex Hunt 55e08a9319 Enable Fusebox by default in RNTester (#44895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44895

Enables the new debugger stack (codename Fusebox) in RNTester.

This feature is experimental and is enabled for testing purposes only. This change **should not** be adopted as the default by React Native frameworks.

Changelog: [Internal]

Reviewed By: cortinico, rubennorte, NickGerleman

Differential Revision: D58366246

fbshipit-source-id: 809a1edb79ced4a7920457ed661cc3d863b35c7b
2024-06-12 08:30:40 -07:00
Alex Hunt 812f155527 Expose unstable_fuseboxEnabled API on iOS (#44860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44860

- Enables an opt-in to the Fusebox stack on iOS for both architectures in open source.
- Templates use of this opt-in in RNTester.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D58364053

fbshipit-source-id: c604b1589174bf7cfd0fe1bfb5624c4edd0a125d
2024-06-11 04:38:32 -07:00
Saad Najmi c67dfbbe42 chore(ci): Set retryOnFailure for RNTester iOS Unit and Integration tests (#44642)
Summary:
On React Native macOS (I am not sure with the current state of React Native), the Xcode Unit and Integration tests are a bit flaky. Rather than set "retry on failure up to 3 times" through the pipeline config (in our case, Azure Pipelines), I realized my earlier PR to use Xcode test plans (https://github.com/facebook/react-native/pull/36443) means we can have Xcode retry the test. This should be faster than retrying it on the pipeline, because it retries just the failing test, not the entire "test" step. I did this on React Native macOS, so I'm doing it upstream so we can remove a diff.

## Changelog:

[INTERNAL] [CHANGED] - Set `retryOnFailure` for Xcode Unit and Integration tests

Pull Request resolved: https://github.com/facebook/react-native/pull/44642

Test Plan: CI should pass (faster)

Reviewed By: cortinico

Differential Revision: D57662523

Pulled By: cipolleschi

fbshipit-source-id: 8de2ab0ea15ba4d38c3b5bf96108c0c7ff5e9f32
2024-05-30 07:24:35 -07:00
Oskar Kwaśniewski ec928d7a66 feat(RCTAppDelegate): Implement RCTRootViewFactory (#42263)
Summary:
This PR implements `RCTRootViewFactory` a utility class (suggested by cipolleschi) that returns proper RCTRootView based on the current environment state (new arch/old arch/bridgeless). This class aims to preserve background compatibility by implementing a configuration class forwarding necessary class to RCTAppDelegate.

### Brownfield use case

This PR leverages the `RCTRootViewFactory` in `RCTAppDelegate` for the default initialization of React Native (greenfield).

Here is an example of creating a Brownfield integration (without RCTAppDelegate) using this class (can be later added to docs):

1. Store reference to `rootViewFactory` and to `UIWindow`

`AppDelegate.h`:
```objc
interface AppDelegate : UIResponder <UIApplicationDelegate>

property(nonatomic, strong) UIWindow* window;
property(nonatomic, strong) RCTRootViewFactory* rootViewFactory;

end
```

2. Create an initial configuration using `RCTRootViewFactoryConfiguration` and initialize `RCTRootViewFactory` using it. Then you can use the factory to create a new `RCTRootView` without worrying about old arch/new arch/bridgeless.

 `AppDelegate.mm`
```objc
implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions {

  // Create configuration
 RCTRootViewFactoryConfiguration *configuration = [[RCTRootViewFactoryConfiguration alloc] initWithBundleURL:self.bundleURL
                                                                                                 newArchEnabled:self.fabricEnabled
                                                                                             turboModuleEnabled:self.turboModuleEnabled
                                                                                              bridgelessEnabled:self.bridgelessEnabled];

  // Initialize RCTRootViewFactory
  self.rootViewFactory = [[RCTRootViewFactory alloc] initWithConfiguration:configuration];

  // Create main root view
  UIView *rootView = [self.rootViewFactory viewWithModuleName:@"RNTesterApp" initialProperties:@{} launchOptions:launchOptions];

  // Set main window as you prefer for your Brownfield integration.
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  // Later in the codebase you can initialize more rootView's using rootViewFactory.

  return YES;
}
end
```
bypass-github-export-checks

## Changelog:

[INTERNAL] [ADDED] - Implement RCTRootViewFactory

Pull Request resolved: https://github.com/facebook/react-native/pull/42263

Test Plan: Check if root view is properly created on app initialization

Reviewed By: dmytrorykun

Differential Revision: D53179625

Pulled By: cipolleschi

fbshipit-source-id: 9bc850965ba30d84ad3e67d91dd888f0547c2136
2024-03-04 10:14:44 -08:00
Rubén Norte 0eac4181cc Enable the native module for feature flags by default for iOS apps in OSS (#43159)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43159

Changelog: [internal]

This modifies the default `RCTAppDelegate` for iOS apps in OSS to provide an implementation for the C++ native module for feature flags.

In a following diff I'll replace the `React-featureflagsnativemodule.podspec` file with one that includes all built-in C++ native modules.

Reviewed By: RSNara

Differential Revision: D54082349

fbshipit-source-id: 8c4ed7499c6fd35916ba105edcae0e2c85961e1c
2024-02-23 01:14:03 -08:00
Phillip Pan cc147ceb79 add example for capturing initial notification in push notification manager (#42687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42687

Changelog: [Internal]

adding an example for if you want to use `getInitialNotification`.

Reviewed By: ingridwang

Differential Revision: D52931618

fbshipit-source-id: 7552c358e5bc98228b7ae74ea1adf450f7b075e6
2024-02-14 10:32:11 -08:00
Oskar Kwaśniewski c1b8f37580 fix: UpdatePropertiesExampleView mutate existing appProperties instead of overwriting (#42634)
Summary:
For Bridgeless mode we set `fabric` and `concurrentRoot` property for newly initialized views. This example overwrites those properties. I think we should Instead copy previous dictionary and only overwrite `color` key.

This issue results in a warning: "Using Fabric without concurrent root is deprecated. Please enable concurrent root for this application."

Note: This Example crashes on Bridgeless but my other PR https://github.com/facebook/react-native/issues/42263 fixes it.

## Changelog:

[INTERNAL] [FIXED] - UpdatePropertiesExampleView to mutate existing `appProperties` instead of overwriting

Pull Request resolved: https://github.com/facebook/react-native/pull/42634

Test Plan:
1. Wait for this example to get fixed for Bridgeless
2. Click the button to update props
3. Check if there is no warning

Reviewed By: cortinico

Differential Revision: D53126953

Pulled By: cipolleschi

fbshipit-source-id: fa0e8bda50a47696467d279845616c2ba51fe310
2024-02-07 07:31:32 -08:00
Ingrid Wang ccff2bb8d1 Migrate RNTester onto new RN notification callbacks (#42406)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42406

## Changelog:

[iOS][Changed] Migrated RNTester/AppDelegate to the new notification callback

Reviewed By: philIip

Differential Revision: D52883367

fbshipit-source-id: 0afcd81f4ad4ee0c49b264785fa261789603a072
2024-01-24 09:29:41 -08:00
Saad Najmi 1dd647484a Remove TARGET_OS_UIKITFORMAC macros (#42278)
Summary:
There seems to be a lot of `TARGET_OS_UIKITFORMAC` macro in React Native that don't need to be there. Let's remove them.

First off, what is `TARGET_OS_UIKITFORMAC` targeting? You might think it's [Mac Catalyst](https://developer.apple.com/mac-catalyst/), if you look at the [commit](https://github.com/facebook/react-native/commit/3724810d2168eb182db24acf9e741775df27ae13) introducing the ifdefs.  However.. that doesn't seem right because `TARGET_OS_MACCATALYST` exists, and is used elsewhere in the codebase. In fact, if you look at this handy comment inside `TargetConditionals.h` (the file that defines all these conditionals), `TARGET_OS_UIKITFORMAC` is not even on there!

```
/*
 *  TARGET_OS_*
 *
 *  These conditionals specify in which Operating System the generated code will
 *  run.  Indention is used to show which conditionals are evolutionary subclasses.
 *
 *  The MAC/WIN32/UNIX conditionals are mutually exclusive.
 *  The IOS/TV/WATCH/VISION conditionals are mutually exclusive.
 *
 *    TARGET_OS_WIN32              - Generated code will run on WIN32 API
 *    TARGET_OS_WINDOWS            - Generated code will run on Windows
 *    TARGET_OS_UNIX               - Generated code will run on some Unix (not macOS)
 *    TARGET_OS_LINUX              - Generated code will run on Linux
 *    TARGET_OS_MAC                - Generated code will run on a variant of macOS
 *      TARGET_OS_OSX                - Generated code will run on macOS
 *      TARGET_OS_IPHONE             - Generated code will run on a variant of iOS (firmware, devices, simulator)
 *        TARGET_OS_IOS                - Generated code will run on iOS
 *          TARGET_OS_MACCATALYST        - Generated code will run on macOS
 *        TARGET_OS_TV                 - Generated code will run on tvOS
 *        TARGET_OS_WATCH              - Generated code will run on watchOS
 *        TARGET_OS_VISION             - Generated code will run on visionOS
 *        TARGET_OS_BRIDGE             - Generated code will run on bridge devices
 *      TARGET_OS_SIMULATOR          - Generated code will run on an iOS, tvOS, watchOS, or visionOS simulator
 *      TARGET_OS_DRIVERKIT          - Generated code will run on macOS, iOS, tvOS, watchOS, or visionOS
 *
 *    TARGET_OS_EMBEDDED           - DEPRECATED: Use TARGET_OS_IPHONE and/or TARGET_OS_SIMULATOR instead
 *    TARGET_IPHONE_SIMULATOR      - DEPRECATED: Same as TARGET_OS_SIMULATOR
 *    TARGET_OS_NANO               - DEPRECATED: Same as TARGET_OS_WATCH
 *
 *    +--------------------------------------------------------------------------------------+
 *    |                                    TARGET_OS_MAC                                     |
 *    | +-----+ +------------------------------------------------------------+ +-----------+ |
 *    | |     | |                  TARGET_OS_IPHONE                          | |           | |
 *    | |     | | +-----------------+ +----+ +-------+ +--------+ +--------+ | |           | |
 *    | |     | | |       IOS       | |    | |       | |        | |        | | |           | |
 *    | | OSX | | | +-------------+ | | TV | | WATCH | | BRIDGE | | VISION | | | DRIVERKIT | |
 *    | |     | | | | MACCATALYST | | |    | |       | |        | |        | | |           | |
 *    | |     | | | +-------------+ | |    | |       | |        | |        | | |           | |
 *    | |     | | +-----------------+ +----+ +-------+ +--------+ +--------+ | |           | |
 *    | +-----+ +------------------------------------------------------------+ +-----------+ |
 *    +--------------------------------------------------------------------------------------+
 */
```

Going even deeper into `TargetConditionals.h`, you will see `TARGET_OS_UIKITFORMAC` defined... and it's always 1 when `TARGET_OS_MACCATALYST` is 1, making it feel even more redundant. My current conclusion is it's either another variant of Mac Catalyst (the one where they just run unmodified UIKit maybe..), or it's an older macro back from when Catalyst was still experimental.

Either way, it's pretty obvious nobody is running or testing this codepath, and it adds bloat, especially to React Native macOS where we have extra ifdef blocks for macOS support (and eventually visionOS support). Let's remove it.

Another change I made while we're here:
I've seen this lingering TODO to replace setTargetRect:InView: / setMenuVisible:animated: (deprecated as of iOS 13, below our minimum OS requirement) with showMenuFromView (deprecated as of iOS 16, in line with the availability check). Let's just.... do that?

## Changelog:

[IOS] [REMOVED] - Remove TARGET_OS_UIKITFORMAC macros

Pull Request resolved: https://github.com/facebook/react-native/pull/42278

Test Plan:
RNTester with Mac Catalyst still compiles:
![Screenshot 2024-01-15 at 12 26 03 AM](https://github.com/facebook/react-native/assets/6722175/015bd37d-f536-43c7-9586-96187cdbd013)

Reviewed By: cipolleschi

Differential Revision: D52780690

Pulled By: sammy-SC

fbshipit-source-id: df6a333e8e15f79de0ce6f538ebd73b92698dcb6
2024-01-16 07:50:27 -08:00
Kevin Gozali 41d9ed0ef9 RNTester iOS: Move Meta-internal setup to internal files (#42073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42073

This moved various Meta-internal runtime setup off AppDelegate.mm to reduce the #if checks throughout the file.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D52424748

fbshipit-source-id: b53799c8bb1544dbbb429cea811861ae52125641
2024-01-02 13:53:05 -08:00
Kevin Gozali 5d520abd4c RNTester iOS: internal profiling test setup (#42071)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42071

Proxying background handling to set up Meta internal test infra.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D52420805

fbshipit-source-id: a68645b7b630f976dfd9e863b0c985c738c658ec
2023-12-26 15:26:57 -08:00
Christoph Purrer a8ca9b022b rntester-ios : Fix Bundle path (internal) (#41825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41825

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D51937593

fbshipit-source-id: 2f4a4e49487b7031cd91deda2bc6916f195ee734
2023-12-07 03:52:52 -08:00
Nick Gerleman 1c57e969fb Test against XCode 14.3 and 15 (#41798)
Summary:
Apple will require XCode 15 next year to ship to the app store, and it aligns with how we build and test React Native internally.

XCode 15 and 14.3 add support for a lot of [missing C++ 20 features](https://developer.apple.com/xcode/cpp/#c++20) from earlier versions as well.

Last I was aware, Riccardo was onboard with bumping min supported in 0.74 to XCode 15. This change does a slightly more conservative bump to min 14.3, and main of 15.0 (though we might want to move these before 0.74 comes out).

All of this will get migrated over to GHA soon enough as well, but... formalizing this is the only thing blocking usage of C++ 20 ranges today.

Changelog:
[ios][breaking] - Require XCode >= 14.3

Pull Request resolved: https://github.com/facebook/react-native/pull/41798

Test Plan:
1. CircleCI Passes
2. Can still boot RNTester from XCode with code signing related changes.

Reviewed By: cortinico

Differential Revision: D51840617

Pulled By: NickGerleman

fbshipit-source-id: 58f8951a436eb7c892a00432a8aad0ddd0a49da1
2023-12-05 15:35:05 -08:00
Riccardo Cipolleschi 951efc8ce2 Remove some usages of RCT_NEW_ARCH_ENABLED (#41589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41589

This is a cleanup diffs that removes some of the usages of RCT_NEW_ARCH_ENABLED.
Now that we are shipping all the pods, there is no need to conditionally compile-out part of the codebase depending on whether the new architecture is running or not.

This change will not alter the behavior of the app.

## Changelog:
[iOS][Breaking] - Remove some usages of RCT_NEW_ARCH_ENABLED. The change should be transparent BUT some **Swift** libraries might get broken by this change.

Reviewed By: dmytrorykun

Differential Revision: D51498730

fbshipit-source-id: c83416480eea1f7bbc55f72c31e7b69ad0e9e01a
2023-11-22 03:50:29 -08:00
Kevin Gozali c497fc61b5 RNTester iOS: setup Meta internal app init logic (#41591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41591

For internal build integration, invoke Meta internal app setup logic. This has no effect in OSS.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D51498070

fbshipit-source-id: 48658d2c3136023d80fbd9a2fdc29996616e1eee
2023-11-21 13:43:16 -08:00
Kevin Gozali c7bd397dac RNTester iOS: require arm64 device capabilities (#41551)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41551

We have since targeted iOS min SDK 13.4, it's time to move to `arm64`.

Reference: https://developer.apple.com/documentation/bundleresources/information_property_list/uirequireddevicecapabilities?language=objc

Changelog: [iOS][Fixed] Move UIRequiredDeviceCapabilities for RNTester to arm64

Reviewed By: cipolleschi

Differential Revision: D51461103

fbshipit-source-id: 726ca1f37d249092e8f10c2043d0b696bf64aa7d
2023-11-20 14:02:00 -08:00
Pieter De Baets 31cf4c4ead Fix AppDelegate not passing props in bridgeless and rename getBundleURL (#41169)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41169

* `initialProperties` should be based on `prepareInitialProps`, not `launchOptions` (which don't seem to have an equivalent in bridgeless)
* `getBundleURL` is not idiomatic Objective-C (eg https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html), so rename to `bundleURL`

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D50595790

fbshipit-source-id: b718ebf2590b1d4512bcbd4846c8d11200f486e4
2023-10-24 04:26:48 -07:00
Ingrid Wang 3bea8e1bd4 Delete empty didRegisterUserNotificationSettings (#41013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41013

## Changelog:

[iOS][Breaking] Deleted the no-op didRegisterUserNotificationSettings: callback in RCTPushNotificationManager

Reviewed By: philIip

Differential Revision: D50283620

fbshipit-source-id: 1582367c51c26e5b739cd9284d3b15bfa13274da
2023-10-16 17:01:16 -07:00
Christoph Purrer fdbfc4abc0 Add BUCK configuration for RNTester-iOS for NEW Arch (#39825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39825

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D49834561

fbshipit-source-id: 1721e9f7954b40b620f6c2005fe6924589bfa245
2023-10-05 00:01:44 -07:00
Christoph Purrer e1d824ffd8 Add BUCK configuration for RNTester-iOS (#39757)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39757

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D49817124

fbshipit-source-id: cccbdb324ca5ecc1795189a7c07cfed6aa220020
2023-10-04 21:59:34 -07:00
Kudo Chien bdfa368060 Fix build errors when importing React-Core module from Swift (#38993)
Summary:
supersedes https://github.com/facebook/react-native/issues/38806
the errors are actually coming from https://github.com/facebook/react-native/commit/42d67452eb9a#diff-226ff5f87f146abfebd14a69eeb7d95c358d53da30533321e3ae9281c8acc6f0L102. we should keep c++ headers as cocoapods private headers, so that those headers will not expose into the umbrella header.

this pr also adds a swift test file to rn-tester, so we can verify the fix and prevent the similar build errors in the future.

## Changelog:

[IOS] [FIXED] - Fix build errors when importing React-Core module from Swift

Pull Request resolved: https://github.com/facebook/react-native/pull/38993

Test Plan: add a swift file in rn-tester and make sure it builds successfully

Reviewed By: cipolleschi

Differential Revision: D48414292

Pulled By: NickGerleman

fbshipit-source-id: d65273adc4bfab927d7c3db1db6bb48d3e48349e
2023-08-18 17:31:01 -07:00
Lulu Wu d3c28d28a9 Migrate RNTester to Bridgeless (#38477)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38477

Changelog:
[iOS][Changed] - Migrate RNTester to Bridgeless

Reviewed By: philIip

Differential Revision: D47521323

fbshipit-source-id: db62700cb5cd8d72a6d2ac4ffcd2da91208ae675
2023-07-24 08:13:07 -07:00
Lulu Wu 42d67452eb Move .m to .mm to make obj-c and C++ headers compatible (#38135)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38135

Changelog:
[iOS][Changed] - Move .m to .mm to make obj-c and C++ headers compatible

Reviewed By: RSNara

Differential Revision: D47140743

fbshipit-source-id: 1f1fb24571f5154b17992d6a71587803407b9dd1
2023-07-24 08:13:07 -07:00
Christoph Purrer 856931b11b rn-tester > Use code-generated Turbo Module name constants (#38297)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38297

Continuation of https://github.com/facebook/react-native/pull/38295

Changelog:
[Internal] [Changed] - Use code-generated Turbo Module name constants

Reviewed By: shwanton

Differential Revision: D47376344

fbshipit-source-id: 62bd63b83d2aa47ef05ee7073e8c20bfdf192e44
2023-07-11 15:33:48 -07:00
Phillip Pan c86f15af30 adjust ats settings in plist in pod install (#38086)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38086

Changelog: [Internal]

in this diff, we update the developer's Info.plists to have the correct ATS settings

introducing usage of files: https://www.rubydoc.info/github/CocoaPods/Xcodeproj/Xcodeproj/Project#files-instance_method, in order to retrieve the plists

Reviewed By: cipolleschi

Differential Revision: D47041590

fbshipit-source-id: 3797ab18cf4f25ee377c8155a8cc4bb61f2bdcf1
2023-06-28 09:11:58 -07:00
Riccardo Cipolleschi b50874cad4 Remove missing dependencies from React-Fabric (#37652)
Summary:
When reverting the runtimescheduler fix, we forgot to remove some lines from the React-Fabric dependencies. This broke pod install and we have a red ci since then.

bypass-github-export-checks

## Changelog:

[iOS][Fixed] - fix React-Fabric dependencies

Pull Request resolved: https://github.com/facebook/react-native/pull/37652

Test Plan: CircleCI is green

Reviewed By: cipolleschi

Differential Revision: D46349504

Pulled By: sammy-SC

fbshipit-source-id: 8fc1bca7838a913adba702033d06dd02b93c31f9
2023-06-01 04:53:03 -07:00
Samuel Susla 88eef42cab Back out "Enable RuntimeScheduler in old architecture" (#37623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37623

Original commit changeset: 5f18cbe60e6c

Original Phabricator Diff: D46078324

changelog: [internal]

Resolves S344737

Reviewed By: FieryRobot

Differential Revision: D46281951

fbshipit-source-id: dae1f7afe549686e3d5bbacf786c088bbfa49cca
2023-05-30 13:00:07 -07:00
Riccardo Cipolleschi 680cbe757b Make RNTester use RCTAppDelegate (#37572)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37572

Currently, RNTester was using a completely custom AppDelegate and not leveraging the RCTAppDelegate we use in the OSS. This resulted in a misalignment between the two setups and duplicated work to test stuff internally furst and then in the OSS, with some more time needed to understand why one setup was working and the other wasn't.

With this change, we are aligning the two, bringing RNTester closer to the OSS setup. There are still small differences, but we can iterate over those.

## Changelog:
[iOS][Changed] - Make RNTester use RCTAppDelegate

Reviewed By: cortinico

Differential Revision: D46182888

fbshipit-source-id: 7c55b06de1a317b1f2d4ad0d18a390dc4d3356a4
2023-05-30 04:10:17 -07:00
Samuel Susla 7211ef1962 Enable RuntimeScheduler in old architecture (#37523)
Summary:
## Changelog:

[IOS] [FIXED] - unexpected useEffects flushing semantics

Pull Request resolved: https://github.com/facebook/react-native/pull/37523

Test Plan: Run RNTester with old architecture and make sure RuntimeScheduler is used.

Reviewed By: cipolleschi

Differential Revision: D46078324

Pulled By: sammy-SC

fbshipit-source-id: 5f18cbe60e6c9c753c373f175ba413b79288a928
2023-05-25 08:38:54 -07:00
Riccardo Cipolleschi bdeb09bada Re-enable iOS integration tests (#37571)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37571

During the RC.0 of 0.72, we disabled the iOS integration tests because they were not working with Metro and the new Monorepo setup.

This change tries to re-enable them so we can be more protected in CI

## Changelog:
[internal] - Re-enable integration tests

Reviewed By: cortinico

Differential Revision: D46178840

fbshipit-source-id: a5239fa7067b8fb68d997dd0cc63b67fb54d2d7e
2023-05-25 06:28:29 -07:00
Riccardo Cipolleschi ce116b653b Add support to register New Renderer components from the AppDelegate. (#37273)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37273

When using dynamic frameworks, we can't rely on Codegen to register all the components into the renderer. That's because, we would have to codegen a new target, which depends on ALL the 3rd party dependencies that expose a UI component.

The previous PR adds support for distributed automatic registration when components are loaded in memory.

However, not to slow down the adoption of the New Architecture, there could be apps that need to register a component that does not support the distributed approach yet. Thanks to this method, apps can register those components.

## Changelog:
[iOS][Added] - Added a mechanism to register components into the renderer from the user app.

Reviewed By: dmytrorykun

Differential Revision: D45605688

fbshipit-source-id: 3583913f2700be4d6cb33a862429486aca675acf
2023-05-15 08:14:59 -07:00
Pieter De Baets b3478cb96d Unbreak RNTester build (#37128)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37128

CircleCI signal was missed in D45310066

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D45355691

fbshipit-source-id: 152daf51d0a15733e47bba1df575e3d60f621cb0
2023-04-27 08:07:48 -07:00
Pieter De Baets ec1ab73674 Avoid retaining TurboModuleManager in AppDelegate (#37104)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37104

The AppDelegate (and other similar classes) only need to construct the TurboModuleManager for intialization purposes, and should not retain it beyond that. TurboModuleManager retains each of the TurboModule instances and through the new binding mechanism, also JSI pointers, which are invalid beyond the lifetime of the JS context.

Changelog: [iOS] Changed AppDelegate template to avoid retaining TurboModuleManager.

Reviewed By: sammy-SC, cipolleschi

Differential Revision: D45310066

fbshipit-source-id: 4199c9973d832cc07fd32b94f2dcbaa72f4d3920
2023-04-27 04:14:29 -07:00
Phillip Pan 2fe14df09a properly format pragma marks
Summary:
Changelog: [Internal]

so ANNOYING

Reviewed By: christophpurrer, sammy-SC

Differential Revision: D45022199

fbshipit-source-id: 367a9b652987e1590a966928870de1ba61a4bad3
2023-04-20 16:26:38 -07:00
Riccardo Cipolleschi a881269503 Fix RNTester in main (#36686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36686

After the recent changes of Metro and Metro-Config, we need to update the path used to load the bundle in RNTester

## Changelog:
[General][Fixed] - Use the right path to load RNTester bundle

Reviewed By: cortinico

Differential Revision: D44465418

fbshipit-source-id: 96170194579792f9a5d8a141328d43e45a4db973
2023-03-28 10:49:30 -07:00
Alex Hunt 32e836dd8b Fix paths in objc-test.sh, temporarily exclude /IntegrationTests (#36648)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36648

Changelog: [Internal]

Blocker for https://github.com/facebook/react-native/pull/36623. The `test-ios` job in CI was misconfigured following the monorepo migration — and this becomes load-bearing with the incoming version of React Native CLI.

- Update `objc-test.sh` to run in `packages/rn-tester`, and exclude tests under `/IntegrationTests` which are outside of a Metro project directory.
    - **This is temporary** — a task has been created to move/split up/otherwise restore tests in `IntegrationTests`, which cipolleschi is following up (thanks!).
- Also fix `yarn start` script in `packages/rn-tester`.

Reviewed By: cipolleschi

Differential Revision: D44416533

fbshipit-source-id: 59c5b743d9d8fda206a12e37d94324ed9bfd703e
2023-03-27 11:21:56 -07:00