Skip to content

Commit 150f935

Browse files
authored
Fix Fast Refresh in macos (#332)
* Update scripts to publish react-native-macos-init * Clean up merge markers * Restored ios:macos RNTester parity except for InputAccessoryView. * Revert "Restored ios:macos RNTester parity except for InputAccessoryView." This reverts commit 5a67ae0. * Fix Fast Refresh for mac.
1 parent 3bf2f87 commit 150f935

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

Libraries/Utilities/HMRClient.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ function registerBundleEntryPoints(client) {
281281

282282
function dismissRedbox() {
283283
if (
284-
Platform.OS === 'ios' &&
284+
(Platform.OS === 'ios' ||
285+
Platform.OS === 'macos') /* TODO(macOS ISS#2323203) */ &&
285286
NativeRedBox != null &&
286287
NativeRedBox.dismiss != null
287288
) {

React/Base/RCTConvert.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ typedef NSURL RCTFileURL;
101101
+ (CGAffineTransform)CGAffineTransform:(id)json;
102102

103103
+ (RCTUIColor *)UIColor:(id)json; // TODO(OSS Candidate ISS#2710739)
104+
+ (RCTUIColor *)NSColor:(id)json; // TODO(OSS Candidate ISS#2710739)
104105
+ (CGColorRef)CGColor:(id)json CF_RETURNS_NOT_RETAINED;
105106

106107
+ (YGValue)YGValue:(id)json;

React/Base/RCTConvert.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,11 @@ + (type)type:(id)json \
808808
}
809809
return names;
810810
}
811+
812+
+ (RCTUIColor *)NSColor:(id)json
813+
{
814+
return [RCTConvert UIColor:json];
815+
}
811816
// ]TODO(macOS ISS#2323203)
812817

813818
+ (RCTUIColor *)UIColor:(id)json // TODO(OSS Candidate ISS#2710739)

React/CxxBridge/RCTCxxBridge.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#import <React/RCTRedBox.h>
2727
#import <React/RCTUtils.h>
2828
#import <React/RCTFollyConvert.h>
29+
#import <React/RCTBundleURLProvider.h> // TODO(macOS ISS#2323203)
2930
#import <cxxreact/CxxNativeModule.h>
3031
#import <cxxreact/Instance.h>
3132
#import <cxxreact/JSBundleType.h>
@@ -929,7 +930,7 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
929930
BOOL isHotLoadingEnabled = devSettings.isHotLoadingEnabled;
930931
[self enqueueJSCall:@"HMRClient"
931932
method:@"setup"
932-
args:@[@"ios", path, host, RCTNullIfNil(port), @(isHotLoadingEnabled)]
933+
args:@[kRCTPlatformName, path, host, RCTNullIfNil(port), @(isHotLoadingEnabled)] // TODO(macOS ISS#2323203)
933934
completion:NULL];
934935
}
935936
#endif

React/DevSupport/RCTPackagerConnection.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ - (instancetype)init
8787
components.scheme = @"http";
8888
components.port = @(kRCTBundleURLProviderDefaultPort);
8989
components.path = @"/message";
90-
components.queryItems = @[[NSURLQueryItem queryItemWithName:@"role" value:@"ios"]];
90+
components.queryItems = @[[NSURLQueryItem queryItemWithName:@"role" value:kRCTPlatformName]]; // TODO(macOS ISS#2323203)
9191
static dispatch_queue_t queue;
9292
static dispatch_once_t onceToken;
9393
dispatch_once(&onceToken, ^{

0 commit comments

Comments
 (0)