react-native-macos 0.0.0-90bb91ab0 → 0.0.0-9421f1a5d
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/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.js +8 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Text/RCTTextAttributes.m +15 -8
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +10 -0
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +1 -4
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +3 -2
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +4 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.h +2 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +24 -1
- package/React/Base/RCTRootView.m +0 -42
- package/React/Base/RCTTouchHandler.m +11 -1
- package/React/Base/RCTUIKit.h +2 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTPlatformDisplayLink.m +3 -1
- package/React/Base/macOS/RCTUIKit.m +13 -0
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/Modules/RCTUIManager.m +25 -12
- package/React/Views/RCTView.m +3 -0
- 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/template/Gemfile.lock +1 -1
- package/template/package.json +1 -1
|
@@ -303,6 +303,14 @@ type IOSProps = $ReadOnly<{|
|
|
|
303
303
|
*/
|
|
304
304
|
scrollEnabled?: ?boolean,
|
|
305
305
|
|
|
306
|
+
// [TODO(macOS GH#774)
|
|
307
|
+
/**
|
|
308
|
+
* If `false`, disables grammar-check.
|
|
309
|
+
* @platform macOS
|
|
310
|
+
*/
|
|
311
|
+
grammarCheck?: ?boolean,
|
|
312
|
+
// ]TODO(macOS GH#774)
|
|
313
|
+
|
|
306
314
|
/**
|
|
307
315
|
* If `false`, disables spell-check style (i.e. red underlines).
|
|
308
316
|
* The default value is inherited from `autoCorrect`.
|
|
@@ -17,6 +17,17 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
17
17
|
|
|
18
18
|
@implementation RCTTextAttributes
|
|
19
19
|
|
|
20
|
+
// [TODO(macOS GH#774)
|
|
21
|
+
+ (RCTUIColor *)defaultForegroundColor
|
|
22
|
+
{
|
|
23
|
+
if (@available(iOS 13.0, *)) {
|
|
24
|
+
return [RCTUIColor labelColor];
|
|
25
|
+
} else {
|
|
26
|
+
return [RCTUIColor blackColor];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// ]TODO(macOS GH#774)
|
|
30
|
+
|
|
20
31
|
- (instancetype)init
|
|
21
32
|
{
|
|
22
33
|
if (self = [super init]) {
|
|
@@ -31,13 +42,9 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
31
42
|
_textShadowRadius = NAN;
|
|
32
43
|
_opacity = NAN;
|
|
33
44
|
_textTransform = RCTTextTransformUndefined;
|
|
34
|
-
// [TODO(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} else {
|
|
38
|
-
_foregroundColor = [RCTUIColor blackColor];
|
|
39
|
-
}
|
|
40
|
-
// ]TODO(OSS Candidate ISS#2710739)
|
|
45
|
+
// [TODO(macOS GH#774)
|
|
46
|
+
_foregroundColor = [RCTTextAttributes defaultForegroundColor];
|
|
47
|
+
// ]TODO(macOS GH#774)
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
return self;
|
|
@@ -50,7 +57,7 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
|
|
|
50
57
|
// We will address this in the future.
|
|
51
58
|
|
|
52
59
|
// Color
|
|
53
|
-
_foregroundColor = textAttributes->_foregroundColor
|
|
60
|
+
_foregroundColor = textAttributes->_foregroundColor == [RCTTextAttributes defaultForegroundColor] ? _foregroundColor : textAttributes->_foregroundColor;
|
|
54
61
|
_backgroundColor = textAttributes->_backgroundColor ?: _backgroundColor;
|
|
55
62
|
_opacity = !isnan(textAttributes->_opacity) ? (isnan(_opacity) ? 1.0 : _opacity) * textAttributes->_opacity : _opacity;
|
|
56
63
|
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
#else // [TODO(macOS GH#774)
|
|
49
49
|
_scrollView.documentView = _backedTextInputView;
|
|
50
50
|
_scrollView.contentView.postsBoundsChangedNotifications = YES;
|
|
51
|
+
// Enable focus ring by default
|
|
52
|
+
_scrollView.enableFocusRing = YES;
|
|
51
53
|
[self addSubview:_scrollView];
|
|
52
54
|
|
|
53
55
|
// a register for those notifications on the content view.
|
|
@@ -89,6 +91,14 @@
|
|
|
89
91
|
_scrollView.frame = UIEdgeInsetsInsetRect(self.bounds, reactBorderInsets);
|
|
90
92
|
[self setNeedsLayout];
|
|
91
93
|
}
|
|
94
|
+
|
|
95
|
+
- (void)setEnableFocusRing:(BOOL)enableFocusRing {
|
|
96
|
+
[super setEnableFocusRing:enableFocusRing];
|
|
97
|
+
if ([_scrollView respondsToSelector:@selector(setEnableFocusRing:)]) {
|
|
98
|
+
[_scrollView setEnableFocusRing:enableFocusRing];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
92
102
|
#endif // ]TODO(macOS GH#774)
|
|
93
103
|
|
|
94
104
|
#pragma mark - UIScrollViewDelegate
|
|
@@ -46,9 +46,6 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
46
46
|
_placeholderView.numberOfLines = 0;
|
|
47
47
|
[self addSubview:_placeholderView];
|
|
48
48
|
#else // [TODO(macOS GH#774)
|
|
49
|
-
NSTextCheckingTypes checkingTypes = 0;
|
|
50
|
-
self.enabledTextCheckingTypes = checkingTypes;
|
|
51
|
-
self.insertionPointColor = [NSColor selectedControlColor];
|
|
52
49
|
// Fix blurry text on non-retina displays.
|
|
53
50
|
self.canDrawSubviewsIntoLayer = YES;
|
|
54
51
|
self.allowsUndo = YES;
|
|
@@ -133,7 +130,7 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
|
|
|
133
130
|
NSMutableDictionary *selectTextAttributes = self.selectedTextAttributes.mutableCopy;
|
|
134
131
|
selectTextAttributes[NSBackgroundColorAttributeName] = selectionColor ?: [NSColor selectedControlColor];
|
|
135
132
|
self.selectedTextAttributes = selectTextAttributes.copy;
|
|
136
|
-
self.insertionPointColor = self.selectionColor ?: [NSColor
|
|
133
|
+
self.insertionPointColor = self.selectionColor ?: [NSColor textColor];
|
|
137
134
|
}
|
|
138
135
|
|
|
139
136
|
- (RCTUIColor*)selectionColor
|
|
@@ -38,7 +38,7 @@ RCT_EXPORT_MODULE()
|
|
|
38
38
|
|
|
39
39
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType) // TODO(macOS GH#774)
|
|
40
40
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType) // TODO(macOS GH#774)
|
|
41
|
-
RCT_REMAP_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.
|
|
41
|
+
RCT_REMAP_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.automaticSpellingCorrectionEnabled, BOOL) // TODO(macOS GH#774)
|
|
42
42
|
RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL)
|
|
43
43
|
RCT_REMAP_VIEW_PROPERTY(editable, backedTextInputView.editable, BOOL)
|
|
44
44
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL) // TODO(macOS GH#774)
|
|
@@ -48,8 +48,9 @@ RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderCol
|
|
|
48
48
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType) // TODO(macOS GH#774)
|
|
49
49
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor) // TODO(macOS GH#774)
|
|
50
50
|
RCT_REMAP_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.selectionColor, UIColor) // TODO(macOS GH#774)
|
|
51
|
+
RCT_REMAP_OSX_VIEW_PROPERTY(grammarCheck, backedTextInputView.grammarCheckingEnabled, BOOL) // TODO(macOS GH#774)
|
|
51
52
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType) // TODO(macOS GH#774)
|
|
52
|
-
RCT_REMAP_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.
|
|
53
|
+
RCT_REMAP_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.continuousSpellCheckingEnabled, BOOL) // TODO(macOS GH#774)
|
|
53
54
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL) // TODO(macOS GH#774)
|
|
54
55
|
RCT_REMAP_NOT_OSX_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode) // TODO(macOS GH#774)
|
|
55
56
|
RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL)
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
|
|
29
29
|
_backedTextInputView = [[RCTUITextField alloc] initWithFrame:self.bounds];
|
|
30
30
|
_backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
31
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
32
|
+
_backedTextInputView.cell.scrollable = YES;
|
|
33
|
+
_backedTextInputView.cell.usesSingleLineMode = YES;
|
|
34
|
+
#endif // ]TODO(macOS GH#774)
|
|
31
35
|
_backedTextInputView.textInputDelegate = self;
|
|
32
36
|
|
|
33
37
|
[self addSubview:_backedTextInputView];
|
|
@@ -54,6 +54,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
54
54
|
@property (nonatomic, assign) NSTextAlignment textAlignment;
|
|
55
55
|
@property (nonatomic, getter=isAutomaticTextReplacementEnabled) BOOL automaticTextReplacementEnabled;
|
|
56
56
|
@property (nonatomic, getter=isAutomaticSpellingCorrectionEnabled) BOOL automaticSpellingCorrectionEnabled;
|
|
57
|
+
@property (nonatomic, getter=isContinuousSpellCheckingEnabled) BOOL continuousSpellCheckingEnabled;
|
|
58
|
+
@property (nonatomic, getter=isGrammarCheckingEnabled) BOOL grammarCheckingEnabled;
|
|
57
59
|
@property (nonatomic, assign) BOOL enableFocusRing;
|
|
58
60
|
@property (nonatomic, strong, nullable) RCTUIColor *selectionColor;
|
|
59
61
|
@property (weak, nullable) id<RCTUITextFieldDelegate> delegate;
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
@property (nonatomic, assign) UIEdgeInsets textContainerInset;
|
|
27
27
|
@property (nonatomic, getter=isAutomaticTextReplacementEnabled) BOOL automaticTextReplacementEnabled;
|
|
28
28
|
@property (nonatomic, getter=isAutomaticSpellingCorrectionEnabled) BOOL automaticSpellingCorrectionEnabled;
|
|
29
|
+
@property (nonatomic, getter=isContinuousSpellCheckingEnabled) BOOL continuousSpellCheckingEnabled;
|
|
30
|
+
@property (nonatomic, getter=isGrammarCheckingEnabled) BOOL grammarCheckingEnabled;
|
|
29
31
|
@property (nonatomic, strong, nullable) RCTUIColor *selectionColor;
|
|
30
32
|
|
|
31
33
|
@end
|
|
@@ -70,10 +72,11 @@
|
|
|
70
72
|
NSTextView *fieldEditor = (NSTextView *)[super setUpFieldEditorAttributes:textObj];
|
|
71
73
|
fieldEditor.automaticSpellingCorrectionEnabled = self.isAutomaticSpellingCorrectionEnabled;
|
|
72
74
|
fieldEditor.automaticTextReplacementEnabled = self.isAutomaticTextReplacementEnabled;
|
|
75
|
+
fieldEditor.continuousSpellCheckingEnabled = self.isContinuousSpellCheckingEnabled;
|
|
76
|
+
fieldEditor.grammarCheckingEnabled = self.isGrammarCheckingEnabled;
|
|
73
77
|
NSMutableDictionary *selectTextAttributes = fieldEditor.selectedTextAttributes.mutableCopy;
|
|
74
78
|
selectTextAttributes[NSBackgroundColorAttributeName] = self.selectionColor ?: [NSColor selectedControlColor];
|
|
75
79
|
fieldEditor.selectedTextAttributes = selectTextAttributes;
|
|
76
|
-
fieldEditor.insertionPointColor = self.selectionColor ?: [RCTUIColor selectedControlColor];
|
|
77
80
|
return fieldEditor;
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -196,6 +199,26 @@
|
|
|
196
199
|
return ((RCTUITextFieldCell*)self.cell).isAutomaticSpellingCorrectionEnabled;
|
|
197
200
|
}
|
|
198
201
|
|
|
202
|
+
- (void)setContinuousSpellCheckingEnabled:(BOOL)continuousSpellCheckingEnabled
|
|
203
|
+
{
|
|
204
|
+
((RCTUITextFieldCell*)self.cell).continuousSpellCheckingEnabled = continuousSpellCheckingEnabled;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
- (BOOL)isContinuousSpellCheckingEnabled
|
|
208
|
+
{
|
|
209
|
+
return ((RCTUITextFieldCell*)self.cell).isContinuousSpellCheckingEnabled;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
- (void)setGrammarCheckingEnabled:(BOOL)grammarCheckingEnabled
|
|
213
|
+
{
|
|
214
|
+
((RCTUITextFieldCell*)self.cell).grammarCheckingEnabled = grammarCheckingEnabled;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
- (BOOL)isGrammarCheckingEnabled
|
|
218
|
+
{
|
|
219
|
+
return ((RCTUITextFieldCell*)self.cell).isGrammarCheckingEnabled;
|
|
220
|
+
}
|
|
221
|
+
|
|
199
222
|
- (void)setSelectionColor:(RCTUIColor *)selectionColor // TODO(OSS Candidate ISS#2710739)
|
|
200
223
|
{
|
|
201
224
|
((RCTUITextFieldCell*)self.cell).selectionColor = selectionColor;
|
package/React/Base/RCTRootView.m
CHANGED
|
@@ -33,10 +33,6 @@
|
|
|
33
33
|
#import "RCTDevMenu.h"
|
|
34
34
|
#endif // ]TODO(OSS Candidate ISS#2710739)
|
|
35
35
|
|
|
36
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
37
|
-
#define RCT_LAYOUT_THROTTLE 0.25
|
|
38
|
-
#endif // ]TODO(macOS GH#774)
|
|
39
|
-
|
|
40
36
|
NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification";
|
|
41
37
|
|
|
42
38
|
@interface RCTUIManager (RCTRootView)
|
|
@@ -51,11 +47,6 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
|
|
|
51
47
|
RCTRootContentView *_contentView;
|
|
52
48
|
BOOL _passThroughTouches;
|
|
53
49
|
CGSize _intrinsicContentSize;
|
|
54
|
-
|
|
55
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
56
|
-
NSDate *_lastLayout;
|
|
57
|
-
BOOL _throttleLayout;
|
|
58
|
-
#endif // ]TODO(macOS GH#774)
|
|
59
50
|
}
|
|
60
51
|
|
|
61
52
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
@@ -85,10 +76,6 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
|
|
|
85
76
|
_sizeFlexibility = RCTRootViewSizeFlexibilityNone;
|
|
86
77
|
_minimumSize = CGSizeZero;
|
|
87
78
|
|
|
88
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
89
|
-
_lastLayout = [NSDate new];
|
|
90
|
-
#endif // ]TODO(macOS GH#774)
|
|
91
|
-
|
|
92
79
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
93
80
|
selector:@selector(bridgeDidReload)
|
|
94
81
|
name:RCTJavaScriptWillStartLoadingNotification
|
|
@@ -182,35 +169,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
|
|
182
169
|
return fitSize;
|
|
183
170
|
}
|
|
184
171
|
|
|
185
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
186
|
-
// TODO: https://github.com/microsoft/react-native-macos/issues/459
|
|
187
|
-
// This is a workaround for window resizing events overloading the shadow queue:
|
|
188
|
-
// - https://github.com/microsoft/react-native-macos/issues/322
|
|
189
|
-
// - https://github.com/microsoft/react-native-macos/issues/422
|
|
190
|
-
// We should revisit this issue when we switch over to Fabric.
|
|
191
|
-
- (void)layout
|
|
192
|
-
{
|
|
193
|
-
if (self.window != nil && !_throttleLayout) {
|
|
194
|
-
NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:_lastLayout];
|
|
195
|
-
if (interval >= RCT_LAYOUT_THROTTLE) {
|
|
196
|
-
_lastLayout = [NSDate new];
|
|
197
|
-
[self layoutSubviews];
|
|
198
|
-
} else {
|
|
199
|
-
_throttleLayout = YES;
|
|
200
|
-
__weak typeof(self) weakSelf = self;
|
|
201
|
-
int64_t delta = (RCT_LAYOUT_THROTTLE - interval) * NSEC_PER_SEC;
|
|
202
|
-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delta), dispatch_get_main_queue(), ^{
|
|
203
|
-
typeof(self) strongSelf = weakSelf;
|
|
204
|
-
if (strongSelf != nil) {
|
|
205
|
-
strongSelf->_throttleLayout = NO;
|
|
206
|
-
[strongSelf setNeedsLayout];
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
#endif // ]TODO(macOS GH#774)
|
|
213
|
-
|
|
214
172
|
- (void)layoutSubviews
|
|
215
173
|
{
|
|
216
174
|
[super layoutSubviews];
|
|
@@ -129,6 +129,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
|
|
|
129
129
|
// The assumption here is that a RCTUIView/RCTSurfaceView will always have a superview.
|
|
130
130
|
CGPoint touchLocation = [self.view.superview convertPoint:touch.locationInWindow fromView:nil];
|
|
131
131
|
NSView *targetView = [self.view hitTest:touchLocation];
|
|
132
|
+
// Don't record clicks on scrollbars.
|
|
133
|
+
if ([targetView isKindOfClass:[NSScroller class]]) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
132
136
|
// Pair the mouse down events with mouse up events so our _nativeTouches cache doesn't get stale
|
|
133
137
|
if ([targetView isKindOfClass:[NSControl class]]) {
|
|
134
138
|
_shouldSendMouseUpOnSystemBehalf = [(NSControl*)targetView isEnabled];
|
|
@@ -221,7 +225,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
|
|
|
221
225
|
NSEvent *nativeTouch = _nativeTouches[touchIndex];
|
|
222
226
|
CGPoint location = nativeTouch.locationInWindow;
|
|
223
227
|
CGPoint rootViewLocation = CGPointMake(location.x, CGRectGetHeight(self.view.window.frame) - location.y);
|
|
224
|
-
|
|
228
|
+
NSView *touchView = _touchViews[touchIndex];
|
|
229
|
+
CGPoint touchViewLocation = [touchView convertPoint:location fromView:nil];
|
|
225
230
|
#endif // ]TODO(macOS GH#774)
|
|
226
231
|
|
|
227
232
|
NSMutableDictionary *reactTouch = _reactTouches[touchIndex];
|
|
@@ -394,6 +399,11 @@ static BOOL RCTAnyTouchesChanged(NSSet *touches) // [TODO(macOS GH#774)
|
|
|
394
399
|
// "end"/"cancel" needs to remove the touch *after* extracting the event.
|
|
395
400
|
[self _recordNewTouches:touches];
|
|
396
401
|
|
|
402
|
+
// [TODO(macOS GH#774) - Filter out touches that were ignored.
|
|
403
|
+
touches = [touches objectsPassingTest:^(id touch, BOOL *stop) {
|
|
404
|
+
return [_nativeTouches containsObject:touch];
|
|
405
|
+
}]; // ]TODO(macOS GH#774)
|
|
406
|
+
|
|
397
407
|
[self _updateAndDispatchTouches:touches eventName:@"touchStart"];
|
|
398
408
|
|
|
399
409
|
if (self.state == UIGestureRecognizerStatePossible) {
|
package/React/Base/RCTUIKit.h
CHANGED
|
@@ -425,6 +425,8 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
|
|
|
425
425
|
@property (nonatomic, assign) CGFloat zoomScale;
|
|
426
426
|
@property (nonatomic, assign) BOOL alwaysBounceHorizontal;
|
|
427
427
|
@property (nonatomic, assign) BOOL alwaysBounceVertical;
|
|
428
|
+
// macOS specific properties
|
|
429
|
+
@property (nonatomic, assign) BOOL enableFocusRing;
|
|
428
430
|
|
|
429
431
|
@end
|
|
430
432
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -51,7 +51,9 @@ static CVReturn RCTPlatformDisplayLinkCallBack(__unused CVDisplayLinkRef display
|
|
|
51
51
|
if (rctDisplayLink->_runLoop != nil) {
|
|
52
52
|
CFRunLoopRef cfRunLoop = [rctDisplayLink->_runLoop getCFRunLoop];
|
|
53
53
|
CFRunLoopPerformBlock(cfRunLoop, (__bridge CFArrayRef)rctDisplayLink->_modes, ^{
|
|
54
|
-
|
|
54
|
+
@autoreleasepool {
|
|
55
|
+
[rctDisplayLink tick];
|
|
56
|
+
}
|
|
55
57
|
});
|
|
56
58
|
CFRunLoopWakeUp(cfRunLoop);
|
|
57
59
|
}
|
|
@@ -429,6 +429,19 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
|
|
|
429
429
|
|
|
430
430
|
@implementation RCTUIScrollView // TODO(macOS ISS#3536887)
|
|
431
431
|
|
|
432
|
+
- (void)setEnableFocusRing:(BOOL)enableFocusRing {
|
|
433
|
+
if (_enableFocusRing != enableFocusRing) {
|
|
434
|
+
_enableFocusRing = enableFocusRing;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (enableFocusRing) {
|
|
438
|
+
// NSTextView has no focus ring by default so let's use the standard Aqua focus ring.
|
|
439
|
+
[self setFocusRingType:NSFocusRingTypeExterior];
|
|
440
|
+
} else {
|
|
441
|
+
[self setFocusRingType:NSFocusRingTypeNone];
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
432
445
|
// UIScrollView properties missing from NSScrollView
|
|
433
446
|
- (CGPoint)contentOffset
|
|
434
447
|
{
|
|
@@ -226,7 +226,7 @@ RCT_EXPORT_METHOD(hide)
|
|
|
226
226
|
[NSAnimationContext runAnimationGroup:^(__unused NSAnimationContext *context) {
|
|
227
227
|
self->_window.animator.alphaValue = 0.0;
|
|
228
228
|
} completionHandler:^{
|
|
229
|
-
[self->_window
|
|
229
|
+
[self->_window close];
|
|
230
230
|
self->_window = nil;
|
|
231
231
|
}];
|
|
232
232
|
});
|
|
@@ -412,21 +412,34 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
|
|
412
412
|
- (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView // TODO(macOS ISS#3536887)
|
|
413
413
|
{
|
|
414
414
|
RCTAssertMainQueue();
|
|
415
|
-
[self
|
|
416
|
-
_executeBlockWithShadowView:^(RCTShadowView *shadowView) {
|
|
417
|
-
RCTAssert(
|
|
418
|
-
[shadowView isKindOfClass:[RCTRootShadowView class]], @"Located shadow view is actually not root view.");
|
|
419
415
|
|
|
420
|
-
|
|
416
|
+
void (^block)(RCTShadowView *) = ^(RCTShadowView *shadowView) {
|
|
417
|
+
RCTAssert(
|
|
418
|
+
[shadowView isKindOfClass:[RCTRootShadowView class]], @"Located shadow view is actually not root view.");
|
|
421
419
|
|
|
422
|
-
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
420
|
+
RCTRootShadowView *rootShadowView = (RCTRootShadowView *)shadowView;
|
|
425
421
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
422
|
+
if (CGSizeEqualToSize(availableSize, rootShadowView.availableSize)) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
rootShadowView.availableSize = availableSize;
|
|
427
|
+
[self setNeedsLayout];
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#744)
|
|
431
|
+
if (rootView.inLiveResize) {
|
|
432
|
+
NSNumber* tag = rootView.reactTag;
|
|
433
|
+
// Synchronously relayout to prevent "tearing" when resizing windows.
|
|
434
|
+
// Still run block asynchronously below so it "wins" after any in-flight layout.
|
|
435
|
+
RCTUnsafeExecuteOnUIManagerQueueSync(^{
|
|
436
|
+
RCTShadowView *shadowView = self->_shadowViewRegistry[tag];
|
|
437
|
+
block(shadowView);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
#endif // ]TODO(macOS GH#744)
|
|
441
|
+
|
|
442
|
+
[self _executeBlockWithShadowView:block forTag:rootView.reactTag];
|
|
430
443
|
}
|
|
431
444
|
|
|
432
445
|
- (void)setLocalData:(NSObject *)localData forView:(RCTUIView *)view // TODO(macOS ISS#3536887)
|
package/React/Views/RCTView.m
CHANGED
|
@@ -1596,6 +1596,9 @@ NSString* const downArrowPressKey = @"ArrowDown";
|
|
|
1596
1596
|
BOOL tabKeyPressed = NO;
|
|
1597
1597
|
BOOL escapeKeyPressed = NO;
|
|
1598
1598
|
NSString *key = event.charactersIgnoringModifiers;
|
|
1599
|
+
if ([key length] == 0) {
|
|
1600
|
+
return nil;
|
|
1601
|
+
}
|
|
1599
1602
|
unichar const code = [key characterAtIndex:0];
|
|
1600
1603
|
|
|
1601
1604
|
// detect arrow key presses
|
package/package.json
CHANGED
package/template/Gemfile.lock
CHANGED