Skip to content

Commit d3a6e53

Browse files
committed
formatting
1 parent 8fb86d4 commit d3a6e53

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,20 @@
2525
#import <React/RCTComponentViewProtocol.h>
2626
#import <React/RCTFabricSurface.h>
2727
#import <React/RCTSurfaceHostingProxyRootView.h>
28-
#import <React/RCTSurfaceHostingView+Private.h> // [macOS]
2928
#import <React/RCTSurfacePresenter.h>
3029

31-
#if TARGET_OS_OSX && __has_include("RCTDevMenu.h") // [macOS]
32-
#import "RCTDevMenu.h"
33-
#endif // [macOS]
3430
#import <ReactCommon/RCTHost+Internal.h>
3531
#import <ReactCommon/RCTHost.h>
3632
#import <ReactCommon/RCTTurboModuleManager.h>
3733
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
3834
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
3935
#import <react/runtime/JSRuntimeFactory.h>
40-
#import <react/utils/ManagedObjectWrapper.h>
4136

42-
using namespace facebook::react;
37+
#if TARGET_OS_OSX && __has_include("RCTDevMenu.h") // [macOS
38+
#import <React/RCTSurfaceHostingView+Private.h>
39+
#import <react/utils/ManagedObjectWrapper.h>
40+
#import "RCTDevMenu.h"
41+
#endif // macOS]
4342

4443
@implementation RCTRootViewFactoryConfiguration
4544

@@ -160,15 +159,13 @@ - (RCTPlatformView *)viewWithModuleName:(NSString *)moduleName // [macOS]
160159
surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor];
161160
#endif // [macOS]
162161

163-
[surfaceHostingProxyRootView setContextContainer:_contextContainer]; // [macOS]
164-
165162
#if TARGET_OS_OSX && __has_include("RCTDevMenu.h") && RCT_DEV
166-
// Insert dev menu for macOS context menu access in bridgeless mode
167163
RCTDevMenu *devMenu = [self.reactHost.moduleRegistry moduleForClass:[RCTDevMenu class]];
168164
if (devMenu) {
169165
_contextContainer->erase("RCTDevMenu");
170166
_contextContainer->insert("RCTDevMenu", wrapManagedObject(devMenu));
171167
}
168+
[surfaceHostingProxyRootView setContextContainer:_contextContainer]; // [macOS]
172169
#endif
173170

174171
if (_configuration.customizeRootView != nil) {
@@ -207,11 +204,12 @@ - (RCTPlatformView *)createRootViewWithBridge:(RCTBridge *)bridge
207204
rootView.backgroundColor = [UIColor systemBackgroundColor];
208205
#endif // [macOS]
209206

210-
// Set context container if this is a Fabric-enabled RCTSurfaceHostingView (or subclass)
207+
#if TARGET_OS_OSX // [macOS
211208
if (enableFabric && [rootView isKindOfClass:[RCTSurfaceHostingView class]]) {
212209
[(RCTSurfaceHostingView *)rootView setContextContainer:_contextContainer];
213210
}
214-
211+
#endif // macOS]
212+
215213
return rootView;
216214
}
217215

@@ -363,4 +361,4 @@ - (NSURL *)bundleURL
363361
return self->_configuration.bundleURLBlock();
364362
}
365363

366-
@end
364+
@end

packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#import <React/RCTSurfaceProtocol.h>
1212
#import <React/RCTSurfaceSizeMeasureMode.h>
1313
#import <React/RCTSurfaceStage.h>
14-
// #import <react/utils/ContextContainer.h> // [macOS]
1514

1615
@class RCTBridge;
1716
@class RCTSurface;

packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414
#import "RCTSurfaceView.h"
1515
#import "RCTUtils.h"
1616

17-
#if TARGET_OS_OSX && __has_include("RCTDevMenu.h") // [macOS]
17+
#if TARGET_OS_OSX && __has_include("RCTDevMenu.h") // [macOS
1818
#import "RCTDevMenu.h"
1919
#import "RCTBridgeProxy.h"
2020
#import <react/utils/ManagedObjectWrapper.h>
21-
22-
using namespace facebook::react;
23-
#endif // [macOS]
21+
#endif // macOS]
2422

2523
@interface RCTSurfaceHostingView ()
2624

@@ -145,7 +143,7 @@ - (void)setSizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
145143
[self _invalidateLayout];
146144
}
147145

148-
// [macOS
146+
#if TARGET_OS_OSX // [macOS
149147
- (facebook::react::ContextContainer::Shared)contextContainer
150148
{
151149
return _contextContainer;
@@ -155,7 +153,7 @@ - (void)setContextContainer:(facebook::react::ContextContainer::Shared)contextCo
155153
{
156154
_contextContainer = contextContainer;
157155
}
158-
// macOS]
156+
#endif // macOS]
159157

160158
- (void)disableActivityIndicatorAutoHide:(BOOL)disabled
161159
{
@@ -301,9 +299,10 @@ - (void)surface:(__unused RCTSurface *)surface didChangeIntrinsicSize:(__unused
301299
});
302300
}
303301

302+
#if TARGET_OS_OSX // [macOS]
303+
304304
#pragma mark - Context Menu
305305

306-
#if TARGET_OS_OSX // [macOS]
307306
- (NSMenu *)menuForEvent:(NSEvent *)event
308307
{
309308
NSMenu *menu = nil;

0 commit comments

Comments
 (0)