Skip to content

Commit f8e3166

Browse files
authored
Merge pull request microsoft#7 from amgleitman/amgleitman/fb66merge-macos-compile
Get RNTester compiling for macOS
2 parents b9ac73d + e3abc80 commit f8e3166

20 files changed

Lines changed: 246 additions & 137 deletions

File tree

Libraries/PushNotificationIOS/RCTPushNotificationManager.mm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
#import <React/RCTPushNotificationManager.h>
99

10-
#if !TARGET_OS_OSX // TODO(macOS GH#774)
1110
#import <UserNotifications/UserNotifications.h>
12-
#endif // TODO(macOS GH#774)
1311

1412
#import <FBReactNativeSpec/FBReactNativeSpec.h>
1513
#import <React/RCTBridge.h>

Libraries/Text/TextInput/Multiline/RCTUITextView.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ - (void)_updatePlaceholder
505505
}
506506

507507
#pragma mark - Caret Manipulation
508+
#if !TARGET_OS_OSX // TODO(macOS GH#774)
508509

509510
- (CGRect)caretRectForPosition:(UITextPosition *)position
510511
{
@@ -514,6 +515,7 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position
514515

515516
return [super caretRectForPosition:position];
516517
}
518+
#endif
517519

518520
#pragma mark - Utility Methods
519521

React/Base/RCTBridgeModule.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#import <Foundation/Foundation.h>
9-
#import <UIKit/UIKit.h>
9+
#import <React/RCTUIKit.h> // TODO(macOS GH#774)
1010

1111
#import <React/RCTDefines.h>
1212

@@ -444,7 +444,7 @@ typedef NSURL * (^RCTBridgelessBundleURLGetter)(void);
444444
@property NSURL *bundleURL;
445445
@end
446446

447-
typedef UIView * (^RCTBridgelessComponentViewProvider)(NSNumber *);
447+
typedef RCTPlatformView * (^RCTBridgelessComponentViewProvider)(NSNumber *); // TODO(macOS GH#774)
448448

449449
/**
450450
* A class that allows NativeModules to query for views, given React Tags.
@@ -453,7 +453,7 @@ typedef UIView * (^RCTBridgelessComponentViewProvider)(NSNumber *);
453453
- (void)setBridge:(RCTBridge *)bridge;
454454
- (void)setBridgelessComponentViewProvider:(RCTBridgelessComponentViewProvider)bridgelessComponentViewProvider;
455455

456-
- (UIView *)viewForReactTag:(NSNumber *)reactTag;
456+
- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag; // TODO(macOS GH#774)
457457
@end
458458

459459
typedef void (^RCTBridgelessJSModuleMethodInvoker)(

React/Base/RCTConvert.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750)
10001000
if ((value = [dictionary objectForKey:@"semantic"])) {
10011001
if ([value isKindOfClass:[NSString class]]) {
10021002
NSString *semanticName = value;
1003-
RCTUIColor *color = [UIColor colorNamed:semanticName]; // TODO(macOS GH#750)
1003+
RCTUIColor *color = [RCTUIColor colorNamed:semanticName]; // TODO(macOS GH#750)
10041004
if (color != nil) {
10051005
return color;
10061006
}
@@ -1013,7 +1013,7 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750)
10131013
return color;
10141014
} else if ([value isKindOfClass:[NSArray class]]) {
10151015
for (id name in value) {
1016-
RCTUIColor *color = [UIColor colorNamed:name]; // TODO(macOS GH#750)
1016+
RCTUIColor *color = [RCTUIColor colorNamed:name]; // TODO(macOS GH#750)
10171017
if (color != nil) {
10181018
return color;
10191019
}

React/Base/RCTUIKit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ UIKIT_STATIC_INLINE CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path)
6363
#define RCTUIView UIView // TODO(macOS ISS#3536887)
6464
#define RCTUIScrollView UIScrollView // TODO(macOS ISS#3536887)
6565

66+
#define RCTPlatformWindow UIWindow
67+
6668
UIKIT_STATIC_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, UIEvent *event)
6769
{
6870
return [view hitTest:point withEvent:event];
@@ -361,6 +363,8 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
361363
// UIView
362364
#define RCTPlatformView NSView
363365

366+
#define RCTPlatformWindow NSWindow
367+
364368
@interface RCTUIView : NSView // TODO(macOS ISS#3536887)
365369

366370
@property (nonatomic, readonly) BOOL canBecomeFirstResponder;

React/Base/RCTViewRegistry.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ - (void)setBridgelessComponentViewProvider:(RCTBridgelessComponentViewProvider)b
2626
_bridgelessComponentViewProvider = bridgelessComponentViewProvider;
2727
}
2828

29-
- (UIView *)viewForReactTag:(NSNumber *)reactTag
29+
- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag // TODO(macOS GH#774)
3030
{
31-
UIView *view = nil;
31+
RCTPlatformView *view = nil; // TODO(macOS GH#774)
3232

3333
RCTBridge *bridge = _bridge;
3434
if (bridge) {

React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ - (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
6262
[self _updateViews];
6363

6464
// For backward compatibility with RCTRootView, set a color here instead of transparent (OS default).
65-
self.backgroundColor = [UIColor whiteColor];
65+
self.backgroundColor = [RCTUIColor whiteColor];
6666
}
6767

6868
return self;

React/CoreModules/RCTAlertController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
1717
- (void)show:(BOOL)animated completion:(void (^)(void))completion;
18-
#endif // ]TODO(macOS GH#774)
1918
- (void)hide;
19+
#endif // ]TODO(macOS GH#774)
2020

2121
@end

React/CoreModules/RCTAlertController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ - (void)show:(BOOL)animated completion:(void (^)(void))completion
3535
[self.alertWindow makeKeyAndVisible];
3636
[self.alertWindow.rootViewController presentViewController:self animated:animated completion:completion];
3737
}
38-
#endif // ]TODO(macOS GH#774)
3938

4039
- (void)hide
4140
{
4241
_alertWindow = nil;
4342
}
43+
#endif // ]TODO(macOS GH#774)
4444

4545
@end

React/CoreModules/RCTDevMenu.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ - (void)invalidate
190190
- (void)showOnShake
191191
{
192192
if ([((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]) isShakeToShowDevMenuEnabled]) {
193-
for (UIWindow *window in [RCTSharedApplication() windows]) {
193+
for (RCTPlatformWindow *window in [RCTSharedApplication() windows]) {
194194
NSString *recursiveDescription = [window valueForKey:@"recursiveDescription"];
195195
if ([recursiveDescription containsString:@"RCTView"]) {
196196
[self show];

0 commit comments

Comments
 (0)