Skip to content

Commit bc4b505

Browse files
committed
Followup changes
1 parent 24d0ddf commit bc4b505

Some content is hidden

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

53 files changed

+332
-262
lines changed

.ado/publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ variables:
1717
- group: InfoSec-SecurityResults
1818
- name: tags
1919
value: production,externalfacing
20-
# CodeQL Still has not fixed their bug running on Apple ARM64 jobs where they inject x64 binaries into arm64 processes and just make it crash :(
21-
# Only workaround for now is to disable CodeQL on Apple jobs.
22-
- name Codeql.Enabled
20+
# CodeQL Still has not fixed their bug running on Apple ARM64 jobs where they inject x64 binaries into arm64 processes and just make it crash :(
21+
# Only workaround for now is to disable CodeQL on Apple jobs.
22+
- name: Codeql.Enabled
2323
value: false
2424
- template: /.ado/variables/vars.yml@self
2525

Gemfile.lock

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ PLATFORMS
9595
DEPENDENCIES
9696
activesupport (>= 6.1.7.5, < 7.1.0)
9797
cocoapods (~> 1.13, != 1.15.1, != 1.15.0)
98+
concurrent-ruby (< 1.3.4)
99+
xcodeproj (< 1.26.0)
98100

99101
RUBY VERSION
100102
ruby 3.3.0p0

packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ NS_ASSUME_NONNULL_BEGIN
124124

125125
@end
126126

127-
NS_ASSUME_NONNULL_END
127+
NS_ASSUME_NONNULL_END

packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled)
4949
id<RCTSurfaceProtocol> surface = [[RCTFabricSurface alloc] initWithBridge:bridge
5050
moduleName:moduleName
5151
initialProperties:initialProperties];
52-
UIView *rootView = [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
52+
RCTUIView *rootView = [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface]; // [macOS]
5353
[surface start];
5454
return rootView;
5555
}

packages/react-native/Libraries/AppDelegate/RCTArchConfiguratorProtocol.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#import <React/RCTConvert.h>
9-
#import <UIKit/UIKit.h>
9+
#import <React/RCTUIKit.h>
1010

1111
@protocol RCTArchConfiguratorProtocol
1212
/// This method controls whether the `turboModules` feature of the New Architecture is turned on or off.

packages/react-native/Libraries/AppDelegate/RCTUIConfiguratorProtocol.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#import <React/RCTConvert.h>
9-
#import <UIKit/UIKit.h>
9+
#import <React/RCTUIKit.h>
1010

1111
@class RCTRootView;
1212

@@ -52,5 +52,5 @@
5252
* If you are not using a simple UIViewController, then there could be other methods to use to setup the rootView.
5353
* For example: UISplitViewController requires `setViewController(_:for:)`
5454
*/
55-
- (void)setRootView:(UIView *)rootView toRootViewController:(UIViewController *)rootViewController;
55+
- (void)setRootView:(RCTPlatformView *)rootView toRootViewController:(RCTPlatformViewController *)rootViewController; // [macOS]
5656
@end

packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ const AccessibilityInfo = {
135135
});
136136
} else {
137137
return new Promise((resolve, reject) => {
138-
if (NativeAccessibilityManagerIOS != null) {
139-
NativeAccessibilityManagerIOS.getCurrentGrayscaleState(
138+
if (NativeAccessibilityManagerApple != null) {
139+
NativeAccessibilityManagerApple.getCurrentGrayscaleState(
140140
resolve,
141141
reject,
142142
);
@@ -188,8 +188,8 @@ const AccessibilityInfo = {
188188
});
189189
} else {
190190
return new Promise((resolve, reject) => {
191-
if (NativeAccessibilityManagerIOS != null) {
192-
NativeAccessibilityManagerIOS.getCurrentInvertColorsState(
191+
if (NativeAccessibilityManagerApple != null) {
192+
NativeAccessibilityManagerApple.getCurrentInvertColorsState(
193193
resolve,
194194
reject,
195195
);
@@ -261,10 +261,10 @@ const AccessibilityInfo = {
261261
return Promise.resolve(false);
262262
} else {
263263
if (
264-
NativeAccessibilityManagerIOS?.getCurrentDarkerSystemColorsState !=
264+
NativeAccessibilityManagerApple?.getCurrentDarkerSystemColorsState !=
265265
null
266266
) {
267-
NativeAccessibilityManagerIOS.getCurrentDarkerSystemColorsState(
267+
NativeAccessibilityManagerApple.getCurrentDarkerSystemColorsState(
268268
resolve,
269269
reject,
270270
);
@@ -530,4 +530,4 @@ const AccessibilityInfo = {
530530
},
531531
};
532532

533-
export default AccessibilityInfo;
533+
export default AccessibilityInfo;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,4 @@ const RCTTextInputViewConfig = {
191191
},
192192
};
193193

194-
module.exports = (RCTTextInputViewConfig: PartialViewConfigWithoutName);
194+
module.exports = (RCTTextInputViewConfig: PartialViewConfigWithoutName);

packages/react-native/Libraries/Components/Touchable/TouchableBounce.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,4 @@ module.exports = (React.forwardRef((props, hostRef) => (
239239
)): component(
240240
ref: React.RefSetter<mixed>,
241241
...props: $ReadOnly<$Diff<Props, {|hostRef: mixed|}>>
242-
));
242+
));

packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,4 @@ const Touchable: component(
362362

363363
Touchable.displayName = 'TouchableOpacity';
364364

365-
module.exports = Touchable;
365+
module.exports = Touchable;

packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import type {
2020
BlurEvent,
2121
FocusEvent,
2222
LayoutEvent,
23-
MouseEvent, // [macOS]
23+
// [macOS]
24+
MouseEvent,
2425
PressEvent,
2526
} from '../../Types/CoreEventTypes';
2627
// [macOS

packages/react-native/Libraries/Image/Image.ios.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,4 @@ const styles = StyleSheet.create({
251251
},
252252
});
253253

254-
module.exports = Image;
254+
module.exports = Image;

packages/react-native/Libraries/Lists/SectionListModern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,4 @@ const SectionList: component(
246246
);
247247
});
248248

249-
export default SectionList;
249+
export default SectionList;

packages/react-native/Libraries/Utilities/LoadingView.macos.js

-15
This file was deleted.

packages/react-native/Libraries/Utilities/Platform.flow.js

+39-1
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,42 @@ type AndroidPlatform = {
8888
select: <T>(spec: PlatformSelectSpec<T>) => T,
8989
};
9090

91-
export type Platform = IOSPlatform | AndroidPlatform;
91+
// [macOS
92+
type MacOSPlatform = {
93+
__constants: null,
94+
OS: 'macos',
95+
// $FlowFixMe[unsafe-getters-setters]
96+
get Version(): string,
97+
// $FlowFixMe[unsafe-getters-setters]
98+
get constants(): {|
99+
forceTouchAvailable: boolean,
100+
interfaceIdiom: string,
101+
isTesting: boolean,
102+
isDisableAnimations?: boolean,
103+
osVersion: string,
104+
reactNativeVersion: {|
105+
major: number,
106+
minor: number,
107+
patch: number,
108+
prerelease: ?number,
109+
|},
110+
systemName: string,
111+
isMacCatalyst?: boolean,
112+
|},
113+
// $FlowFixMe[unsafe-getters-setters]
114+
get isPad(): boolean,
115+
// $FlowFixMe[unsafe-getters-setters]
116+
get isTV(): boolean,
117+
// $FlowFixMe[unsafe-getters-setters]
118+
get isVision(): boolean,
119+
// $FlowFixMe[unsafe-getters-setters]
120+
get isTesting(): boolean,
121+
// $FlowFixMe[unsafe-getters-setters]
122+
get isDisableAnimations(): boolean,
123+
// $FlowFixMe[unsafe-getters-setters]
124+
get isMacCatalyst(): boolean,
125+
select: <T>(spec: PlatformSelectSpec<T>) => T,
126+
};
127+
// macOS]
128+
129+
export type Platform = IOSPlatform | AndroidPlatform | MacOSPlatform; // [macOS]

packages/react-native/Libraries/Utilities/Platform.macos.js

+30-18
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@
1010

1111
// [macOS]
1212

13-
import NativePlatformConstantsMacOS from './NativePlatformConstantsMacOS';
13+
import type {
14+
Platform as PlatformType,
15+
PlatformSelectSpec,
16+
} from './Platform.flow';
1417

15-
export type PlatformSelectSpec<T> = {
16-
default?: T,
17-
native?: T,
18-
macos?: T,
19-
...
20-
};
18+
import NativePlatformConstantsMacOS from './NativePlatformConstantsMacOS';
2119

22-
const Platform = {
20+
const Platform: PlatformType = {
2321
__constants: null,
2422
OS: 'macos',
2523
// $FlowFixMe[unsafe-getters-setters]
@@ -29,7 +27,10 @@ const Platform = {
2927
},
3028
// $FlowFixMe[unsafe-getters-setters]
3129
get constants(): {|
30+
forceTouchAvailable: boolean,
31+
interfaceIdiom: string,
3232
isTesting: boolean,
33+
isDisableAnimations?: boolean,
3334
osVersion: string,
3435
reactNativeVersion: {|
3536
major: number,
@@ -38,6 +39,7 @@ const Platform = {
3839
prerelease: ?number,
3940
|},
4041
systemName: string,
42+
isMacCatalyst?: boolean,
4143
|} {
4244
// $FlowFixMe[object-this-reference]
4345
if (this.__constants == null) {
@@ -48,12 +50,19 @@ const Platform = {
4850
return this.__constants;
4951
},
5052
// $FlowFixMe[unsafe-getters-setters]
53+
get isPad(): boolean {
54+
// $FlowFixMe[object-this-reference]
55+
return this.constants.interfaceIdiom === 'pad';
56+
},
57+
// $FlowFixMe[unsafe-getters-setters]
5158
get isTV(): boolean {
52-
return false;
59+
// $FlowFixMe[object-this-reference]
60+
return this.constants.interfaceIdiom === 'tv';
5361
},
5462
// $FlowFixMe[unsafe-getters-setters]
5563
get isVision(): boolean {
56-
return false;
64+
// $FlowFixMe[object-this-reference]
65+
return this.constants.interfaceIdiom === 'vision';
5766
},
5867
// $FlowFixMe[unsafe-getters-setters]
5968
get isTesting(): boolean {
@@ -63,16 +72,19 @@ const Platform = {
6372
}
6473
return false;
6574
},
75+
// $FlowFixMe[unsafe-getters-setters]
76+
get isDisableAnimations(): boolean {
77+
// $FlowFixMe[object-this-reference]
78+
return this.constants.isDisableAnimations ?? this.isTesting;
79+
},
80+
// $FlowFixMe[unsafe-getters-setters]
81+
get isMacCatalyst(): boolean {
82+
// $FlowFixMe[object-this-reference]
83+
return this.constants.isMacCatalyst ?? false;
84+
},
6685
select: <T>(spec: PlatformSelectSpec<T>): T =>
6786
// $FlowFixMe[incompatible-return]
68-
'macos' in spec
69-
? // $FlowFixMe[incompatible-return]
70-
spec.macos
71-
: 'native' in spec
72-
? // $FlowFixMe[incompatible-return]
73-
spec.native
74-
: // $FlowFixMe[incompatible-return]
75-
spec.default,
87+
'ios' in spec ? spec.macos : 'native' in spec ? spec.native : spec.default,
7688
};
7789

7890
module.exports = Platform;

packages/react-native/React/Base/RCTUIKit.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ UIKIT_STATIC_INLINE CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path)
6464
#define RCTPlatformView UIView
6565
#define RCTUIView UIView
6666
#define RCTUIScrollView UIScrollView
67-
#define RCTPlatformWindow UIWindow
6867

6968
UIKIT_STATIC_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *__nullable event)
7069
{
@@ -218,6 +217,7 @@ typedef NS_ENUM(NSInteger, UIViewContentMode) {
218217
UIViewContentModeScaleAspectFit = NSViewLayerContentsPlacementScaleProportionallyToFit,
219218
UIViewContentModeScaleToFill = NSViewLayerContentsPlacementScaleAxesIndependently,
220219
UIViewContentModeCenter = NSViewLayerContentsPlacementCenter,
220+
UIViewContentModeTopLeft = NSViewLayerContentsPlacementTopLeft,
221221
};
222222

223223
// UIInterface.h/NSUserInterfaceLayout.h
@@ -378,8 +378,6 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
378378
// UIView
379379
#define RCTPlatformView NSView
380380

381-
#define RCTPlatformWindow NSWindow
382-
383381
@interface RCTUIView : RCTPlatformView
384382

385383
@property (nonatomic, readonly) BOOL canBecomeFirstResponder;
@@ -410,7 +408,7 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
410408
- (void)sendMouseEventWithBlock:(RCTDirectEventBlock)block
411409
locationInfo:(NSDictionary*)locationInfo
412410
modifierFlags:(NSEventModifierFlags)modifierFlags
413-
additionalData:(NSDictionary*)additionalData;
411+
additionalData:(NSDictionary* __nullable)additionalData;
414412

415413
// FUTURE: When Xcode 14 is no longer supported (CI is building with Xcode 15), we can remove this override since it's now declared on NSView
416414
@property BOOL clipsToBounds;
@@ -524,12 +522,12 @@ NS_ASSUME_NONNULL_END
524522

525523
#if !TARGET_OS_OSX
526524
typedef UIApplication RCTUIApplication;
527-
typedef UIWindow RCTUIWindow;
528-
typedef UIViewController RCTUIViewController;
525+
typedef UIWindow RCTPlatformWindow;
526+
typedef UIViewController RCTPlatformViewController;
529527
#else
530528
typedef NSApplication RCTUIApplication;
531-
typedef NSWindow RCTUIWindow;
532-
typedef NSViewController RCTUIViewController;
529+
typedef NSWindow RCTPlatformWindow;
530+
typedef NSViewController RCTPlatformViewController;
533531
#endif
534532

535533
//
@@ -660,6 +658,7 @@ typedef void (^RCTUIGraphicsImageDrawingActions)(RCTUIGraphicsImageRendererConte
660658

661659
@interface RCTUIGraphicsImageRenderer : NSObject
662660

661+
- (instancetype)initWithSize:(CGSize)size;
663662
- (instancetype)initWithSize:(CGSize)size format:(RCTUIGraphicsImageRendererFormat *)format;
664663
- (NSImage *)imageWithActions:(NS_NOESCAPE RCTUIGraphicsImageDrawingActions)actions;
665664

packages/react-native/React/Base/RCTUtils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ RCT_EXTERN RCTUIApplication *__nullable RCTSharedApplication(void); // [macOS]
9595

9696
// Returns the current main window, useful if you need to access the root view
9797
// or view controller
98-
RCT_EXTERN RCTUIWindow *__nullable RCTKeyWindow(void); // [macOS]
98+
RCT_EXTERN RCTPlatformWindow *__nullable RCTKeyWindow(void); // [macOS]
9999

100100
#if !TARGET_OS_OSX // [macOS]
101101
// Returns UIStatusBarManager to get it's configuration info.
@@ -109,10 +109,10 @@ RCT_EXTERN UIViewController *__nullable RCTPresentedViewController(void);
109109

110110
// Retrieve current window UIStatusBarManager
111111
RCT_EXTERN UIStatusBarManager *__nullable RCTUIStatusBarManager(void) API_AVAILABLE(ios(13));
112+
#endif // [macOS]
112113

113114
// Does this device support force touch (aka 3D Touch)?
114115
RCT_EXTERN BOOL RCTForceTouchAvailable(void);
115-
#endif // [macOS]
116116

117117
// Create an NSError in the RCTErrorDomain
118118
RCT_EXTERN NSError *RCTErrorWithMessage(NSString *message);

0 commit comments

Comments
 (0)