react-native-macos 0.0.0-0ef79926b → 0.0.0-0f49e3f38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Components/ScrollView/ScrollView.js +11 -45
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.js +79 -1
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.js +10 -6
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/RCTImageView.mm +14 -10
- package/Libraries/LinkingIOS/RCTLinkingManager.h +1 -0
- package/Libraries/LinkingIOS/macos/RCTLinkingManager.mm +12 -5
- package/Libraries/Lists/FlatList.js +25 -2
- package/Libraries/Lists/VirtualizedList.js +118 -113
- package/Libraries/Lists/VirtualizedSectionList.js +9 -5
- package/Libraries/Text/BaseText/RCTBaseTextViewManager.m +1 -0
- package/Libraries/Text/RCTTextAttributes.h +2 -0
- package/Libraries/Text/RCTTextAttributes.m +9 -0
- package/Libraries/Text/Text/RCTDynamicTypeRamp.h +40 -0
- package/Libraries/Text/Text/RCTDynamicTypeRamp.m +77 -0
- package/Libraries/Text/Text/RCTTextView.m +118 -47
- package/Libraries/Text/Text.js +0 -8
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +8 -0
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +57 -2
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +13 -0
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.h +2 -1
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +69 -2
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +7 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +12 -3
- package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.h +4 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +97 -2
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +6 -1
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +40 -0
- package/Libraries/Text/TextNativeComponent.js +2 -0
- package/Libraries/Text/TextProps.js +29 -0
- package/Libraries/Types/CoreEventTypes.js +0 -1
- package/React/Base/RCTAssert.h +2 -3
- package/React/Base/RCTAssert.m +2 -2
- package/React/Base/RCTBridge.m +1 -1
- package/React/Base/RCTConvert.m +7 -4
- package/React/Base/RCTTouchHandler.m +4 -0
- package/React/Base/RCTUIKit.h +8 -13
- package/React/Base/RCTUtils.m +6 -3
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTUIKit.m +33 -0
- package/React/CoreModules/RCTPerfMonitor.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +8 -1
- package/React/Fabric/RCTConversions.h +9 -1
- package/React/Fabric/RCTSurfacePresenter.mm +0 -1
- package/React/Fabric/RCTSurfaceTouchHandler.mm +0 -1
- package/React/Modules/RCTUIManager.m +2 -1
- package/React/React-RCTFabric.podspec +1 -1
- package/React/Views/RCTActivityIndicatorView.m +2 -1
- package/React/Views/RCTView.h +7 -0
- package/React/Views/RCTView.m +91 -27
- package/React/Views/RCTViewKeyboardEvent.m +9 -1
- package/React/Views/RCTViewManager.m +12 -13
- package/React/Views/ScrollView/RCTScrollContentView.h +4 -0
- package/React/Views/ScrollView/RCTScrollContentView.m +6 -0
- package/React/Views/ScrollView/RCTScrollContentViewManager.m +2 -0
- package/React/Views/ScrollView/RCTScrollView.h +2 -1
- package/React/Views/ScrollView/RCTScrollView.m +65 -63
- package/React/Views/ScrollView/RCTScrollViewManager.m +1 -1
- package/React/Views/UIView+React.h +2 -0
- package/React/Views/UIView+React.m +22 -13
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/React-Fabric.podspec +1 -1
- package/ReactCommon/React-rncore.podspec +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
- package/ReactCommon/react/utils/ManagedObjectWrapper.h +1 -1
- package/ReactCommon/react/utils/ManagedObjectWrapper.mm +1 -3
- package/package.json +1 -1
- package/scripts/generate-artifacts.js +21 -17
- package/scripts/react_native_pods.rb +0 -3
- package/template/Gemfile.lock +4 -4
- package/template/package.json +1 -1
- package/third-party-podspecs/boost-for-react-native.podspec +0 -20
package/React/Views/RCTView.m
CHANGED
|
@@ -165,6 +165,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS I
|
|
|
165
165
|
_hitTestEdgeInsets = UIEdgeInsetsZero;
|
|
166
166
|
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
167
167
|
_transform3D = CATransform3DIdentity;
|
|
168
|
+
_shadowColor = nil;
|
|
168
169
|
#endif // TODO(macOS GH#774)
|
|
169
170
|
|
|
170
171
|
_backgroundColor = super.backgroundColor;
|
|
@@ -716,20 +717,49 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
|
|
|
716
717
|
#endif // TODO(macOS GH#774)
|
|
717
718
|
|
|
718
719
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
719
|
-
|
|
720
|
-
- (NSShadow*)shadow
|
|
720
|
+
- (void)setShadowColor:(NSColor *)shadowColor
|
|
721
721
|
{
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
if (_shadowColor != shadowColor)
|
|
723
|
+
{
|
|
724
|
+
_shadowColor = shadowColor;
|
|
725
|
+
[self didUpdateShadow];
|
|
726
|
+
}
|
|
727
|
+
}
|
|
724
728
|
|
|
725
|
-
|
|
726
|
-
|
|
729
|
+
- (void)setShadowOffset:(CGSize)shadowOffset
|
|
730
|
+
{
|
|
731
|
+
if (!CGSizeEqualToSize(_shadowOffset, shadowOffset))
|
|
732
|
+
{
|
|
733
|
+
_shadowOffset = shadowOffset;
|
|
734
|
+
[self didUpdateShadow];
|
|
735
|
+
}
|
|
736
|
+
}
|
|
727
737
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
738
|
+
- (void)setShadowOpacity:(CGFloat)shadowOpacity
|
|
739
|
+
{
|
|
740
|
+
if (_shadowOpacity != shadowOpacity)
|
|
741
|
+
{
|
|
742
|
+
_shadowOpacity = shadowOpacity;
|
|
743
|
+
[self didUpdateShadow];
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
- (void)setShadowRadius:(CGFloat)shadowRadius
|
|
748
|
+
{
|
|
749
|
+
if (_shadowRadius != shadowRadius)
|
|
750
|
+
{
|
|
751
|
+
_shadowRadius = shadowRadius;
|
|
752
|
+
[self didUpdateShadow];
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
-(void)didUpdateShadow
|
|
757
|
+
{
|
|
758
|
+
NSShadow *shadow = [NSShadow new];
|
|
759
|
+
shadow.shadowColor = [[self shadowColor] colorWithAlphaComponent:[self shadowOpacity]];
|
|
760
|
+
shadow.shadowOffset = [self shadowOffset];
|
|
761
|
+
shadow.shadowBlurRadius = [self shadowRadius];
|
|
762
|
+
[self setShadow:shadow];
|
|
733
763
|
}
|
|
734
764
|
|
|
735
765
|
- (void)viewDidMoveToWindow
|
|
@@ -749,6 +779,9 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
|
|
|
749
779
|
name:NSViewBoundsDidChangeNotification
|
|
750
780
|
object:[[self enclosingScrollView] contentView]];
|
|
751
781
|
}
|
|
782
|
+
|
|
783
|
+
[self reactViewDidMoveToWindow]; // TODO(macOS GH#1412)
|
|
784
|
+
|
|
752
785
|
[super viewDidMoveToWindow];
|
|
753
786
|
}
|
|
754
787
|
|
|
@@ -1407,9 +1440,14 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1407
1440
|
}
|
|
1408
1441
|
}
|
|
1409
1442
|
|
|
1443
|
+
- (BOOL)needsPanelToBecomeKey {
|
|
1444
|
+
// We need to override this so that mouse clicks don't move keyboard focus on focusable views by default.
|
|
1445
|
+
return false;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1410
1448
|
- (BOOL)acceptsFirstResponder
|
|
1411
1449
|
{
|
|
1412
|
-
|
|
1450
|
+
return [self focusable] || [super acceptsFirstResponder];
|
|
1413
1451
|
}
|
|
1414
1452
|
|
|
1415
1453
|
- (void)updateTrackingAreas
|
|
@@ -1494,13 +1532,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1494
1532
|
block(body);
|
|
1495
1533
|
}
|
|
1496
1534
|
|
|
1497
|
-
- (NSDictionary*)
|
|
1535
|
+
- (NSDictionary*)dataTransferInfoFromPasteboard:(NSPasteboard*)pasteboard
|
|
1498
1536
|
{
|
|
1499
|
-
|
|
1500
|
-
return @{};
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
NSArray *fileNames = [pastboard propertyListForType:NSFilenamesPboardType];
|
|
1537
|
+
NSArray *fileNames = [pasteboard propertyListForType:NSFilenamesPboardType] ?: @[];
|
|
1504
1538
|
NSMutableArray *files = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
1505
1539
|
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
1506
1540
|
NSMutableArray *types = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
@@ -1526,11 +1560,21 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1526
1560
|
BOOL success = [fileURL getResourceValue:&fileSizeValue
|
|
1527
1561
|
forKey:NSURLFileSizeKey
|
|
1528
1562
|
error:&fileSizeError];
|
|
1529
|
-
|
|
1563
|
+
|
|
1564
|
+
NSNumber *width = nil;
|
|
1565
|
+
NSNumber *height = nil;
|
|
1566
|
+
if ([MIMETypeString hasPrefix:@"image/"]) {
|
|
1567
|
+
NSImage *image = [[NSImage alloc] initWithContentsOfURL:fileURL];
|
|
1568
|
+
width = @(image.size.width);
|
|
1569
|
+
height = @(image.size.height);
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1530
1572
|
[files addObject:@{@"name": RCTNullIfNil(fileURL.lastPathComponent),
|
|
1531
1573
|
@"type": RCTNullIfNil(MIMETypeString),
|
|
1532
|
-
@"uri": RCTNullIfNil(fileURL.
|
|
1533
|
-
@"size": success ? fileSizeValue : (id)kCFNull
|
|
1574
|
+
@"uri": RCTNullIfNil(fileURL.path),
|
|
1575
|
+
@"size": success ? fileSizeValue : (id)kCFNull,
|
|
1576
|
+
@"width": RCTNullIfNil(width),
|
|
1577
|
+
@"height": RCTNullIfNil(height)
|
|
1534
1578
|
}];
|
|
1535
1579
|
|
|
1536
1580
|
[items addObject:@{@"kind": @"file",
|
|
@@ -1540,7 +1584,27 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1540
1584
|
[types addObject:RCTNullIfNil(MIMETypeString)];
|
|
1541
1585
|
}
|
|
1542
1586
|
}
|
|
1543
|
-
|
|
1587
|
+
|
|
1588
|
+
NSPasteboardType imageType = [pasteboard availableTypeFromArray:@[NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
|
|
1589
|
+
if (imageType && fileNames.count == 0) {
|
|
1590
|
+
NSString *MIMETypeString = imageType == NSPasteboardTypePNG ? @"image/png" : @"image/tiff";
|
|
1591
|
+
NSData *imageData = [pasteboard dataForType:imageType];
|
|
1592
|
+
NSImage *image = [[NSImage alloc] initWithData:imageData];
|
|
1593
|
+
|
|
1594
|
+
[files addObject:@{@"type": RCTNullIfNil(MIMETypeString),
|
|
1595
|
+
@"uri": RCTDataURL(MIMETypeString, imageData).absoluteString,
|
|
1596
|
+
@"size": @(imageData.length),
|
|
1597
|
+
@"width": @(image.size.width),
|
|
1598
|
+
@"height": @(image.size.height),
|
|
1599
|
+
}];
|
|
1600
|
+
|
|
1601
|
+
[items addObject:@{@"kind": @"image",
|
|
1602
|
+
@"type": RCTNullIfNil(MIMETypeString),
|
|
1603
|
+
}];
|
|
1604
|
+
|
|
1605
|
+
[types addObject:RCTNullIfNil(MIMETypeString)];
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1544
1608
|
return @{@"dataTransfer": @{@"files": files,
|
|
1545
1609
|
@"items": items,
|
|
1546
1610
|
@"types": types}};
|
|
@@ -1565,9 +1629,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1565
1629
|
[self sendMouseEventWithBlock:self.onDragEnter
|
|
1566
1630
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1567
1631
|
modifierFlags:0
|
|
1568
|
-
additionalData:[self
|
|
1569
|
-
|
|
1570
|
-
if ([pboard
|
|
1632
|
+
additionalData:[self dataTransferInfoFromPasteboard:pboard]];
|
|
1633
|
+
|
|
1634
|
+
if ([pboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
1571
1635
|
if (sourceDragMask & NSDragOperationLink) {
|
|
1572
1636
|
return NSDragOperationLink;
|
|
1573
1637
|
} else if (sourceDragMask & NSDragOperationCopy) {
|
|
@@ -1582,7 +1646,7 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1582
1646
|
[self sendMouseEventWithBlock:self.onDragLeave
|
|
1583
1647
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1584
1648
|
modifierFlags:0
|
|
1585
|
-
additionalData:[self
|
|
1649
|
+
additionalData:[self dataTransferInfoFromPasteboard:sender.draggingPasteboard]];
|
|
1586
1650
|
}
|
|
1587
1651
|
|
|
1588
1652
|
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
|
@@ -1590,7 +1654,7 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1590
1654
|
[self sendMouseEventWithBlock:self.onDrop
|
|
1591
1655
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1592
1656
|
modifierFlags:0
|
|
1593
|
-
additionalData:[self
|
|
1657
|
+
additionalData:[self dataTransferInfoFromPasteboard:sender.draggingPasteboard]];
|
|
1594
1658
|
return YES;
|
|
1595
1659
|
}
|
|
1596
1660
|
#endif // ]TODO(macOS GH#774)
|
|
@@ -52,7 +52,15 @@
|
|
|
52
52
|
return @"Backspace";
|
|
53
53
|
} else if (code == NSDeleteFunctionKey) {
|
|
54
54
|
return @"Delete";
|
|
55
|
-
|
|
55
|
+
} else if (code == NSHomeFunctionKey) {
|
|
56
|
+
return @"Home";
|
|
57
|
+
} else if (code == NSEndFunctionKey) {
|
|
58
|
+
return @"End";
|
|
59
|
+
} else if (code == NSPageUpFunctionKey) {
|
|
60
|
+
return @"PageUp";
|
|
61
|
+
} else if (code == NSPageDownFunctionKey) {
|
|
62
|
+
return @"PageDown";
|
|
63
|
+
}
|
|
56
64
|
|
|
57
65
|
return key;
|
|
58
66
|
}
|
|
@@ -95,7 +95,7 @@ RCT_EXPORT_MODULE()
|
|
|
95
95
|
|
|
96
96
|
- (void)setBridge:(RCTBridge *)bridge
|
|
97
97
|
{
|
|
98
|
-
|
|
98
|
+
RCTErrorNotAllowedForNewArchitecture(self, @"RCTViewManager must not be initialized for the new architecture");
|
|
99
99
|
_bridge = bridge;
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -196,10 +196,19 @@ RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat)
|
|
|
196
196
|
#else // [TODO(macOS GH#774)
|
|
197
197
|
RCT_REMAP_VIEW_PROPERTY(opacity, alphaValue, CGFloat)
|
|
198
198
|
#endif // ]TODO(macOS GH#774)
|
|
199
|
+
|
|
200
|
+
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
199
201
|
RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor)
|
|
200
202
|
RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize)
|
|
201
203
|
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
|
|
202
204
|
RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat)
|
|
205
|
+
#else // [TODO(macOS GH#774)
|
|
206
|
+
RCT_EXPORT_VIEW_PROPERTY(shadowColor, NSColor)
|
|
207
|
+
RCT_EXPORT_VIEW_PROPERTY(shadowOffset, CGSize)
|
|
208
|
+
RCT_EXPORT_VIEW_PROPERTY(shadowOpacity, CGFloat)
|
|
209
|
+
RCT_EXPORT_VIEW_PROPERTY(shadowRadius, CGFloat)
|
|
210
|
+
#endif // ]TODO(macOS GH#774)
|
|
211
|
+
|
|
203
212
|
RCT_REMAP_VIEW_PROPERTY(needsOffscreenAlphaCompositing, layer.allowsGroupOpacity, BOOL)
|
|
204
213
|
RCT_CUSTOM_VIEW_PROPERTY(overflow, YGOverflow, RCTView)
|
|
205
214
|
{
|
|
@@ -486,18 +495,8 @@ RCT_EXPORT_VIEW_PROPERTY(onDragLeave, RCTDirectEventBlock)
|
|
|
486
495
|
RCT_EXPORT_VIEW_PROPERTY(onDrop, RCTDirectEventBlock)
|
|
487
496
|
RCT_EXPORT_VIEW_PROPERTY(onKeyDown, RCTDirectEventBlock) // macOS keyboard events
|
|
488
497
|
RCT_EXPORT_VIEW_PROPERTY(onKeyUp, RCTDirectEventBlock) // macOS keyboard events
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
if ([view respondsToSelector:@selector(setValidKeysDown:)]) {
|
|
492
|
-
view.validKeysDown = [RCTConvert NSArray:json];
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
RCT_CUSTOM_VIEW_PROPERTY(validKeysUp, NSArray<NSString*>, RCTView)
|
|
496
|
-
{
|
|
497
|
-
if ([view respondsToSelector:@selector(setValidKeysUp:)]) {
|
|
498
|
-
view.validKeysUp = [RCTConvert NSArray:json];
|
|
499
|
-
}
|
|
500
|
-
}
|
|
498
|
+
RCT_EXPORT_VIEW_PROPERTY(validKeysDown, NSArray<NSString*>)
|
|
499
|
+
RCT_EXPORT_VIEW_PROPERTY(validKeysUp, NSArray<NSString*>)
|
|
501
500
|
#endif // ]TODO(macOS GH#774)
|
|
502
501
|
#if TARGET_OS_OSX // [TODO(macOS GH#768)
|
|
503
502
|
RCT_CUSTOM_VIEW_PROPERTY(nextKeyViewTag, NSNumber, RCTView)
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
#import "RCTScrollView.h"
|
|
19
19
|
|
|
20
20
|
@implementation RCTScrollContentView
|
|
21
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
22
|
+
- (BOOL)isFlipped
|
|
23
|
+
{
|
|
24
|
+
return !self.inverted;
|
|
25
|
+
}
|
|
26
|
+
#endif // ]TODO(macOS GH#774)
|
|
21
27
|
|
|
22
28
|
- (void)reactSetFrame:(CGRect)frame
|
|
23
29
|
{
|
|
@@ -65,9 +65,10 @@
|
|
|
65
65
|
@property (nonatomic, copy) RCTDirectEventBlock onScrollEndDrag;
|
|
66
66
|
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollBegin;
|
|
67
67
|
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd;
|
|
68
|
-
@property (nonatomic, copy) RCTDirectEventBlock onScrollKeyDown; // TODO(macOS GH#774)
|
|
69
68
|
@property (nonatomic, copy) RCTDirectEventBlock onPreferredScrollerStyleDidChange; // TODO(macOS GH#774)
|
|
70
69
|
|
|
70
|
+
@property (nonatomic, copy) RCTDirectEventBlock onInvertedDidChange; // TODO(macOS GH#774)
|
|
71
|
+
|
|
71
72
|
- (void)flashScrollIndicators; // TODO(macOS GH#774)
|
|
72
73
|
|
|
73
74
|
@end
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
25
25
|
#import "RCTRefreshControl.h"
|
|
26
|
+
#else
|
|
27
|
+
#import "RCTViewKeyboardEvent.h"
|
|
26
28
|
#endif // TODO(macOS GH#774)
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
@property (nonatomic, assign) BOOL pinchGestureEnabled;
|
|
44
46
|
#else // [TODO(macOS GH#774)
|
|
45
47
|
+ (BOOL)isCompatibleWithResponsiveScrolling;
|
|
48
|
+
@property (nonatomic, assign, getter=isInverted) BOOL inverted;
|
|
46
49
|
@property (nonatomic, assign, getter=isScrollEnabled) BOOL scrollEnabled;
|
|
47
50
|
@property (nonatomic, strong) NSPanGestureRecognizer *panGestureRecognizer;
|
|
48
51
|
#endif // ]TODO(macOS GH#774)
|
|
@@ -106,9 +109,14 @@
|
|
|
106
109
|
return YES;
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
- (BOOL)isFlipped
|
|
113
|
+
{
|
|
114
|
+
return !self.inverted;
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
- (void)scrollWheel:(NSEvent *)theEvent
|
|
110
118
|
{
|
|
111
|
-
if (!self.
|
|
119
|
+
if (!self.isScrollEnabled) {
|
|
112
120
|
[[self nextResponder] scrollWheel:theEvent];
|
|
113
121
|
return;
|
|
114
122
|
}
|
|
@@ -554,6 +562,15 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
554
562
|
{
|
|
555
563
|
[_scrollView setAccessibilityRole:accessibilityRole];
|
|
556
564
|
}
|
|
565
|
+
|
|
566
|
+
- (void)setInverted:(BOOL)inverted
|
|
567
|
+
{
|
|
568
|
+
BOOL changed = _inverted != inverted;
|
|
569
|
+
_inverted = inverted;
|
|
570
|
+
if (changed && _onInvertedDidChange) {
|
|
571
|
+
_onInvertedDidChange(@{});
|
|
572
|
+
}
|
|
573
|
+
}
|
|
557
574
|
#endif // ]TODO(macOS GH#774)
|
|
558
575
|
|
|
559
576
|
RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
|
|
@@ -1261,74 +1278,58 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
|
|
1261
1278
|
}];
|
|
1262
1279
|
}
|
|
1263
1280
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
- (NSString*)keyCommandFromKeyCode:(NSInteger)keyCode modifierFlags:(NSEventModifierFlags)modifierFlags
|
|
1267
|
-
{
|
|
1268
|
-
switch (keyCode)
|
|
1269
|
-
{
|
|
1270
|
-
case 36:
|
|
1271
|
-
return @"ENTER";
|
|
1272
|
-
|
|
1273
|
-
case 115:
|
|
1274
|
-
return @"HOME";
|
|
1275
|
-
|
|
1276
|
-
case 116:
|
|
1277
|
-
return @"PAGE_UP";
|
|
1278
|
-
|
|
1279
|
-
case 119:
|
|
1280
|
-
return @"END";
|
|
1281
|
-
|
|
1282
|
-
case 121:
|
|
1283
|
-
return @"PAGE_DOWN";
|
|
1284
|
-
|
|
1285
|
-
case 123:
|
|
1286
|
-
return @"LEFT_ARROW";
|
|
1287
|
-
|
|
1288
|
-
case 124:
|
|
1289
|
-
return @"RIGHT_ARROW";
|
|
1281
|
+
// [TODO(macOS GH#774)
|
|
1282
|
+
#pragma mark - Keyboard Events
|
|
1290
1283
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1284
|
+
#if TARGET_OS_OSX
|
|
1285
|
+
- (RCTViewKeyboardEvent*)keyboardEvent:(NSEvent*)event {
|
|
1286
|
+
BOOL keyDown = event.type == NSEventTypeKeyDown;
|
|
1287
|
+
NSArray<NSString *> *validKeys = keyDown ? self.validKeysDown : self.validKeysUp;
|
|
1288
|
+
NSString *key = [RCTViewKeyboardEvent keyFromEvent:event];
|
|
1289
|
+
|
|
1290
|
+
// Only post events for keys we care about
|
|
1291
|
+
if (![validKeys containsObject:key]) {
|
|
1292
|
+
return nil;
|
|
1293
|
+
}
|
|
1297
1294
|
|
|
1298
|
-
|
|
1299
|
-
if (modifierFlags & NSEventModifierFlagOption) {
|
|
1300
|
-
return @"OPTION_UP";
|
|
1301
|
-
} else {
|
|
1302
|
-
return @"UP_ARROW";
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
return @"";
|
|
1295
|
+
return [RCTViewKeyboardEvent keyEventFromEvent:event reactTag:self.reactTag];
|
|
1306
1296
|
}
|
|
1307
1297
|
|
|
1308
|
-
- (
|
|
1309
|
-
{
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
RCT_SEND_SCROLL_EVENT(onScrollKeyDown, (@{ @"key": keyCommand}));
|
|
1315
|
-
} else {
|
|
1316
|
-
[super keyDown:theEvent];
|
|
1298
|
+
- (BOOL)handleKeyboardEvent:(NSEvent *)event {
|
|
1299
|
+
if (event.type == NSEventTypeKeyDown ? self.onKeyDown : self.onKeyUp) {
|
|
1300
|
+
RCTViewKeyboardEvent *keyboardEvent = [self keyboardEvent:event];
|
|
1301
|
+
if (keyboardEvent) {
|
|
1302
|
+
[_eventDispatcher sendEvent:keyboardEvent];
|
|
1303
|
+
return YES;
|
|
1317
1304
|
}
|
|
1318
1305
|
}
|
|
1306
|
+
return NO;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
- (void)keyDown:(NSEvent *)event {
|
|
1310
|
+
if (![self handleKeyboardEvent:event]) {
|
|
1311
|
+
[super keyDown:event];
|
|
1312
|
+
|
|
1313
|
+
// AX: if a tab key was pressed and the first responder is currently clipped by the scroll view,
|
|
1314
|
+
// automatically scroll to make the view visible to make it navigable via keyboard.
|
|
1315
|
+
NSString *key = [RCTViewKeyboardEvent keyFromEvent:event];
|
|
1316
|
+
if ([key isEqualToString:@"Tab"]) {
|
|
1317
|
+
id firstResponder = [[self window] firstResponder];
|
|
1318
|
+
if ([firstResponder isKindOfClass:[NSView class]] &&
|
|
1319
|
+
[firstResponder isDescendantOf:[_scrollView documentView]]) {
|
|
1320
|
+
NSView *view = (NSView*)firstResponder;
|
|
1321
|
+
NSRect visibleRect = ([view superview] == [_scrollView documentView]) ? NSInsetRect(view.frame, -1, -1) :
|
|
1322
|
+
[view convertRect:view.frame toView:_scrollView.documentView];
|
|
1323
|
+
[[_scrollView documentView] scrollRectToVisible:visibleRect];
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1319
1328
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
if ([firstResponder isKindOfClass:[NSView class]] &&
|
|
1325
|
-
[firstResponder isDescendantOf:[_scrollView documentView]]) {
|
|
1326
|
-
NSView *view = (NSView*)firstResponder;
|
|
1327
|
-
NSRect visibleRect = ([view superview] == [_scrollView documentView]) ? NSInsetRect(view.frame, -1, -1) :
|
|
1328
|
-
[view convertRect:view.frame toView:_scrollView.documentView];
|
|
1329
|
-
[[_scrollView documentView] scrollRectToVisible:visibleRect];
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1329
|
+
- (void)keyUp:(NSEvent *)event {
|
|
1330
|
+
if (![self handleKeyboardEvent:event]) {
|
|
1331
|
+
[super keyUp:event];
|
|
1332
|
+
}
|
|
1332
1333
|
}
|
|
1333
1334
|
|
|
1334
1335
|
static NSString *RCTStringForScrollerStyle(NSScrollerStyle scrollerStyle) {
|
|
@@ -1343,7 +1344,8 @@ static NSString *RCTStringForScrollerStyle(NSScrollerStyle scrollerStyle) {
|
|
|
1343
1344
|
- (void)preferredScrollerStyleDidChange:(__unused NSNotification *)notification {
|
|
1344
1345
|
RCT_SEND_SCROLL_EVENT(onPreferredScrollerStyleDidChange, (@{ @"preferredScrollerStyle": RCTStringForScrollerStyle([NSScroller preferredScrollerStyle])}));
|
|
1345
1346
|
}
|
|
1346
|
-
#endif
|
|
1347
|
+
#endif
|
|
1348
|
+
// ]TODO(macOS GH#774)
|
|
1347
1349
|
|
|
1348
1350
|
// Note: setting several properties of UIScrollView has the effect of
|
|
1349
1351
|
// resetting its contentOffset to {0, 0}. To prevent this, we generate
|
|
@@ -99,7 +99,7 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollToTop, RCTDirectEventBlock)
|
|
|
99
99
|
RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock)
|
|
100
100
|
RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollBegin, RCTDirectEventBlock)
|
|
101
101
|
RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollEnd, RCTDirectEventBlock)
|
|
102
|
-
RCT_EXPORT_OSX_VIEW_PROPERTY(
|
|
102
|
+
RCT_EXPORT_OSX_VIEW_PROPERTY(onInvertedDidChange, RCTDirectEventBlock) // TODO(macOS GH#774)
|
|
103
103
|
RCT_EXPORT_OSX_VIEW_PROPERTY(onPreferredScrollerStyleDidChange, RCTDirectEventBlock) // TODO(macOS GH#774)
|
|
104
104
|
RCT_EXPORT_VIEW_PROPERTY(inverted, BOOL)
|
|
105
105
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
|
|
@@ -267,18 +267,17 @@
|
|
|
267
267
|
}
|
|
268
268
|
#endif // TODO(macOS GH#774)
|
|
269
269
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
*/
|
|
273
|
-
- (BOOL)reactIsFocusNeeded
|
|
270
|
+
// [TODO(macOS GH#1412)
|
|
271
|
+
- (void)reactViewDidMoveToWindow
|
|
274
272
|
{
|
|
275
|
-
|
|
273
|
+
[self reactFocusIfNeeded];
|
|
276
274
|
}
|
|
275
|
+
// TODO(macOS GH#1412)]
|
|
277
276
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Focus manipulation.
|
|
279
|
+
*/
|
|
280
|
+
static __weak RCTPlatformView *_pendingFocusView; // TODO(macOS GH#1412)
|
|
282
281
|
|
|
283
282
|
- (void)reactFocus
|
|
284
283
|
{
|
|
@@ -287,19 +286,23 @@
|
|
|
287
286
|
#else
|
|
288
287
|
if (![self becomeFirstResponder]) {
|
|
289
288
|
#endif // TODO(macOS GH#774)]
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
// [TODO(macOS GH#1412)
|
|
290
|
+
_pendingFocusView = self;
|
|
291
|
+
} else {
|
|
292
|
+
_pendingFocusView = nil;
|
|
293
|
+
}
|
|
294
|
+
// TODO(macOS GH#1412)]
|
|
292
295
|
}
|
|
293
296
|
|
|
294
297
|
- (void)reactFocusIfNeeded
|
|
295
298
|
{
|
|
296
|
-
if (self
|
|
299
|
+
if ([self isEqual:_pendingFocusView]) { // TODO(macOS GH#1412)
|
|
297
300
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
298
301
|
if ([[self window] makeFirstResponder:self]) {
|
|
299
302
|
#else
|
|
300
303
|
if ([self becomeFirstResponder]) {
|
|
301
304
|
#endif // TODO(macOS GH#774)]
|
|
302
|
-
|
|
305
|
+
_pendingFocusView = nil; // TODO(macOS GH#1412)
|
|
303
306
|
}
|
|
304
307
|
}
|
|
305
308
|
}
|
|
@@ -313,6 +316,12 @@
|
|
|
313
316
|
#else
|
|
314
317
|
[self resignFirstResponder];
|
|
315
318
|
#endif // TODO(macOS GH#774)]
|
|
319
|
+
|
|
320
|
+
// [TODO(macOS GH#1412)
|
|
321
|
+
if ([self isEqual:_pendingFocusView]) {
|
|
322
|
+
_pendingFocusView = nil;
|
|
323
|
+
}
|
|
324
|
+
// TODO(macOS GH#1412)]
|
|
316
325
|
}
|
|
317
326
|
|
|
318
327
|
#pragma mark - Layout
|
|
@@ -29,7 +29,7 @@ Pod::Spec.new do |s|
|
|
|
29
29
|
s.homepage = "https://reactnative.dev/"
|
|
30
30
|
s.license = package["license"]
|
|
31
31
|
s.author = "Facebook, Inc. and its affiliates"
|
|
32
|
-
s.platforms = { :ios => "11.0" }
|
|
32
|
+
s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774)
|
|
33
33
|
s.source = source
|
|
34
34
|
s.source_files = "dummyFile.cpp"
|
|
35
35
|
s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES",
|
|
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
|
|
|
25
25
|
s.homepage = "https://reactnative.dev/"
|
|
26
26
|
s.license = package["license"]
|
|
27
27
|
s.author = "Facebook, Inc. and its affiliates"
|
|
28
|
-
s.platforms = { :ios => "11.0" }
|
|
28
|
+
s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774)
|
|
29
29
|
s.source = source
|
|
30
30
|
s.source_files = "dummyFile.cpp"
|
|
31
31
|
s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES",
|
|
@@ -27,7 +27,7 @@ Pod::Spec.new do |s|
|
|
|
27
27
|
s.homepage = "https://reactnative.dev/"
|
|
28
28
|
s.license = package["license"]
|
|
29
29
|
s.author = "Facebook, Inc. and its affiliates"
|
|
30
|
-
s.platforms = { :ios => "11.0", :
|
|
30
|
+
s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774)
|
|
31
31
|
s.source = source
|
|
32
32
|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
|
33
33
|
s.source_files = "**/*.{m,mm,cpp,h}"
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#include "ManagedObjectWrapper.h"
|
|
9
9
|
|
|
10
|
-
#if
|
|
11
|
-
#if TARGET_OS_MAC && TARGET_OS_IPHONE
|
|
10
|
+
#if TARGET_OS_MAC
|
|
12
11
|
|
|
13
12
|
namespace facebook {
|
|
14
13
|
namespace react {
|
|
@@ -35,4 +34,3 @@ void wrappedManagedObjectDeleter(void *cfPointer) noexcept
|
|
|
35
34
|
@end
|
|
36
35
|
|
|
37
36
|
#endif
|
|
38
|
-
#endif
|