Files
react-native/private
Dawid Malecki 29d5aa582f iOS: Add new configuration for RCTDevMenu (#53505)
Summary:
Following the [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/925), this PR adds new `RCTDevMenu` configuration  and extends `RCTReactNativeFactory` API for passing it to the particular `RCTHost`.  The `RCTDevMenuConfiguration` includes:

- isDevMenuEnabled,
- isShakeGestureEnabled,
- areKeyboardShortcutsEnabled

## Changelog:

[IOS][ADDED] - Add new configuration for `RCTDevMenu`

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Test Plan:
Tested with different configurations on `RCTDevMenuConfiguration`:

<details>
<summary>Click to view code</summary>

```objc
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:self];
#if USE_OSS_CODEGEN
  self.dependencyProvider = [RCTAppDependencyProvider new];
#endif

  RCTDevMenuConfiguration *devMenuConfiguration = [[RCTDevMenuConfiguration alloc] initWithDevMenuEnabled:true shakeGestureEnabled:false keyboardShortcutsEnabled:false];

  [self.reactNativeFactory setDevMenuConfiguration:devMenuConfiguration];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

  [self.reactNativeFactory startReactNativeWithModuleName:@"RNTesterApp"
                                                 inWindow:self.window
                                        initialProperties:[self prepareInitialProps]
                                            launchOptions:launchOptions];

  [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];

  return YES;
}
```

</details>

Run helloworld:

<img src="https://github.com/user-attachments/assets/16c35176-6fbe-498c-96fd-a0fe988a5e3c" alt="hello-world-screenshot" width="300">

Reviewed By: cipolleschi

Differential Revision: D81684275

Pulled By: coado

fbshipit-source-id: 500e170c93df25949de433970442d20c442be7f2
2025-10-01 02:42:54 -07:00
..