Skip to content

Commit

Permalink
Fix Fast Refresh in macos (#332)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
tom-un authored May 1, 2020
1 parent 3bf2f87 commit 150f935
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Libraries/Utilities/HMRClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ function registerBundleEntryPoints(client) {

function dismissRedbox() {
if (
Platform.OS === 'ios' &&
(Platform.OS === 'ios' ||
Platform.OS === 'macos') /* TODO(macOS ISS#2323203) */ &&
NativeRedBox != null &&
NativeRedBox.dismiss != null
) {
Expand Down
1 change: 1 addition & 0 deletions React/Base/RCTConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef NSURL RCTFileURL;
+ (CGAffineTransform)CGAffineTransform:(id)json;

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

+ (YGValue)YGValue:(id)json;
Expand Down
5 changes: 5 additions & 0 deletions React/Base/RCTConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,11 @@ + (type)type:(id)json \
}
return names;
}

+ (RCTUIColor *)NSColor:(id)json
{
return [RCTConvert UIColor:json];
}
// ]TODO(macOS ISS#2323203)

+ (RCTUIColor *)UIColor:(id)json // TODO(OSS Candidate ISS#2710739)
Expand Down
3 changes: 2 additions & 1 deletion React/CxxBridge/RCTCxxBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import <React/RCTRedBox.h>
#import <React/RCTUtils.h>
#import <React/RCTFollyConvert.h>
#import <React/RCTBundleURLProvider.h> // TODO(macOS ISS#2323203)
#import <cxxreact/CxxNativeModule.h>
#import <cxxreact/Instance.h>
#import <cxxreact/JSBundleType.h>
Expand Down Expand Up @@ -929,7 +930,7 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
BOOL isHotLoadingEnabled = devSettings.isHotLoadingEnabled;
[self enqueueJSCall:@"HMRClient"
method:@"setup"
args:@[@"ios", path, host, RCTNullIfNil(port), @(isHotLoadingEnabled)]
args:@[kRCTPlatformName, path, host, RCTNullIfNil(port), @(isHotLoadingEnabled)] // TODO(macOS ISS#2323203)
completion:NULL];
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion React/DevSupport/RCTPackagerConnection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (instancetype)init
components.scheme = @"http";
components.port = @(kRCTBundleURLProviderDefaultPort);
components.path = @"/message";
components.queryItems = @[[NSURLQueryItem queryItemWithName:@"role" value:@"ios"]];
components.queryItems = @[[NSURLQueryItem queryItemWithName:@"role" value:kRCTPlatformName]]; // TODO(macOS ISS#2323203)
static dispatch_queue_t queue;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Expand Down

0 comments on commit 150f935

Please sign in to comment.