Skip to content

Commit 6639248

Browse files
authored
Get Cocoapods build building for test targets, make macOS API surface equivalent to iOS and Android (#305)
* Update scripts to publish react-native-macos-init * Clean up merge markers * Restored ios:macos RNTester parity except for InputAccessoryView. * Add InputAccessoryView for mac * iOS tests pass via Pods * IntegrationTests passing * All targets building * Removed unused file. * Preserve building in both static xcodeproj and cocoapods. * Missed a diff comment * Elliminstated RCTTest #ifdefs * Align with upstream changes post .60 * Fix Flow check and minor ESLint whitespace * Make .gitignore align with changes upstream.
1 parent d9b7a7d commit 6639248

Some content is hidden

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

50 files changed

+1246
-3161
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ buck-out
4141
/ReactAndroid/src/main/jni/prebuilt/lib/x86/
4242
/ReactAndroid/src/main/gen
4343

44+
# Android Studio
45+
.project
46+
.settings
47+
.classpath
48+
4449
# Watchman
4550
.watchmanconfig
4651

Libraries/Blob/React-RCTBlob.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Pod::Spec.new do |s|
2828
s.source = source
2929
s.source_files = "*.{h,m,mm}"
3030
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
31-
s.header_dir = "React"
31+
s.header_dir = "RCTBlob"
3232

3333
s.dependency "React-Core", version
3434
s.dependency "React-RCTNetwork", version

Libraries/CameraRoll/RCTCameraRollManager.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
#import <CoreLocation/CoreLocation.h>
1111
#import <Foundation/Foundation.h>
12-
#import <UIKit/UIKit.h>
12+
#import <React/RCTUIKit.h> // TODO(macOS ISS#2323203)
1313
#import <Photos/Photos.h>
1414
#import <dlfcn.h>
1515
#import <objc/runtime.h>
16+
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
1617
#import <MobileCoreServices/UTType.h>
18+
#endif // TODO(macOS ISS#2323203)
1719

1820
#import <React/RCTBridge.h>
1921
#import <React/RCTConvert.h>
@@ -318,6 +320,7 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve,
318320
resolve:(RCTPromiseResolveBlock)resolve
319321
reject:(RCTPromiseRejectBlock)reject)
320322
{
323+
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
321324
NSArray<NSURL *> *assets_ = [RCTConvert NSURLArray:assets];
322325
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
323326
PHFetchResult<PHAsset *> *fetched =
@@ -333,6 +336,10 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve,
333336
}
334337
}
335338
];
339+
#else // [TODO(macOS ISS#2323203)
340+
NSError *error = RCTErrorWithMessage(@"Delete image not available on macOS");
341+
reject(@"Couldn't delete", @"Couldn't delete assets", error);
342+
#endif // ]TODO(macOS ISS#2323203)
336343
}
337344

338345
static void checkPhotoLibraryConfig()

Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ - (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL
4545
if (!imageURL) {
4646
completionHandler(RCTErrorWithMessage(@"Cannot load a photo library asset with no URL"), nil);
4747
return ^{};
48+
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
4849
} else if ([imageURL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame) {
4950
assetID = [imageURL absoluteString];
5051
results = [PHAsset fetchAssetsWithALAssetURLs:@[imageURL] options:nil];
52+
#endif // TODO(macOS ISS#2323203)
5153
} else {
5254
assetID = [imageURL.absoluteString substringFromIndex:@"ph://".length];
5355
results = [PHAsset fetchAssetsWithLocalIdentifiers:@[assetID] options:nil];

Libraries/CameraRoll/React-RCTCameraRoll.podspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ Pod::Spec.new do |s|
2525
s.documentation_url = "https://facebook.github.io/react-native/docs/cameraroll"
2626
s.license = package["license"]
2727
s.author = "Facebook, Inc. and its affiliates"
28-
s.platforms = { :ios => "9.0", :tvos => "9.2" }
28+
s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214)
2929
s.source = source
3030
s.source_files = "*.{h,m}"
3131
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
3232
s.header_dir = "React"
3333

3434
s.dependency "React-Core", version
3535
s.dependency "React-RCTImage", version
36+
37+
s.osx.exclude_files = "RCTImagePickerManager.*", "RCTAssetsLibraryRequestHandler.*" # TODO(macOS GH#214)
38+
3639
end

Libraries/Image/RCTImageView.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,16 @@ typedef NS_ENUM(NSInteger, UIImageRenderingMode) {
3737
@property (nonatomic, assign) CGFloat blurRadius;
3838
@property (nonatomic, assign) RCTResizeMode resizeMode;
3939

40+
#if TARGET_OS_OSX // [TODO(macOS ISS#2323203)
41+
/**
42+
* macOS Properties
43+
*/
44+
@property (nonatomic, copy) RCTDirectEventBlock onDoubleClick;
45+
@property (nonatomic, copy) RCTDirectEventBlock onClick;
46+
@property (nonatomic, copy) RCTDirectEventBlock onMouseEnter;
47+
@property (nonatomic, copy) RCTDirectEventBlock onMouseLeave;
48+
@property (nonatomic, copy) RCTDirectEventBlock onDragEnter;
49+
@property (nonatomic, copy) RCTDirectEventBlock onDragLeave;
50+
@property (nonatomic, copy) RCTDirectEventBlock onDrop;
51+
#endif // ]TODO(macOS ISS#2323203)
4052
@end

Libraries/NativeAnimation/React-RCTAnimation.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Pod::Spec.new do |s|
2828
s.source = source
2929
s.source_files = "{Drivers/*,Nodes/*,*}.{h,m}"
3030
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
31-
s.header_dir = "React"
31+
s.header_dir = "RCTAnimation"
3232

3333
s.dependency "React-Core", version
3434
end

Libraries/Text/React-RCTText.podspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,4 @@ Pod::Spec.new do |s|
3232
s.header_dir = "React"
3333

3434
s.dependency "React-Core", version
35-
36-
s.osx.exclude_files = "TextInput/RCTInputAccessory{,Shadow}View*.{h,m}"
3735
end

Libraries/Text/TextInput/RCTInputAccessoryShadowView.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ @implementation RCTInputAccessoryShadowView
1414
- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex
1515
{
1616
[super insertReactSubview:subview atIndex:atIndex];
17+
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
1718
subview.width = (YGValue) { RCTScreenSize().width, YGUnitPoint };
19+
#endif // TODO(macOS ISS#2323203)
1820
}
1921

2022
@end

Libraries/Text/TextInput/RCTInputAccessoryView.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@interface RCTInputAccessoryView()
1717

1818
// Overriding `inputAccessoryView` to `readwrite`.
19-
@property (nonatomic, readwrite, retain) UIView *inputAccessoryView;
19+
@property (nonatomic, readwrite, retain) RCTUIView *inputAccessoryView; // TODO(macOS ISS#2323203)
2020

2121
@end
2222

@@ -50,13 +50,13 @@ - (void)reactSetFrame:(CGRect)frame
5050
}
5151
}
5252

53-
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)index
53+
- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)index // TODO(macOS ISS#2323203)
5454
{
5555
[super insertReactSubview:subview atIndex:index];
5656
[_inputAccessoryView insertReactSubview:subview atIndex:index];
5757
}
5858

59-
- (void)removeReactSubview:(UIView *)subview
59+
- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS ISS#2323203)
6060
{
6161
[super removeReactSubview:subview];
6262
[_inputAccessoryView removeReactSubview:subview];

0 commit comments

Comments
 (0)