Skip to content

Commit 0f5a2d1

Browse files
authored
Merge branch 'react:main' into chore/retyui/listeners
2 parents 15adc35 + af3a651 commit 0f5a2d1

42 files changed

Lines changed: 907 additions & 366 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.

.flowconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ module.system.haste.module_ref_prefix=m#
6464

6565
react.runtime=automatic
6666

67-
experimental.deprecated_utilities.excludes=<PROJECT_ROOT>/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js
68-
experimental.deprecated_utilities.excludes=<PROJECT_ROOT>/packages/react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js
69-
experimental.deprecated_colon_extends.excludes=<PROJECT_ROOT>/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js
70-
experimental.deprecated_variance_sigils.excludes=<PROJECT_ROOT>/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js
71-
7267
ban_spread_key_props=true
7368

7469
[lints]

packages/debugger-shell/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"fb-dotslash": "0.5.8"
4747
},
4848
"devDependencies": {
49-
"electron": "39.8.10",
49+
"electron": "43.0.0",
5050
"semver": "^7.1.3"
5151
},
5252
"files": [
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
*/
10+
11+
const {BrowserWindow, Menu, app, nativeImage, shell} =
12+
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
13+
require('electron') as any;
14+
15+
const {isMacOSAtLeast} = require('./utils');
16+
17+
export function configureAppMenu(): void {
18+
const template = [
19+
...(process.platform === 'darwin' ? [{role: 'appMenu'}] : []),
20+
{
21+
label: 'File',
22+
submenu: [
23+
{
24+
label: 'Reload App',
25+
accelerator:
26+
process.platform === 'darwin' ? 'Command+R' : 'Control+R',
27+
click: () => invokeCommand('inspector-main.reload'),
28+
},
29+
{
30+
label: 'Reload DevTools',
31+
accelerator: process.platform === 'darwin' ? 'Option+R' : 'Alt+R',
32+
click: () => BrowserWindow.getFocusedWindow()?.webContents.reload(),
33+
},
34+
{type: 'separator'},
35+
{
36+
label: 'Quick Open…',
37+
...menuSymbol('doc.text.magnifyingglass'),
38+
accelerator:
39+
process.platform === 'darwin' ? 'Command+P' : 'Control+P',
40+
click: () => invokeCommand('quick-open.show'),
41+
},
42+
{type: 'separator'},
43+
{role: 'close'},
44+
],
45+
},
46+
{
47+
label: 'Edit',
48+
submenu: [
49+
{role: 'undo'},
50+
{role: 'redo'},
51+
{type: 'separator'},
52+
{role: 'cut'},
53+
{role: 'copy'},
54+
{role: 'paste'},
55+
{role: 'selectAll'},
56+
],
57+
},
58+
{
59+
label: 'View',
60+
submenu: [
61+
{
62+
label: 'Command Palette…',
63+
...menuSymbol('filemenu.and.selection'),
64+
accelerator:
65+
process.platform === 'darwin'
66+
? 'Command+Shift+P'
67+
: 'Control+Shift+P',
68+
click: () => invokeCommand('quick-open.show-command-menu'),
69+
},
70+
// Enable Developer Tools only in development
71+
...(!app.isPackaged
72+
? [{type: 'separator'}, {role: 'toggleDevTools'}]
73+
: []),
74+
{type: 'separator'},
75+
{role: 'resetZoom'},
76+
{role: 'zoomIn'},
77+
{role: 'zoomOut'},
78+
{type: 'separator'},
79+
{role: 'togglefullscreen'},
80+
],
81+
},
82+
{role: 'windowMenu'},
83+
{
84+
role: 'help',
85+
submenu: [
86+
{
87+
label: 'Keyboard Shortcuts',
88+
...menuSymbol('keyboard'),
89+
click: () => invokeCommand('settings.shortcuts'),
90+
},
91+
{type: 'separator'},
92+
{
93+
label: 'React Native Website',
94+
click: () => shell.openExternal('https://reactnative.dev'),
95+
},
96+
{
97+
label: 'Release Notes',
98+
click: () =>
99+
shell.openExternal(
100+
'https://github.com/facebook/react-native/releases',
101+
),
102+
},
103+
],
104+
},
105+
];
106+
const menu = Menu.buildFromTemplate(template);
107+
Menu.setApplicationMenu(menu);
108+
}
109+
110+
function menuSymbol(symbolName: string): {icon?: unknown} {
111+
if (!isMacOSAtLeast(26)) {
112+
return {};
113+
}
114+
return {
115+
icon: nativeImage.createMenuSymbol(symbolName),
116+
};
117+
}
118+
119+
function invokeCommand(commandId: string): void {
120+
const win = BrowserWindow.getFocusedWindow();
121+
win?.webContents.executeJavaScript(
122+
`(async () => {
123+
const UI = await import('./ui/legacy/legacy.js');
124+
return UI.ActionRegistry.ActionRegistry.instance()
125+
.getAction(${JSON.stringify(commandId)})?.execute();
126+
})()`,
127+
true,
128+
);
129+
}

packages/debugger-shell/src/electron/MainInstanceEntryPoint.js

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
* @format
99
*/
1010

11+
import {configureAppMenu} from './AppMenu.js';
1112
import SettingsStore from './SettingsStore.js';
1213

1314
const path = require('path');
1415
const util = require('util');
1516

1617
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
17-
const {BrowserWindow, Menu, app, shell, ipcMain} = require('electron') as any;
18+
const {BrowserWindow, app, shell, ipcMain} = require('electron') as any;
1819

1920
const appSettings = new SettingsStore();
2021
const windowMetadata = new WeakMap<
@@ -102,34 +103,6 @@ function handleLaunchArgs(argv: string[]) {
102103
frontendWindow.focus();
103104
}
104105

105-
function configureAppMenu() {
106-
const template = [
107-
...(process.platform === 'darwin' ? [{role: 'appMenu'}] : []),
108-
{role: 'fileMenu'},
109-
{role: 'editMenu'},
110-
{role: 'viewMenu'},
111-
{role: 'windowMenu'},
112-
{
113-
role: 'help',
114-
submenu: [
115-
{
116-
label: 'React Native Website',
117-
click: () => shell.openExternal('https://reactnative.dev'),
118-
},
119-
{
120-
label: 'Release Notes',
121-
click: () =>
122-
shell.openExternal(
123-
'https://github.com/facebook/react-native/releases',
124-
),
125-
},
126-
],
127-
},
128-
];
129-
const menu = Menu.buildFromTemplate(template);
130-
Menu.setApplicationMenu(menu);
131-
}
132-
133106
function getSavedWindowPosition(
134107
windowKey: string,
135108
): ?{width: number, height: number, x?: number, y?: number} {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
*/
10+
11+
/** Equivalent of Swift's `if #available(macOS 26, *)`. */
12+
export function isMacOSAtLeast(major: number): boolean {
13+
return (
14+
process.platform === 'darwin' &&
15+
// $FlowFixMe[prop-missing]
16+
Number.parseInt(process.getSystemVersion().split('.')[0], 10) >= major
17+
);
18+
}

packages/react-native/Libraries/Components/TextInput/TextInput.flow.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,13 @@ export type TextInputAndroidProps = Readonly<{
506506
*/
507507
textBreakStrategy?: ?('simple' | 'highQuality' | 'balanced'),
508508

509+
/**
510+
* Align the input text to the top, center, or bottom of the field.
511+
* Defaults to `'auto'`.
512+
* @platform android
513+
*/
514+
textAlignVertical?: ?('auto' | 'top' | 'bottom' | 'center'),
515+
509516
/**
510517
* The color of the `TextInput` underline.
511518
* @platform android

packages/react-native/Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,13 @@ let reactRuntimeScheduler = RNTarget(
262262
dependencies: [.reactNativeDependencies, .reactFeatureFlags, .reactCxxReact, .reactPerfLogger, .reactPerformanceTimeline, .reactRendererConsistency, .reactUtils, .reactRuntimeExecutor]
263263
)
264264

265-
/// ReactCommon.podspec
266-
/// This target represent the ReactCommon/turbomodule/bridging subspec
265+
/// React-bridging.podspec
267266
let reactTurboModuleBridging = RNTarget(
268267
name: .reactTurboModuleBridging,
269268
path: "ReactCommon/react/bridging",
269+
searchPaths: [CallInvokerPath],
270270
excludedPaths: ["tests"],
271-
dependencies: [.reactNativeDependencies, .reactPerfLogger, .reactCxxReact, .jsi, .logger]
271+
dependencies: [.reactNativeDependencies, .jsi]
272272
)
273273

274274
/// React-jserrorhandler.podspec
@@ -904,7 +904,7 @@ extension String {
904904
static let reactRCTLinking = "React-RCTLinking"
905905
static let reactCoreModules = "React-CoreModules"
906906
static let reactRCTAnimatedModuleProvider = "RCTAnimatedModuleProvider"
907-
static let reactTurboModuleBridging = "ReactCommon/turbomodule/bridging"
907+
static let reactTurboModuleBridging = "React-bridging"
908908
static let reactTurboModuleCore = "ReactCommon/turbomodule/core"
909909
static let reactTurboModuleCoreDefaults = "ReactCommon/turbomodule/core/defaults"
910910
static let reactTurboModuleCoreMicrotasks = "ReactCommon/turbomodule/core/microtasks"

packages/react-native/React/React-RCTFBReactNativeSpec.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Pod::Spec.new do |s|
5454
s.dependency "React-NativeModulesApple"
5555

5656
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
57-
add_dependency(s, "ReactCommon", :subspec => "turbomodule/bridging", :additional_framework_paths => ["react/nativemodule/bridging"])
57+
s.dependency "React-bridging"
5858

5959
depend_on_js_engine(s)
6060
add_rn_third_party_dependencies(s)

0 commit comments

Comments
 (0)