react-native-macos 0.0.0-8ed4340a4 → 0.0.0-8f5b6f691
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/TextInput.js +30 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewViewConfig.js +1 -0
- package/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +3 -3
- package/Libraries/Components/View/ViewPropTypes.js +10 -6
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/LinkingIOS/RCTLinkingManager.h +1 -0
- package/Libraries/LinkingIOS/macos/RCTLinkingManager.mm +12 -5
- package/Libraries/Lists/FlatList.js +25 -1
- package/Libraries/Lists/VirtualizedList.js +106 -113
- package/Libraries/Lists/VirtualizedSectionList.js +9 -5
- package/Libraries/StyleSheet/StyleSheetTypes.js +25 -0
- package/Libraries/Text/RCTTextAttributes.m +5 -5
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +3 -1
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +50 -2
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +6 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +12 -3
- package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.h +1 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +54 -2
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +1 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +24 -0
- package/Libraries/Types/CoreEventTypes.js +0 -1
- package/React/Base/RCTConvert.m +3 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTUIKit.m +7 -0
- package/React/CoreModules/RCTPerfMonitor.mm +1 -1
- package/React/Modules/RCTUIManager.m +2 -1
- package/React/Views/RCTActivityIndicatorView.m +2 -1
- package/React/Views/RCTCursor.h +39 -0
- package/React/Views/RCTCursor.m +105 -0
- package/React/Views/RCTView.h +12 -0
- package/React/Views/RCTView.m +110 -42
- package/React/Views/RCTViewKeyboardEvent.m +9 -1
- package/React/Views/RCTViewManager.m +17 -12
- package/React/Views/ScrollView/RCTScrollContentView.h +4 -0
- package/React/Views/ScrollView/RCTScrollContentView.m +18 -0
- package/React/Views/ScrollView/RCTScrollContentViewManager.m +2 -0
- package/React/Views/ScrollView/RCTScrollView.h +2 -1
- package/React/Views/ScrollView/RCTScrollView.m +69 -62
- 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/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
- package/scripts/generate-artifacts.js +21 -17
- package/scripts/react_native_pods.rb +0 -3
- package/template/Gemfile.lock +5 -5
- package/template/android/gradlew.bat +89 -89
- package/template/package.json +1 -1
- package/third-party-podspecs/boost-for-react-native.podspec +0 -20
|
@@ -16,6 +16,29 @@ import type {NativeColorValue} from './PlatformColorValueTypes';
|
|
|
16
16
|
|
|
17
17
|
export type ____ColorValue_Internal = null | string | NativeColorValue;
|
|
18
18
|
|
|
19
|
+
export type CursorValue = ?(
|
|
20
|
+
| 'alias'
|
|
21
|
+
| 'auto'
|
|
22
|
+
| 'col-resize'
|
|
23
|
+
| 'context-menu'
|
|
24
|
+
| 'copy'
|
|
25
|
+
| 'crosshair'
|
|
26
|
+
| 'default'
|
|
27
|
+
| 'disappearing-item'
|
|
28
|
+
| 'e-resize'
|
|
29
|
+
| 'grab'
|
|
30
|
+
| 'grabbing'
|
|
31
|
+
| 'n-resize'
|
|
32
|
+
| 'no-drop'
|
|
33
|
+
| 'not-allowed'
|
|
34
|
+
| 'pointer'
|
|
35
|
+
| 'row-resize'
|
|
36
|
+
| 's-resize'
|
|
37
|
+
| 'text'
|
|
38
|
+
| 'vertical-text'
|
|
39
|
+
| 'w-resize'
|
|
40
|
+
);
|
|
41
|
+
|
|
19
42
|
export type ColorArrayValue = null | $ReadOnlyArray<____ColorValue_Internal>;
|
|
20
43
|
export type PointValue = {|
|
|
21
44
|
x: number,
|
|
@@ -584,6 +607,7 @@ export type ____ViewStyle_Internal = $ReadOnly<{|
|
|
|
584
607
|
borderTopWidth?: number | AnimatedNode,
|
|
585
608
|
opacity?: number | AnimatedNode,
|
|
586
609
|
elevation?: number,
|
|
610
|
+
cursor?: CursorValue,
|
|
587
611
|
|}>;
|
|
588
612
|
|
|
589
613
|
export type ____FontWeight_Internal =
|
|
@@ -638,6 +662,7 @@ export type ____TextStyle_Internal = $ReadOnly<{|
|
|
|
638
662
|
textDecorationColor?: ____ColorValue_Internal,
|
|
639
663
|
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase',
|
|
640
664
|
writingDirection?: 'auto' | 'ltr' | 'rtl',
|
|
665
|
+
cursor?: CursorValue,
|
|
641
666
|
|}>;
|
|
642
667
|
|
|
643
668
|
export type ____ImageStyle_Internal = $ReadOnly<{|
|
|
@@ -109,27 +109,27 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
109
109
|
alignment = NSTextAlignmentRight;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
paragraphStyle.alignment = alignment;
|
|
114
114
|
isParagraphStyleUsed = YES;
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
if (_baseWritingDirection != NSWritingDirectionNatural) {
|
|
118
118
|
paragraphStyle.baseWritingDirection = _baseWritingDirection;
|
|
119
119
|
isParagraphStyleUsed = YES;
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
if (!isnan(_lineHeight)) {
|
|
123
123
|
CGFloat lineHeight = _lineHeight * self.effectiveFontSizeMultiplier;
|
|
124
124
|
paragraphStyle.minimumLineHeight = lineHeight;
|
|
125
125
|
paragraphStyle.maximumLineHeight = lineHeight;
|
|
126
126
|
isParagraphStyleUsed = YES;
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
if (isParagraphStyleUsed) {
|
|
130
130
|
return [paragraphStyle copy];
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
return nil;
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -106,7 +106,9 @@
|
|
|
106
106
|
- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // TODO(macOS ISS#3536887)
|
|
107
107
|
{
|
|
108
108
|
RCTDirectEventBlock onScroll = self.onScroll;
|
|
109
|
-
|
|
109
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
110
|
+
[_scrollView setHasVerticalScroller:YES];
|
|
111
|
+
#endif // ]TODO(macOS GH#774)
|
|
110
112
|
if (onScroll) {
|
|
111
113
|
CGPoint contentOffset = scrollView.contentOffset;
|
|
112
114
|
CGSize contentSize = scrollView.contentSize;
|
|
@@ -320,12 +320,47 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
320
320
|
{
|
|
321
321
|
return [super selectedRange];
|
|
322
322
|
}
|
|
323
|
+
|
|
324
|
+
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)draggingInfo
|
|
325
|
+
{
|
|
326
|
+
NSDragOperation dragOperation = [self.textInputDelegate textInputDraggingEntered:draggingInfo];
|
|
327
|
+
NSDragOperation superOperation = [super draggingEntered:draggingInfo];
|
|
328
|
+
// The delegate's operation should take precedence.
|
|
329
|
+
return dragOperation != NSDragOperationNone ? dragOperation : superOperation;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
- (void)draggingExited:(id<NSDraggingInfo>)draggingInfo
|
|
333
|
+
{
|
|
334
|
+
[self.textInputDelegate textInputDraggingExited:draggingInfo];
|
|
335
|
+
[super draggingExited:draggingInfo];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
- (BOOL)performDragOperation:(id<NSDraggingInfo>)draggingInfo
|
|
339
|
+
{
|
|
340
|
+
if ([self.textInputDelegate textInputShouldHandleDragOperation:draggingInfo]) {
|
|
341
|
+
return [super performDragOperation:draggingInfo];
|
|
342
|
+
}
|
|
343
|
+
return YES;
|
|
344
|
+
}
|
|
345
|
+
- (NSArray *)readablePasteboardTypes
|
|
346
|
+
{
|
|
347
|
+
NSArray *types = [super readablePasteboardTypes];
|
|
348
|
+
// TODO: Optionally support files/images with a prop
|
|
349
|
+
return [types arrayByAddingObjectsFromArray:@[NSFilenamesPboardType, NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
|
|
350
|
+
}
|
|
351
|
+
|
|
323
352
|
#endif // ]TODO(macOS GH#774)
|
|
324
353
|
|
|
325
354
|
- (void)paste:(id)sender
|
|
326
355
|
{
|
|
327
|
-
|
|
328
|
-
|
|
356
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
357
|
+
if ([self.textInputDelegate textInputShouldHandlePaste:self]) {
|
|
358
|
+
#endif
|
|
359
|
+
[super paste:sender];
|
|
360
|
+
_textWasPasted = YES;
|
|
361
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
362
|
+
}
|
|
363
|
+
#endif
|
|
329
364
|
}
|
|
330
365
|
|
|
331
366
|
// Turn off scroll animation to fix flaky scrolling.
|
|
@@ -514,6 +549,19 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
514
549
|
[super deleteBackward];
|
|
515
550
|
}
|
|
516
551
|
}
|
|
552
|
+
#else
|
|
553
|
+
- (void)keyDown:(NSEvent *)event {
|
|
554
|
+
// If hasMarkedText is true then an IME is open, so don't send event to JS.
|
|
555
|
+
if (self.hasMarkedText || [self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
556
|
+
[super keyDown:event];
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
- (void)keyUp:(NSEvent *)event {
|
|
561
|
+
if ([self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
562
|
+
[super keyUp:event];
|
|
563
|
+
}
|
|
564
|
+
}
|
|
517
565
|
#endif // ]TODO(OSS Candidate ISS#2710739)
|
|
518
566
|
|
|
519
567
|
- (void)_updatePlaceholder
|
|
@@ -42,8 +42,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
42
42
|
- (BOOL)textInputShouldHandleDeleteBackward:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the deleteBackward event handled normally. Return `NO` to disallow it and handle it yourself. TODO(OSS Candidate ISS#2710739)
|
|
43
43
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
44
44
|
- (BOOL)textInputShouldHandleDeleteForward:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the deleteForward event handled normally. Return `NO` to disallow it and handle it yourself.
|
|
45
|
-
|
|
45
|
+
- (BOOL)textInputShouldHandleKeyEvent:(NSEvent *)event; // Return `YES` to have the key event handled normally. Return `NO` to disallow it and handle it yourself.
|
|
46
|
+
- (BOOL)hasValidKeyDownOrValidKeyUp:(NSString *)key;
|
|
47
|
+
- (NSDragOperation)textInputDraggingEntered:(id<NSDraggingInfo>)draggingInfo;
|
|
48
|
+
- (void)textInputDraggingExited:(id<NSDraggingInfo>)draggingInfo;
|
|
49
|
+
- (BOOL)textInputShouldHandleDragOperation:(id<NSDraggingInfo>)draggingInfo;
|
|
46
50
|
- (void)textInputDidCancel; // Handle `Escape` key press.
|
|
51
|
+
- (BOOL)textInputShouldHandlePaste:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the paste event handled normally. Return `NO` to disallow it and handle it yourself.
|
|
47
52
|
#endif // ]TODO(macOS GH#774)
|
|
48
53
|
|
|
49
54
|
@optional
|
|
@@ -213,11 +213,18 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
213
213
|
}
|
|
214
214
|
//paste
|
|
215
215
|
} else if (commandSelector == @selector(paste:)) {
|
|
216
|
-
|
|
216
|
+
id<RCTBackedTextInputDelegate> textInputDelegate = [_backedTextInputView textInputDelegate];
|
|
217
|
+
if (textInputDelegate != nil && ![textInputDelegate textInputShouldHandlePaste:_backedTextInputView]) {
|
|
218
|
+
commandHandled = YES;
|
|
219
|
+
} else {
|
|
220
|
+
_backedTextInputView.textWasPasted = YES;
|
|
221
|
+
}
|
|
217
222
|
//escape
|
|
218
223
|
} else if (commandSelector == @selector(cancelOperation:)) {
|
|
219
224
|
[textInputDelegate textInputDidCancel];
|
|
220
|
-
[
|
|
225
|
+
if (![textInputDelegate hasValidKeyDownOrValidKeyUp:@"Escape"]) {
|
|
226
|
+
[[_backedTextInputView window] makeFirstResponder:nil];
|
|
227
|
+
}
|
|
221
228
|
commandHandled = YES;
|
|
222
229
|
}
|
|
223
230
|
|
|
@@ -421,7 +428,9 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
421
428
|
//escape
|
|
422
429
|
} else if (commandSelector == @selector(cancelOperation:)) {
|
|
423
430
|
[textInputDelegate textInputDidCancel];
|
|
424
|
-
[
|
|
431
|
+
if (![textInputDelegate hasValidKeyDownOrValidKeyUp:@"Escape"]) {
|
|
432
|
+
[[_backedTextInputView window] makeFirstResponder:nil];
|
|
433
|
+
}
|
|
425
434
|
commandHandled = YES;
|
|
426
435
|
|
|
427
436
|
}
|
|
@@ -39,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
39
39
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange;
|
|
40
40
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onSelectionChange;
|
|
41
41
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onChange;
|
|
42
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onPaste; // TODO(OSS Candidate GH#774)
|
|
42
43
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onChangeSync;
|
|
43
44
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput;
|
|
44
45
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
{
|
|
33
33
|
RCTAssertParam(bridge);
|
|
34
34
|
|
|
35
|
-
if (self = [super
|
|
35
|
+
if (self = [super initWithEventDispatcher:bridge.eventDispatcher]) { // TODO(OSS Candidate GH#774)
|
|
36
36
|
_bridge = bridge;
|
|
37
37
|
_eventDispatcher = bridge.eventDispatcher;
|
|
38
38
|
}
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
|
|
43
43
|
RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|
44
44
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder)
|
|
45
|
-
RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
46
45
|
|
|
47
46
|
- (RCTUIView<RCTBackedTextInputViewProtocol> *)backedTextInputView // TODO(macOS ISS#3536887)
|
|
48
47
|
{
|
|
@@ -153,6 +152,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
153
152
|
range:NSMakeRange(0, attributedTextCopy.length)];
|
|
154
153
|
|
|
155
154
|
textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO);
|
|
155
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
156
|
+
// If we are in a language that uses conversion (e.g. Japanese), ignore updates if we have unconverted text.
|
|
157
|
+
if ([self.backedTextInputView hasMarkedText]) {
|
|
158
|
+
textNeedsUpdate = NO;
|
|
159
|
+
}
|
|
160
|
+
#endif // ]TODO(macOS GH#774)
|
|
156
161
|
|
|
157
162
|
if (eventLag == 0 && textNeedsUpdate) {
|
|
158
163
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
@@ -589,6 +594,35 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
589
594
|
return YES;
|
|
590
595
|
}
|
|
591
596
|
|
|
597
|
+
- (BOOL)hasValidKeyDownOrValidKeyUp:(NSString *)key {
|
|
598
|
+
return [self.validKeysDown containsObject:key] || [self.validKeysUp containsObject:key];
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
- (NSDragOperation)textInputDraggingEntered:(id<NSDraggingInfo>)draggingInfo
|
|
602
|
+
{
|
|
603
|
+
if ([draggingInfo.draggingPasteboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
604
|
+
return [self draggingEntered:draggingInfo];
|
|
605
|
+
}
|
|
606
|
+
return NSDragOperationNone;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
- (void)textInputDraggingExited:(id<NSDraggingInfo>)draggingInfo
|
|
610
|
+
{
|
|
611
|
+
if ([draggingInfo.draggingPasteboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
612
|
+
[self draggingExited:draggingInfo];
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
- (BOOL)textInputShouldHandleDragOperation:(id<NSDraggingInfo>)draggingInfo
|
|
617
|
+
{
|
|
618
|
+
if ([draggingInfo.draggingPasteboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
619
|
+
[self performDragOperation:draggingInfo];
|
|
620
|
+
return NO;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
return YES;
|
|
624
|
+
}
|
|
625
|
+
|
|
592
626
|
- (void)textInputDidCancel {
|
|
593
627
|
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeKeyPress
|
|
594
628
|
reactTag:self.reactTag
|
|
@@ -597,6 +631,24 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|
|
597
631
|
eventCount:_nativeEventCount];
|
|
598
632
|
[self textInputDidEndEditing];
|
|
599
633
|
}
|
|
634
|
+
|
|
635
|
+
- (BOOL)textInputShouldHandleKeyEvent:(NSEvent *)event {
|
|
636
|
+
return ![self handleKeyboardEvent:event];
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
- (BOOL)textInputShouldHandlePaste:(__unused id)sender
|
|
640
|
+
{
|
|
641
|
+
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
|
642
|
+
NSPasteboardType fileType = [pasteboard availableTypeFromArray:@[NSFilenamesPboardType, NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
|
|
643
|
+
|
|
644
|
+
// If there's a fileType that is of interest, notify JS. Also blocks notifying JS if it's a text paste
|
|
645
|
+
if (_onPaste && fileType != nil) {
|
|
646
|
+
_onPaste([self dataTransferInfoFromPasteboard:pasteboard]);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// Only allow pasting text.
|
|
650
|
+
return fileType == nil;
|
|
651
|
+
}
|
|
600
652
|
#endif // ]TODO(macOS GH#774)
|
|
601
653
|
|
|
602
654
|
- (void)updateLocalData
|
|
@@ -77,6 +77,7 @@ RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
|
77
77
|
RCT_EXPORT_VIEW_PROPERTY(onKeyPressSync, RCTDirectEventBlock)
|
|
78
78
|
RCT_EXPORT_VIEW_PROPERTY(onChangeSync, RCTDirectEventBlock)
|
|
79
79
|
RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock)
|
|
80
|
+
RCT_EXPORT_VIEW_PROPERTY(onPaste, RCTDirectEventBlock)
|
|
80
81
|
RCT_EXPORT_VIEW_PROPERTY(onTextInput, RCTDirectEventBlock)
|
|
81
82
|
RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock)
|
|
82
83
|
|
|
@@ -127,6 +127,13 @@
|
|
|
127
127
|
#endif // ]TODO(macOS GH#774)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
131
|
+
- (BOOL)hasMarkedText
|
|
132
|
+
{
|
|
133
|
+
return ((NSTextView *)self.currentEditor).hasMarkedText;
|
|
134
|
+
}
|
|
135
|
+
#endif // ]TODO(macOS GH#774)
|
|
136
|
+
|
|
130
137
|
#pragma mark - Accessibility
|
|
131
138
|
|
|
132
139
|
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
@@ -482,6 +489,17 @@
|
|
|
482
489
|
}
|
|
483
490
|
return isFirstResponder;
|
|
484
491
|
}
|
|
492
|
+
|
|
493
|
+
- (BOOL)performKeyEquivalent:(NSEvent *)event
|
|
494
|
+
{
|
|
495
|
+
// The currentEditor is NSText for historical reasons, but documented to be NSTextView.
|
|
496
|
+
NSTextView *currentEditor = (NSTextView *)self.currentEditor;
|
|
497
|
+
// The currentEditor is non-nil when focused and hasMarkedText means an IME is open.
|
|
498
|
+
if (currentEditor && !currentEditor.hasMarkedText && ![self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
499
|
+
return YES; // Don't send currentEditor the keydown event.
|
|
500
|
+
}
|
|
501
|
+
return [super performKeyEquivalent:event];
|
|
502
|
+
}
|
|
485
503
|
#endif // ]TODO(macOS GH#774)
|
|
486
504
|
|
|
487
505
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
@@ -563,6 +581,12 @@
|
|
|
563
581
|
[super deleteBackward];
|
|
564
582
|
}
|
|
565
583
|
}
|
|
584
|
+
#else
|
|
585
|
+
- (void)keyUp:(NSEvent *)event {
|
|
586
|
+
if ([self.textInputDelegate textInputShouldHandleKeyEvent:event]) {
|
|
587
|
+
[super keyUp:event];
|
|
588
|
+
}
|
|
589
|
+
}
|
|
566
590
|
#endif // ]TODO(OSS Candidate ISS#2710739)
|
|
567
591
|
|
|
568
592
|
@end
|
package/React/Base/RCTConvert.m
CHANGED
|
@@ -1234,6 +1234,8 @@ RCT_JSON_ARRAY_CONVERTER(NSNumber)
|
|
|
1234
1234
|
|
|
1235
1235
|
if ([type isEqualToString:@"fileUrl"]) {
|
|
1236
1236
|
return @[NSFilenamesPboardType];
|
|
1237
|
+
} else if ([type isEqualToString:@"image"]) {
|
|
1238
|
+
return @[NSPasteboardTypePNG, NSPasteboardTypeTIFF];
|
|
1237
1239
|
}
|
|
1238
1240
|
|
|
1239
1241
|
return @[];
|
|
@@ -1461,6 +1463,7 @@ RCT_ENUM_CONVERTER(
|
|
|
1461
1463
|
@"list": NSAccessibilityListRole,
|
|
1462
1464
|
@"popupbutton": NSAccessibilityPopUpButtonRole,
|
|
1463
1465
|
@"menubutton": NSAccessibilityMenuButtonRole,
|
|
1466
|
+
@"table": NSAccessibilityTableRole,
|
|
1464
1467
|
};
|
|
1465
1468
|
});
|
|
1466
1469
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -423,6 +423,13 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
// We purposely don't use RCTCursor for the parameter type here because it would introduce an import cycle:
|
|
427
|
+
// RCTUIKit > RCTCursor > RCTConvert > RCTUIKit
|
|
428
|
+
- (void)setCursor:(NSInteger)cursor
|
|
429
|
+
{
|
|
430
|
+
// This method is required to be defined due to [RCTVirtualTextViewManager view] returning a RCTUIView.
|
|
431
|
+
}
|
|
432
|
+
|
|
426
433
|
@end
|
|
427
434
|
|
|
428
435
|
// RCTUIScrollView
|
|
@@ -176,7 +176,7 @@ RCT_EXPORT_MODULE()
|
|
|
176
176
|
{
|
|
177
177
|
if (!_devMenuItem) {
|
|
178
178
|
__weak __typeof__(self) weakSelf = self;
|
|
179
|
-
__weak RCTDevSettings *devSettings = [self
|
|
179
|
+
__weak RCTDevSettings *devSettings = [[self bridge] devSettings]; // TODO(macOS GH#774)
|
|
180
180
|
if (devSettings.isPerfMonitorShown) {
|
|
181
181
|
[weakSelf show];
|
|
182
182
|
}
|
|
@@ -332,12 +332,13 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
|
|
332
332
|
_viewRegistry[reactTag] = rootView;
|
|
333
333
|
|
|
334
334
|
// Register shadow view
|
|
335
|
+
RCTRootShadowView *shadowView = [RCTRootShadowView new]; // TODO(macOS GH#774) - do this early to prevent RCTI18nUtil deadlock
|
|
336
|
+
|
|
335
337
|
RCTExecuteOnUIManagerQueue(^{
|
|
336
338
|
if (!self->_viewRegistry) {
|
|
337
339
|
return;
|
|
338
340
|
}
|
|
339
341
|
|
|
340
|
-
RCTRootShadowView *shadowView = [RCTRootShadowView new];
|
|
341
342
|
shadowView.availableSize = availableSize;
|
|
342
343
|
shadowView.reactTag = reactTag;
|
|
343
344
|
shadowView.viewName = NSStringFromClass([rootView class]);
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
#import "RCTActivityIndicatorView.h"
|
|
9
9
|
|
|
10
10
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
11
|
-
#import <
|
|
11
|
+
#import <CoreImage/CIFilter.h>
|
|
12
|
+
#import <CoreImage/CIVector.h>
|
|
12
13
|
|
|
13
14
|
@interface RCTActivityIndicatorView ()
|
|
14
15
|
@property (nonatomic, readwrite, getter=isAnimating) BOOL animating;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <React/RCTConvert.h>
|
|
9
|
+
|
|
10
|
+
typedef NS_ENUM(NSInteger, RCTCursor) {
|
|
11
|
+
RCTCursorAuto,
|
|
12
|
+
RCTCursorArrow,
|
|
13
|
+
RCTCursorIBeam,
|
|
14
|
+
RCTCursorCrosshair,
|
|
15
|
+
RCTCursorClosedHand,
|
|
16
|
+
RCTCursorOpenHand,
|
|
17
|
+
RCTCursorPointingHand,
|
|
18
|
+
RCTCursorResizeLeft,
|
|
19
|
+
RCTCursorResizeRight,
|
|
20
|
+
RCTCursorResizeLeftRight,
|
|
21
|
+
RCTCursorResizeUp,
|
|
22
|
+
RCTCursorResizeDown,
|
|
23
|
+
RCTCursorResizeUpDown,
|
|
24
|
+
RCTCursorDisappearingItem,
|
|
25
|
+
RCTCursorIBeamCursorForVerticalLayout,
|
|
26
|
+
RCTCursorOperationNotAllowed,
|
|
27
|
+
RCTCursorDragLink,
|
|
28
|
+
RCTCursorDragCopy,
|
|
29
|
+
RCTCursorContextualMenu,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
@interface RCTConvert (RCTCursor)
|
|
33
|
+
|
|
34
|
+
+ (RCTCursor)RCTCursor:(id)json;
|
|
35
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
36
|
+
+ (NSCursor *)NSCursor:(RCTCursor)rctCursor;
|
|
37
|
+
#endif // ]TODO(macOS GH#774)
|
|
38
|
+
|
|
39
|
+
@end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <React/RCTCursor.h>
|
|
9
|
+
|
|
10
|
+
@implementation RCTConvert (RCTCursor)
|
|
11
|
+
|
|
12
|
+
RCT_ENUM_CONVERTER(
|
|
13
|
+
RCTCursor,
|
|
14
|
+
(@{
|
|
15
|
+
@"alias" : @(RCTCursorDragLink),
|
|
16
|
+
@"auto" : @(RCTCursorAuto),
|
|
17
|
+
@"col-resize" : @(RCTCursorResizeLeftRight),
|
|
18
|
+
@"context-menu" : @(RCTCursorContextualMenu),
|
|
19
|
+
@"copy" : @(RCTCursorDragCopy),
|
|
20
|
+
@"crosshair" : @(RCTCursorCrosshair),
|
|
21
|
+
@"default" : @(RCTCursorArrow),
|
|
22
|
+
@"disappearing-item" : @(RCTCursorDisappearingItem),
|
|
23
|
+
@"e-resize" : @(RCTCursorResizeRight),
|
|
24
|
+
@"grab" : @(RCTCursorOpenHand),
|
|
25
|
+
@"grabbing" : @(RCTCursorClosedHand),
|
|
26
|
+
@"n-resize" : @(RCTCursorResizeUp),
|
|
27
|
+
@"no-drop" : @(RCTCursorOperationNotAllowed),
|
|
28
|
+
@"not-allowed" : @(RCTCursorOperationNotAllowed),
|
|
29
|
+
@"pointer" : @(RCTCursorPointingHand),
|
|
30
|
+
@"row-resize" : @(RCTCursorResizeUpDown),
|
|
31
|
+
@"s-resize" : @(RCTCursorResizeDown),
|
|
32
|
+
@"text" : @(RCTCursorIBeam),
|
|
33
|
+
@"vertical-text" : @(RCTCursorIBeamCursorForVerticalLayout),
|
|
34
|
+
@"w-resize" : @(RCTCursorResizeLeft),
|
|
35
|
+
}),
|
|
36
|
+
RCTCursorAuto,
|
|
37
|
+
integerValue)
|
|
38
|
+
|
|
39
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
40
|
+
+ (NSCursor *)NSCursor:(RCTCursor)rctCursor
|
|
41
|
+
{
|
|
42
|
+
NSCursor *cursor;
|
|
43
|
+
|
|
44
|
+
switch (rctCursor) {
|
|
45
|
+
case RCTCursorArrow:
|
|
46
|
+
cursor = [NSCursor arrowCursor];
|
|
47
|
+
break;
|
|
48
|
+
case RCTCursorClosedHand:
|
|
49
|
+
cursor = [NSCursor closedHandCursor];
|
|
50
|
+
break;
|
|
51
|
+
case RCTCursorContextualMenu:
|
|
52
|
+
cursor = [NSCursor contextualMenuCursor];
|
|
53
|
+
break;
|
|
54
|
+
case RCTCursorCrosshair:
|
|
55
|
+
cursor = [NSCursor crosshairCursor];
|
|
56
|
+
break;
|
|
57
|
+
case RCTCursorDisappearingItem:
|
|
58
|
+
cursor = [NSCursor disappearingItemCursor];
|
|
59
|
+
break;
|
|
60
|
+
case RCTCursorDragCopy:
|
|
61
|
+
cursor = [NSCursor dragCopyCursor];
|
|
62
|
+
break;
|
|
63
|
+
case RCTCursorDragLink:
|
|
64
|
+
cursor = [NSCursor dragLinkCursor];
|
|
65
|
+
break;
|
|
66
|
+
case RCTCursorIBeam:
|
|
67
|
+
cursor = [NSCursor IBeamCursor];
|
|
68
|
+
break;
|
|
69
|
+
case RCTCursorIBeamCursorForVerticalLayout:
|
|
70
|
+
cursor = [NSCursor IBeamCursorForVerticalLayout];
|
|
71
|
+
break;
|
|
72
|
+
case RCTCursorOpenHand:
|
|
73
|
+
cursor = [NSCursor openHandCursor];
|
|
74
|
+
break;
|
|
75
|
+
case RCTCursorOperationNotAllowed:
|
|
76
|
+
cursor = [NSCursor operationNotAllowedCursor];
|
|
77
|
+
break;
|
|
78
|
+
case RCTCursorPointingHand:
|
|
79
|
+
cursor = [NSCursor pointingHandCursor];
|
|
80
|
+
break;
|
|
81
|
+
case RCTCursorResizeDown:
|
|
82
|
+
cursor = [NSCursor resizeDownCursor];
|
|
83
|
+
break;
|
|
84
|
+
case RCTCursorResizeLeft:
|
|
85
|
+
cursor = [NSCursor resizeLeftCursor];
|
|
86
|
+
break;
|
|
87
|
+
case RCTCursorResizeLeftRight:
|
|
88
|
+
cursor = [NSCursor resizeLeftRightCursor];
|
|
89
|
+
break;
|
|
90
|
+
case RCTCursorResizeRight:
|
|
91
|
+
cursor = [NSCursor resizeRightCursor];
|
|
92
|
+
break;
|
|
93
|
+
case RCTCursorResizeUp:
|
|
94
|
+
cursor = [NSCursor resizeUpCursor];
|
|
95
|
+
break;
|
|
96
|
+
case RCTCursorResizeUpDown:
|
|
97
|
+
cursor = [NSCursor resizeUpDownCursor];
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return cursor;
|
|
102
|
+
}
|
|
103
|
+
#endif // ]TODO(macOS GH#774)
|
|
104
|
+
|
|
105
|
+
@end
|
package/React/Views/RCTView.h
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
#import <React/RCTEventDispatcherProtocol.h> // TODO(OSS Candidate ISS#2710739)
|
|
13
13
|
#import <React/RCTPointerEvents.h>
|
|
14
14
|
|
|
15
|
+
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
16
|
+
#import <React/RCTCursor.h>
|
|
17
|
+
#endif // TODO(macOS GH#774)
|
|
18
|
+
|
|
15
19
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
16
20
|
extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
17
21
|
#endif // TODO(macOS GH#774)
|
|
@@ -27,6 +31,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
27
31
|
- (BOOL)resignFirstResponder;
|
|
28
32
|
|
|
29
33
|
#if TARGET_OS_OSX
|
|
34
|
+
- (NSDictionary*)dataTransferInfoFromPasteboard:(NSPasteboard*)pasteboard;
|
|
30
35
|
- (BOOL)handleKeyboardEvent:(NSEvent *)event;
|
|
31
36
|
#endif
|
|
32
37
|
// ]TODO(OSS Candidate ISS#2710739)
|
|
@@ -123,6 +128,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
123
128
|
/**
|
|
124
129
|
* macOS Properties
|
|
125
130
|
*/
|
|
131
|
+
@property (nonatomic, assign) RCTCursor cursor;
|
|
126
132
|
|
|
127
133
|
@property (nonatomic, assign) CATransform3D transform3D;
|
|
128
134
|
|
|
@@ -139,6 +145,12 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
139
145
|
@property (nonatomic, copy) RCTDirectEventBlock onKeyUp;
|
|
140
146
|
@property (nonatomic, copy) NSArray<NSString*> *validKeysDown;
|
|
141
147
|
@property (nonatomic, copy) NSArray<NSString*> *validKeysUp;
|
|
148
|
+
|
|
149
|
+
// Shadow Properties
|
|
150
|
+
@property (nonatomic, strong) NSColor *shadowColor;
|
|
151
|
+
@property (nonatomic, assign) CGFloat shadowOpacity;
|
|
152
|
+
@property (nonatomic, assign) CGFloat shadowRadius;
|
|
153
|
+
@property (nonatomic, assign) CGSize shadowOffset;
|
|
142
154
|
#endif // ]TODO(macOS GH#774)
|
|
143
155
|
|
|
144
156
|
/**
|