react-native-macos 0.81.6 → 0.81.7
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/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.js +2 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +8 -0
- package/Libraries/Pressability/Pressability.js +38 -4
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.mm +1 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +5 -2
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.h +0 -4
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +3 -20
- package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h +5 -3
- package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.mm +83 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +27 -21
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +38 -2
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +61 -2
- package/React/Fabric/RCTSurfacePointerHandler.mm +6 -2
- package/React/Views/RCTView.h +1 -0
- package/React/Views/RCTViewManager.m +1 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/react/renderer/components/switch/iosswitch/react/renderer/components/switch/IOSSwitchShadowNode.mm +5 -0
- package/ReactCommon/react/renderer/components/switch/iosswitch/react/renderer/components/switch/MacOSSwitchShadowNode.mm +5 -0
- package/ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp +4 -0
- package/ReactCommon/react/renderer/components/view/TouchEventEmitter.h +1 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +16 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewEventEmitter.h +2 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewEvents.h +6 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewProps.cpp +2 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/MouseEvent.h +8 -0
- package/ReactCommon/react/renderer/components/view/primitives.h +2 -0
- package/ReactCommon/react/renderer/components/view/propsConversions.h +4 -0
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.h +2 -0
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +11 -0
- package/package.json +26 -5
- package/react-native.config.js +0 -5
- package/sdks/hermes-engine/utils/build-apple-framework.sh +2 -1
- package/sdks/hermes-engine/utils/build-ios-framework.sh +8 -3
- package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m +0 -14
|
@@ -135,6 +135,8 @@ type MouseEventProps = $ReadOnly<{
|
|
|
135
135
|
|
|
136
136
|
// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
|
|
137
137
|
type PointerEventProps = $ReadOnly<{
|
|
138
|
+
onAuxClick?: ?(event: PointerEvent) => void,
|
|
139
|
+
onAuxClickCapture?: ?(event: PointerEvent) => void,
|
|
138
140
|
onClick?: ?(event: PointerEvent) => void,
|
|
139
141
|
onClickCapture?: ?(event: PointerEvent) => void,
|
|
140
142
|
onPointerEnter?: ?(event: PointerEvent) => void,
|
|
@@ -89,6 +89,12 @@ const bubblingEventTypes = {
|
|
|
89
89
|
},
|
|
90
90
|
|
|
91
91
|
// Experimental/Work in Progress Pointer Events (not yet ready for use)
|
|
92
|
+
topAuxClick: {
|
|
93
|
+
phasedRegistrationNames: {
|
|
94
|
+
captured: 'onAuxClickCapture',
|
|
95
|
+
bubbled: 'onAuxClick',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
92
98
|
topClick: {
|
|
93
99
|
phasedRegistrationNames: {
|
|
94
100
|
captured: 'onClickCapture',
|
|
@@ -394,6 +400,8 @@ const validAttributesForEventProps = ConditionallyIgnoredEventHandlers({
|
|
|
394
400
|
onTouchCancel: true,
|
|
395
401
|
|
|
396
402
|
// Pointer events
|
|
403
|
+
onAuxClick: true,
|
|
404
|
+
onAuxClickCapture: true,
|
|
397
405
|
onClick: true,
|
|
398
406
|
onClickCapture: true,
|
|
399
407
|
onPointerUp: true,
|
|
@@ -410,6 +410,16 @@ export default class Pressability {
|
|
|
410
410
|
_touchActivateTime: ?number;
|
|
411
411
|
_touchState: TouchState = 'NOT_RESPONDER';
|
|
412
412
|
|
|
413
|
+
// [macOS
|
|
414
|
+
/**
|
|
415
|
+
* Returns true if the button from a press event is the default (primary/left)
|
|
416
|
+
* button. A button value of 0 or undefined is considered the default button.
|
|
417
|
+
*/
|
|
418
|
+
_isDefaultPressButton(button: ?number): boolean {
|
|
419
|
+
return !button;
|
|
420
|
+
}
|
|
421
|
+
// macOS]
|
|
422
|
+
|
|
413
423
|
constructor(config: PressabilityConfig) {
|
|
414
424
|
this.configure(config);
|
|
415
425
|
}
|
|
@@ -554,6 +564,13 @@ export default class Pressability {
|
|
|
554
564
|
return;
|
|
555
565
|
}
|
|
556
566
|
|
|
567
|
+
// [macOS Only fire onPress for primary (left) mouse button clicks.
|
|
568
|
+
// Non-primary buttons (right, middle) should not trigger onPress.
|
|
569
|
+
if (!this._isDefaultPressButton(event?.nativeEvent?.button)) {
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
// macOS]
|
|
573
|
+
|
|
557
574
|
// for non-pointer click events (e.g. accessibility clicks), we should only dispatch when we're the "real" target
|
|
558
575
|
// in particular, we shouldn't respond to clicks from nested pressables
|
|
559
576
|
if (event?.currentTarget !== event?.target) {
|
|
@@ -791,7 +808,12 @@ export default class Pressability {
|
|
|
791
808
|
|
|
792
809
|
if (isPressInSignal(prevState) && signal === 'LONG_PRESS_DETECTED') {
|
|
793
810
|
const {onLongPress} = this._config;
|
|
794
|
-
if (
|
|
811
|
+
if (
|
|
812
|
+
onLongPress != null &&
|
|
813
|
+
this._isDefaultPressButton(
|
|
814
|
+
getTouchFromPressEvent(event).button,
|
|
815
|
+
) /* [macOS] */
|
|
816
|
+
) {
|
|
795
817
|
onLongPress(event);
|
|
796
818
|
}
|
|
797
819
|
}
|
|
@@ -799,7 +821,14 @@ export default class Pressability {
|
|
|
799
821
|
const isPrevActive = isActiveSignal(prevState);
|
|
800
822
|
const isNextActive = isActiveSignal(nextState);
|
|
801
823
|
|
|
802
|
-
|
|
824
|
+
// [macOS Don't activate press visual feedback for non-primary mouse buttons
|
|
825
|
+
// (e.g. right-click, middle-click). They should fire onAuxClick, not onPress.
|
|
826
|
+
const isPrimaryButton = this._isDefaultPressButton(
|
|
827
|
+
getTouchFromPressEvent(event).button,
|
|
828
|
+
);
|
|
829
|
+
// macOS]
|
|
830
|
+
|
|
831
|
+
if (!isPrevActive && isNextActive && isPrimaryButton /* [macOS] */) {
|
|
803
832
|
this._activate(event);
|
|
804
833
|
} else if (isPrevActive && !isNextActive) {
|
|
805
834
|
this._deactivate(event);
|
|
@@ -807,12 +836,17 @@ export default class Pressability {
|
|
|
807
836
|
|
|
808
837
|
if (isPressInSignal(prevState) && signal === 'RESPONDER_RELEASE') {
|
|
809
838
|
// If we never activated (due to delays), activate and deactivate now.
|
|
810
|
-
if (!isNextActive && !isPrevActive) {
|
|
839
|
+
if (!isNextActive && !isPrevActive && isPrimaryButton /* [macOS] */) {
|
|
811
840
|
this._activate(event);
|
|
812
841
|
this._deactivate(event);
|
|
813
842
|
}
|
|
814
843
|
const {onLongPress, onPress, android_disableSound} = this._config;
|
|
815
|
-
if (
|
|
844
|
+
if (
|
|
845
|
+
onPress != null &&
|
|
846
|
+
this._isDefaultPressButton(
|
|
847
|
+
getTouchFromPressEvent(event).button,
|
|
848
|
+
) /* [macOS] */
|
|
849
|
+
) {
|
|
816
850
|
const isPressCanceledByLongPress =
|
|
817
851
|
onLongPress != null && prevState === 'RESPONDER_ACTIVE_LONG_PRESS_IN';
|
|
818
852
|
if (!isPressCanceledByLongPress) {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#import <React/RCTBackedTextInputDelegateAdapter.h>
|
|
9
9
|
#import "RCTBackedTextInputViewProtocol.h" // [macOS
|
|
10
10
|
#import "RCTBackedTextInputDelegate.h"
|
|
11
|
-
#import
|
|
11
|
+
#import <React/RCTTextUIKit.h> // macOS]
|
|
12
12
|
|
|
13
13
|
#pragma mark - RCTBackedTextFieldDelegateAdapter (for UITextField)
|
|
14
14
|
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
#import <React/RCTTextAttributes.h>
|
|
22
22
|
#import <React/RCTTextSelection.h>
|
|
23
23
|
#import <React/RCTUITextView.h> // [macOS]
|
|
24
|
-
#import
|
|
24
|
+
#import <React/RCTTextUIKit.h> // [macOS]
|
|
25
25
|
#import <React/RCTHandledKey.h> // [macOS]
|
|
26
|
+
#if TARGET_OS_OSX // [macOS
|
|
27
|
+
#import <React/RCTUISecureTextField.h>
|
|
28
|
+
#endif // macOS]
|
|
26
29
|
|
|
27
30
|
/** Native iOS text field bottom keyboard offset amount */
|
|
28
31
|
static const CGFloat kSingleLineKeyboardBottomOffset = 15.0;
|
|
@@ -194,7 +197,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
|
|
|
194
197
|
BOOL shouldFallbackToBareTextComparison =
|
|
195
198
|
// There are multiple Korean input sources (2-Set, 3-Set, etc). Check substring instead instead
|
|
196
199
|
[[[self.backedTextInputView inputContext] selectedKeyboardInputSource] containsString:@"com.apple.inputmethod.Korean"] ||
|
|
197
|
-
[self.backedTextInputView hasMarkedText] || [self.backedTextInputView isKindOfClass:[
|
|
200
|
+
[self.backedTextInputView hasMarkedText] || [self.backedTextInputView isKindOfClass:[RCTUISecureTextField class]] ||
|
|
198
201
|
#endif // macOS]
|
|
199
202
|
fontHasBeenUpdatedBySystem;
|
|
200
203
|
|
|
@@ -20,11 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
20
20
|
#if !TARGET_OS_OSX // [macOS]
|
|
21
21
|
@interface RCTUITextField : UITextField <RCTBackedTextInputViewProtocol>
|
|
22
22
|
#else // [macOS
|
|
23
|
-
#if RCT_SUBCLASS_SECURETEXTFIELD
|
|
24
|
-
@interface RCTUISecureTextField : NSSecureTextField <RCTBackedTextInputViewProtocol>
|
|
25
|
-
#else
|
|
26
23
|
@interface RCTUITextField : NSTextField <RCTBackedTextInputViewProtocol>
|
|
27
|
-
#endif // RCT_SUBCLASS_SECURETEXTFIELD
|
|
28
24
|
#endif // macOS]
|
|
29
25
|
|
|
30
26
|
|
|
@@ -17,12 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
#if TARGET_OS_OSX // [macOS
|
|
19
19
|
|
|
20
|
-
#if RCT_SUBCLASS_SECURETEXTFIELD
|
|
21
|
-
#define RCTUITextFieldCell RCTUISecureTextFieldCell
|
|
22
|
-
@interface RCTUISecureTextFieldCell : NSSecureTextFieldCell
|
|
23
|
-
#else
|
|
24
20
|
@interface RCTUITextFieldCell : NSTextFieldCell
|
|
25
|
-
#endif
|
|
26
21
|
|
|
27
22
|
@property (nonatomic, assign) UIEdgeInsets textContainerInset;
|
|
28
23
|
@property (nonatomic, getter=isAutomaticTextReplacementEnabled) BOOL automaticTextReplacementEnabled;
|
|
@@ -36,11 +31,6 @@
|
|
|
36
31
|
|
|
37
32
|
@implementation RCTUITextFieldCell
|
|
38
33
|
|
|
39
|
-
- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset
|
|
40
|
-
{
|
|
41
|
-
_textContainerInset = textContainerInset;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
34
|
- (NSRect)titleRectForBounds:(NSRect)rect
|
|
45
35
|
{
|
|
46
36
|
return UIEdgeInsetsInsetRect([super titleRectForBounds:rect], self.textContainerInset);
|
|
@@ -58,12 +48,9 @@
|
|
|
58
48
|
|
|
59
49
|
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
|
|
60
50
|
{
|
|
61
|
-
if (self.drawsBackground) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
[self.backgroundColor set];
|
|
65
|
-
NSRectFill(cellFrame);
|
|
66
|
-
}
|
|
51
|
+
if (self.drawsBackground && self.backgroundColor && self.backgroundColor.alphaComponent > 0) {
|
|
52
|
+
[self.backgroundColor set];
|
|
53
|
+
NSRectFill(cellFrame);
|
|
67
54
|
}
|
|
68
55
|
|
|
69
56
|
[super drawInteriorWithFrame:[self titleRectForBounds:cellFrame] inView:controlView];
|
|
@@ -86,11 +73,7 @@
|
|
|
86
73
|
@end
|
|
87
74
|
#endif // macOS]
|
|
88
75
|
|
|
89
|
-
#ifdef RCT_SUBCLASS_SECURETEXTFIELD
|
|
90
|
-
@implementation RCTUISecureTextField {
|
|
91
|
-
#else
|
|
92
76
|
@implementation RCTUITextField {
|
|
93
|
-
#endif
|
|
94
77
|
RCTBackedTextFieldDelegateAdapter *_textInputDelegateAdapter;
|
|
95
78
|
NSDictionary<NSAttributedStringKey, id> *_defaultTextAttributes;
|
|
96
79
|
#if !TARGET_OS_OSX // [macOS]
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
// [macOS]
|
|
9
|
+
|
|
10
|
+
#if TARGET_OS_OSX
|
|
11
|
+
|
|
12
|
+
#import <React/RCTUISecureTextField.h>
|
|
13
|
+
#import <React/RCTUIKit.h>
|
|
14
|
+
|
|
15
|
+
#pragma mark - RCTUISecureTextFieldCell
|
|
16
|
+
|
|
17
|
+
@interface RCTUISecureTextFieldCell : NSSecureTextFieldCell
|
|
18
|
+
|
|
19
|
+
@property (nonatomic, assign) UIEdgeInsets textContainerInset;
|
|
20
|
+
@property (nonatomic, getter=isAutomaticTextReplacementEnabled) BOOL automaticTextReplacementEnabled;
|
|
21
|
+
@property (nonatomic, getter=isAutomaticSpellingCorrectionEnabled) BOOL automaticSpellingCorrectionEnabled;
|
|
22
|
+
@property (nonatomic, getter=isContinuousSpellCheckingEnabled) BOOL continuousSpellCheckingEnabled;
|
|
23
|
+
@property (nonatomic, getter=isGrammarCheckingEnabled) BOOL grammarCheckingEnabled;
|
|
24
|
+
@property (nonatomic, strong, nullable) RCTPlatformColor *selectionColor;
|
|
25
|
+
@property (nonatomic, strong, nullable) RCTPlatformColor *insertionPointColor;
|
|
26
|
+
|
|
27
|
+
@end
|
|
28
|
+
|
|
29
|
+
@implementation RCTUISecureTextFieldCell
|
|
30
|
+
|
|
31
|
+
- (NSRect)titleRectForBounds:(NSRect)rect
|
|
32
|
+
{
|
|
33
|
+
return UIEdgeInsetsInsetRect([super titleRectForBounds:rect], self.textContainerInset);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (void)editWithFrame:(NSRect)rect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)delegate event:(NSEvent *)event
|
|
37
|
+
{
|
|
38
|
+
[super editWithFrame:[self titleRectForBounds:rect] inView:controlView editor:textObj delegate:delegate event:event];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
- (void)selectWithFrame:(NSRect)rect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)delegate start:(NSInteger)selStart length:(NSInteger)selLength
|
|
42
|
+
{
|
|
43
|
+
[super selectWithFrame:[self titleRectForBounds:rect] inView:controlView editor:textObj delegate:delegate start:selStart length:selLength];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
|
|
47
|
+
{
|
|
48
|
+
if (self.drawsBackground && self.backgroundColor && self.backgroundColor.alphaComponent > 0) {
|
|
49
|
+
[self.backgroundColor set];
|
|
50
|
+
NSRectFill(cellFrame);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[super drawInteriorWithFrame:[self titleRectForBounds:cellFrame] inView:controlView];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj
|
|
57
|
+
{
|
|
58
|
+
NSTextView *fieldEditor = (NSTextView *)[super setUpFieldEditorAttributes:textObj];
|
|
59
|
+
fieldEditor.automaticSpellingCorrectionEnabled = self.isAutomaticSpellingCorrectionEnabled;
|
|
60
|
+
fieldEditor.automaticTextReplacementEnabled = self.isAutomaticTextReplacementEnabled;
|
|
61
|
+
fieldEditor.continuousSpellCheckingEnabled = self.isContinuousSpellCheckingEnabled;
|
|
62
|
+
fieldEditor.grammarCheckingEnabled = self.isGrammarCheckingEnabled;
|
|
63
|
+
NSMutableDictionary *selectTextAttributes = fieldEditor.selectedTextAttributes.mutableCopy;
|
|
64
|
+
selectTextAttributes[NSBackgroundColorAttributeName] = self.selectionColor ?: [NSColor selectedControlColor];
|
|
65
|
+
fieldEditor.selectedTextAttributes = selectTextAttributes;
|
|
66
|
+
fieldEditor.insertionPointColor = self.insertionPointColor ?: [NSColor textColor];
|
|
67
|
+
return fieldEditor;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@end
|
|
71
|
+
|
|
72
|
+
#pragma mark - RCTUISecureTextField
|
|
73
|
+
|
|
74
|
+
@implementation RCTUISecureTextField
|
|
75
|
+
|
|
76
|
+
+ (Class)cellClass
|
|
77
|
+
{
|
|
78
|
+
return RCTUISecureTextFieldCell.class;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@end
|
|
82
|
+
|
|
83
|
+
#endif // TARGET_OS_OSX
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -157,7 +157,9 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *scrollView, NS
|
|
|
157
157
|
#if !TARGET_OS_OSX // [macOS]
|
|
158
158
|
[_scrollView addSubview:_containerView];
|
|
159
159
|
#else // [macOS
|
|
160
|
-
|
|
160
|
+
// Force overlay scrollbar style to avoid layout issues with legacy scrollbars.
|
|
161
|
+
_scrollView.scrollerStyle = NSScrollerStyleOverlay;
|
|
162
|
+
// Don't set autoresizingMask — AppKit corrupts the documentView frame during tile/resize.
|
|
161
163
|
[_scrollView setDocumentView:_containerView];
|
|
162
164
|
#endif // macOS]
|
|
163
165
|
|
|
@@ -185,26 +187,11 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *scrollView, NS
|
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
#if TARGET_OS_OSX // [macOS
|
|
188
|
-
- (void)
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// it fills the visible area before React's first layout pass. However, AppKit's autoresizing can
|
|
194
|
-
// corrupt the documentView's frame by adding the NSClipView's size delta to the container's
|
|
195
|
-
// dimensions (e.g., during initial tile or window resize), inflating it well beyond the correct
|
|
196
|
-
// content size. This produces massive horizontal and vertical overflow on first render.
|
|
197
|
-
//
|
|
198
|
-
// After React has set the content size via updateState:, we reset the documentView frame here to
|
|
199
|
-
// undo any autoresizing corruption. This runs after AppKit's layout (which triggers autoresizing),
|
|
200
|
-
// so it reliably corrects the frame.
|
|
201
|
-
if (!CGSizeEqualToSize(_contentSize, CGSizeZero)) {
|
|
202
|
-
CGRect containerFrame = _containerView.frame;
|
|
203
|
-
if (!CGSizeEqualToSize(containerFrame.size, _contentSize)) {
|
|
204
|
-
containerFrame.size = _contentSize;
|
|
205
|
-
_containerView.frame = containerFrame;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
190
|
+
- (void)_preferredScrollerStyleDidChange:(NSNotification *)notification
|
|
191
|
+
{
|
|
192
|
+
// Re-force overlay style when system preference changes.
|
|
193
|
+
_scrollView.scrollerStyle = NSScrollerStyleOverlay;
|
|
194
|
+
[_scrollView tile];
|
|
208
195
|
}
|
|
209
196
|
#endif // macOS]
|
|
210
197
|
|
|
@@ -585,6 +572,18 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
585
572
|
return nil;
|
|
586
573
|
}
|
|
587
574
|
|
|
575
|
+
#if TARGET_OS_OSX // [macOS
|
|
576
|
+
// Check scrollbars before content subviews — scrollers are NSScrollView children,
|
|
577
|
+
// not documentView children, so full-width content would swallow their clicks.
|
|
578
|
+
if (isPointInside) {
|
|
579
|
+
NSPoint scrollViewPoint = [_scrollView convertPoint:point fromView:self];
|
|
580
|
+
NSView *scrollViewHit = [_scrollView hitTest:scrollViewPoint];
|
|
581
|
+
if ([scrollViewHit isKindOfClass:[NSScroller class]]) {
|
|
582
|
+
return (RCTPlatformView *)scrollViewHit;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
#endif // macOS]
|
|
586
|
+
|
|
588
587
|
for (RCTPlatformView *subview in [_containerView.subviews reverseObjectEnumerator]) { // [macOS]
|
|
589
588
|
RCTPlatformView *hitView = RCTUIViewHitTestWithEvent(subview, point, self, event); // [macOS]
|
|
590
589
|
if (hitView) {
|
|
@@ -889,12 +888,19 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
889
888
|
[defaultCenter removeObserver:self
|
|
890
889
|
name:NSViewBoundsDidChangeNotification
|
|
891
890
|
object:_scrollView.contentView];
|
|
891
|
+
[defaultCenter removeObserver:self
|
|
892
|
+
name:NSPreferredScrollerStyleDidChangeNotification
|
|
893
|
+
object:nil];
|
|
892
894
|
} else {
|
|
893
895
|
// Register for scrollview's clipview bounds change notifications so we can track scrolling
|
|
894
896
|
[defaultCenter addObserver:self
|
|
895
897
|
selector:@selector(scrollViewDocumentViewBoundsDidChange:)
|
|
896
898
|
name:NSViewBoundsDidChangeNotification
|
|
897
899
|
object:_scrollView.contentView]; // NSClipView
|
|
900
|
+
[defaultCenter addObserver:self
|
|
901
|
+
selector:@selector(_preferredScrollerStyleDidChange:)
|
|
902
|
+
name:NSPreferredScrollerStyleDidChangeNotification
|
|
903
|
+
object:nil];
|
|
898
904
|
}
|
|
899
905
|
#endif // macOS]
|
|
900
906
|
|
|
@@ -170,6 +170,30 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
170
170
|
[self _restoreTextSelection];
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
// [macOS
|
|
174
|
+
- (void)_updateDefaultTextAttributes
|
|
175
|
+
{
|
|
176
|
+
const auto &props = static_cast<const TextInputProps &>(*_props);
|
|
177
|
+
NSMutableDictionary<NSAttributedStringKey, id> *attrs =
|
|
178
|
+
RCTNSTextAttributesFromTextAttributes(props.getEffectiveTextAttributes(RCTFontSizeMultiplier()));
|
|
179
|
+
|
|
180
|
+
_backedTextInputView.defaultTextAttributes = attrs;
|
|
181
|
+
|
|
182
|
+
// Also update the existing attributed text so the visible text re-renders
|
|
183
|
+
// with the new color (defaultTextAttributes only affects newly typed text).
|
|
184
|
+
// Wrap in _comingFromJS to prevent textInputDidChange from pushing a state
|
|
185
|
+
// update back to the shadow tree, which would overwrite our fresh colors
|
|
186
|
+
// with the stale cached attributed string.
|
|
187
|
+
NSString *currentText = _backedTextInputView.attributedText.string;
|
|
188
|
+
if (currentText.length > 0) {
|
|
189
|
+
NSAttributedString *updated = [[NSAttributedString alloc] initWithString:currentText attributes:attrs];
|
|
190
|
+
_comingFromJS = YES;
|
|
191
|
+
_backedTextInputView.attributedText = updated;
|
|
192
|
+
_comingFromJS = NO;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// macOS]
|
|
196
|
+
|
|
173
197
|
#if !TARGET_OS_OSX // [macOS]
|
|
174
198
|
// TODO: replace with registerForTraitChanges once iOS 17.0 is the lowest supported version
|
|
175
199
|
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
|
|
@@ -183,8 +207,20 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
183
207
|
_backedTextInputView.defaultTextAttributes =
|
|
184
208
|
RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier()));
|
|
185
209
|
}
|
|
210
|
+
|
|
211
|
+
// [macOS
|
|
212
|
+
if ([self.traitCollection hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]) {
|
|
213
|
+
[self _updateDefaultTextAttributes];
|
|
214
|
+
}
|
|
215
|
+
// macOS]
|
|
216
|
+
}
|
|
217
|
+
#else // [macOS
|
|
218
|
+
- (void)viewDidChangeEffectiveAppearance
|
|
219
|
+
{
|
|
220
|
+
[super viewDidChangeEffectiveAppearance];
|
|
221
|
+
[self _updateDefaultTextAttributes];
|
|
186
222
|
}
|
|
187
|
-
#endif //
|
|
223
|
+
#endif // macOS]
|
|
188
224
|
|
|
189
225
|
- (void)reactUpdateResponderOffsetForScrollView:(RCTScrollViewComponentView *)scrollView
|
|
190
226
|
{
|
|
@@ -1220,7 +1256,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
1220
1256
|
// There are multiple Korean input sources (2-Set, 3-Set, etc). Check substring instead instead
|
|
1221
1257
|
[[[_backedTextInputView inputContext] selectedKeyboardInputSource] containsString:@"com.apple.inputmethod.Korean"] ||
|
|
1222
1258
|
[_backedTextInputView hasMarkedText] ||
|
|
1223
|
-
[_backedTextInputView isKindOfClass:[
|
|
1259
|
+
[_backedTextInputView isKindOfClass:[RCTUISecureTextField class]] ||
|
|
1224
1260
|
#endif // macOS]
|
|
1225
1261
|
fontHasBeenUpdatedBySystem;
|
|
1226
1262
|
|
|
@@ -2031,10 +2031,12 @@ enum DragEventType {
|
|
|
2031
2031
|
enum MouseEventType {
|
|
2032
2032
|
MouseEnter,
|
|
2033
2033
|
MouseLeave,
|
|
2034
|
+
Click,
|
|
2034
2035
|
DoubleClick,
|
|
2036
|
+
AuxClick,
|
|
2035
2037
|
};
|
|
2036
2038
|
|
|
2037
|
-
- (void)emitMouseEvent:(MouseEventType)eventType
|
|
2039
|
+
- (void)emitMouseEvent:(MouseEventType)eventType button:(int)button
|
|
2038
2040
|
{
|
|
2039
2041
|
if (!_eventEmitter) {
|
|
2040
2042
|
return;
|
|
@@ -2054,6 +2056,7 @@ enum MouseEventType {
|
|
|
2054
2056
|
.ctrlKey = static_cast<bool>(modifierFlags & NSEventModifierFlagControl),
|
|
2055
2057
|
.shiftKey = static_cast<bool>(modifierFlags & NSEventModifierFlagShift),
|
|
2056
2058
|
.metaKey = static_cast<bool>(modifierFlags & NSEventModifierFlagCommand),
|
|
2059
|
+
.button = button,
|
|
2057
2060
|
};
|
|
2058
2061
|
|
|
2059
2062
|
switch (eventType) {
|
|
@@ -2065,12 +2068,25 @@ enum MouseEventType {
|
|
|
2065
2068
|
_eventEmitter->onMouseLeave(mouseEvent);
|
|
2066
2069
|
break;
|
|
2067
2070
|
|
|
2071
|
+
case Click:
|
|
2072
|
+
_eventEmitter->onClick(mouseEvent);
|
|
2073
|
+
break;
|
|
2074
|
+
|
|
2068
2075
|
case DoubleClick:
|
|
2069
2076
|
_eventEmitter->onDoubleClick(mouseEvent);
|
|
2070
2077
|
break;
|
|
2078
|
+
|
|
2079
|
+
case AuxClick:
|
|
2080
|
+
_eventEmitter->onAuxClick(mouseEvent);
|
|
2081
|
+
break;
|
|
2071
2082
|
}
|
|
2072
2083
|
}
|
|
2073
2084
|
|
|
2085
|
+
- (void)emitMouseEvent:(MouseEventType)eventType
|
|
2086
|
+
{
|
|
2087
|
+
[self emitMouseEvent:eventType button:0];
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2074
2090
|
- (void)updateMouseOverIfNeeded
|
|
2075
2091
|
{
|
|
2076
2092
|
// When an enclosing scrollview is scrolled using the scrollWheel or trackpad,
|
|
@@ -2185,12 +2201,55 @@ enum MouseEventType {
|
|
|
2185
2201
|
- (void)mouseUp:(NSEvent *)event
|
|
2186
2202
|
{
|
|
2187
2203
|
BOOL hasDoubleClickEventHandler = _props->hostPlatformEvents[HostPlatformViewEvents::Offset::DoubleClick];
|
|
2204
|
+
BOOL hasClickEventHandler = _props->hostPlatformEvents[HostPlatformViewEvents::Offset::Click];
|
|
2188
2205
|
if (hasDoubleClickEventHandler && event.clickCount == 2) {
|
|
2189
|
-
[self emitMouseEvent
|
|
2206
|
+
[self emitMouseEvent:DoubleClick];
|
|
2207
|
+
} else if (hasClickEventHandler && event.clickCount == 1) {
|
|
2208
|
+
[self emitMouseEvent:Click];
|
|
2190
2209
|
} else {
|
|
2191
2210
|
[super mouseUp:event];
|
|
2192
2211
|
}
|
|
2193
2212
|
}
|
|
2213
|
+
|
|
2214
|
+
- (void)rightMouseDown:(NSEvent *)event
|
|
2215
|
+
{
|
|
2216
|
+
// Accept rightMouseDown to prevent the default NSView behavior of passing it
|
|
2217
|
+
// up the responder chain (which can trigger a context menu modal loop that
|
|
2218
|
+
// consumes rightMouseUp).
|
|
2219
|
+
BOOL hasAuxClickEventHandler = _props->hostPlatformEvents[HostPlatformViewEvents::Offset::AuxClick];
|
|
2220
|
+
if (!hasAuxClickEventHandler) {
|
|
2221
|
+
[super rightMouseDown:event];
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
- (void)rightMouseUp:(NSEvent *)event
|
|
2226
|
+
{
|
|
2227
|
+
BOOL hasAuxClickEventHandler = _props->hostPlatformEvents[HostPlatformViewEvents::Offset::AuxClick];
|
|
2228
|
+
if (hasAuxClickEventHandler) {
|
|
2229
|
+
[self emitMouseEvent:AuxClick button:2];
|
|
2230
|
+
} else {
|
|
2231
|
+
[super rightMouseUp:event];
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
- (void)otherMouseDown:(NSEvent *)event
|
|
2236
|
+
{
|
|
2237
|
+
// Accept otherMouseDown so that otherMouseUp is delivered to this view.
|
|
2238
|
+
BOOL hasAuxClickEventHandler = _props->hostPlatformEvents[HostPlatformViewEvents::Offset::AuxClick];
|
|
2239
|
+
if (!hasAuxClickEventHandler) {
|
|
2240
|
+
[super otherMouseDown:event];
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
- (void)otherMouseUp:(NSEvent *)event
|
|
2245
|
+
{
|
|
2246
|
+
BOOL hasAuxClickEventHandler = _props->hostPlatformEvents[HostPlatformViewEvents::Offset::AuxClick];
|
|
2247
|
+
if (hasAuxClickEventHandler) {
|
|
2248
|
+
[self emitMouseEvent:AuxClick button:1];
|
|
2249
|
+
} else {
|
|
2250
|
+
[super otherMouseUp:event];
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2194
2253
|
#endif // macOS]
|
|
2195
2254
|
|
|
2196
2255
|
- (SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point
|
|
@@ -703,8 +703,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)act
|
|
|
703
703
|
}
|
|
704
704
|
case RCTPointerEventTypeEnd: {
|
|
705
705
|
eventEmitter->onPointerUp(pointerEvent);
|
|
706
|
-
if (pointerEvent.isPrimary && pointerEvent.button == 0
|
|
707
|
-
|
|
706
|
+
if (pointerEvent.isPrimary && pointerEvent.button == 0) {
|
|
707
|
+
if (IsPointerWithinInitialTree(activePointer)) {
|
|
708
|
+
eventEmitter->onClick(std::move(pointerEvent));
|
|
709
|
+
}
|
|
710
|
+
} else if (IsPointerWithinInitialTree(activePointer)) {
|
|
711
|
+
eventEmitter->onAuxClick(std::move(pointerEvent));
|
|
708
712
|
}
|
|
709
713
|
break;
|
|
710
714
|
}
|
package/React/Views/RCTView.h
CHANGED
|
@@ -145,6 +145,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
145
145
|
/**
|
|
146
146
|
* (Experimental and unused for Paper) Pointer event handlers.
|
|
147
147
|
*/
|
|
148
|
+
@property (nonatomic, assign) RCTBubblingEventBlock onAuxClick;
|
|
148
149
|
@property (nonatomic, assign) RCTBubblingEventBlock onClick;
|
|
149
150
|
@property (nonatomic, assign) RCTBubblingEventBlock onPointerCancel;
|
|
150
151
|
@property (nonatomic, assign) RCTBubblingEventBlock onPointerDown;
|
|
@@ -882,6 +882,7 @@ RCT_CUSTOM_VIEW_PROPERTY(onTouchEnd, BOOL, RCTView) {}
|
|
|
882
882
|
RCT_CUSTOM_VIEW_PROPERTY(onTouchCancel, BOOL, RCTView) {}
|
|
883
883
|
|
|
884
884
|
// Experimental/WIP Pointer Events (not yet ready for use)
|
|
885
|
+
RCT_EXPORT_VIEW_PROPERTY(onAuxClick, RCTBubblingEventBlock)
|
|
885
886
|
RCT_EXPORT_VIEW_PROPERTY(onClick, RCTBubblingEventBlock)
|
|
886
887
|
RCT_EXPORT_VIEW_PROPERTY(onPointerCancel, RCTBubblingEventBlock)
|
|
887
888
|
RCT_EXPORT_VIEW_PROPERTY(onPointerDown, RCTBubblingEventBlock)
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
#define REACT_NATIVE_VERSION_MAJOR 0
|
|
16
16
|
#define REACT_NATIVE_VERSION_MINOR 81
|
|
17
|
-
#define REACT_NATIVE_VERSION_PATCH
|
|
17
|
+
#define REACT_NATIVE_VERSION_PATCH 7
|
|
18
18
|
|
|
19
19
|
namespace facebook::react {
|
|
20
20
|
|
|
21
21
|
constexpr struct {
|
|
22
22
|
int32_t Major = 0;
|
|
23
23
|
int32_t Minor = 81;
|
|
24
|
-
int32_t Patch =
|
|
24
|
+
int32_t Patch = 7;
|
|
25
25
|
std::string_view Prerelease = "";
|
|
26
26
|
} ReactNativeVersion;
|
|
27
27
|
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
#include <TargetConditionals.h> // [macOS]
|
|
9
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
10
|
+
|
|
8
11
|
#import <React/RCTUtils.h>
|
|
9
12
|
#import <UIKit/UIKit.h>
|
|
10
13
|
#include "AppleSwitchShadowNode.h"
|
|
@@ -26,3 +29,5 @@ Size SwitchShadowNode::measureContent(
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
} // namespace facebook::react
|
|
32
|
+
|
|
33
|
+
#endif // !TARGET_OS_OSX [macOS]
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
#include <TargetConditionals.h> // [macOS]
|
|
9
|
+
#if TARGET_OS_OSX // [macOS]
|
|
10
|
+
|
|
8
11
|
#import <AppKit/AppKit.h>
|
|
9
12
|
#include "AppleSwitchShadowNode.h"
|
|
10
13
|
|
|
@@ -30,3 +33,5 @@ Size SwitchShadowNode::measureContent(
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
} // namespace facebook::react
|
|
36
|
+
|
|
37
|
+
#endif // TARGET_OS_OSX [macOS]
|
|
@@ -86,6 +86,10 @@ void TouchEventEmitter::onTouchCancel(TouchEvent event) const {
|
|
|
86
86
|
"touchCancel", std::move(event), RawEvent::Category::ContinuousEnd);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
void TouchEventEmitter::onAuxClick(PointerEvent event) const {
|
|
90
|
+
dispatchPointerEvent("auxClick", std::move(event), RawEvent::Category::Discrete);
|
|
91
|
+
}
|
|
92
|
+
|
|
89
93
|
void TouchEventEmitter::onClick(PointerEvent event) const {
|
|
90
94
|
dispatchPointerEvent("click", std::move(event), RawEvent::Category::Discrete);
|
|
91
95
|
}
|
|
@@ -29,6 +29,7 @@ class TouchEventEmitter : public EventEmitter {
|
|
|
29
29
|
void onTouchEnd(TouchEvent event) const;
|
|
30
30
|
void onTouchCancel(TouchEvent event) const;
|
|
31
31
|
|
|
32
|
+
void onAuxClick(PointerEvent event) const;
|
|
32
33
|
void onClick(PointerEvent event) const;
|
|
33
34
|
void onPointerCancel(PointerEvent event) const;
|
|
34
35
|
void onPointerDown(PointerEvent event) const;
|
|
@@ -63,6 +63,10 @@ static jsi::Object mouseEventPayload(jsi::Runtime& runtime, const MouseEvent& ev
|
|
|
63
63
|
payload.setProperty(runtime, "ctrlKey", event.ctrlKey);
|
|
64
64
|
payload.setProperty(runtime, "shiftKey", event.shiftKey);
|
|
65
65
|
payload.setProperty(runtime, "metaKey", event.metaKey);
|
|
66
|
+
payload.setProperty(runtime, "button", event.button);
|
|
67
|
+
// pointerType lets Pressability's onClick guard distinguish native click
|
|
68
|
+
// events from accessibility/responder-based clicks, avoiding double onPress.
|
|
69
|
+
payload.setProperty(runtime, "pointerType", "mouse");
|
|
66
70
|
return payload;
|
|
67
71
|
};
|
|
68
72
|
|
|
@@ -78,12 +82,24 @@ void HostPlatformViewEventEmitter::onMouseLeave(const MouseEvent& mouseEvent) co
|
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
|
|
85
|
+
void HostPlatformViewEventEmitter::onClick(const MouseEvent& mouseEvent) const {
|
|
86
|
+
dispatchEvent("click", [mouseEvent](jsi::Runtime& runtime) {
|
|
87
|
+
return mouseEventPayload(runtime, mouseEvent);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
void HostPlatformViewEventEmitter::onDoubleClick(const MouseEvent& mouseEvent) const {
|
|
82
92
|
dispatchEvent("doubleClick", [mouseEvent](jsi::Runtime& runtime) {
|
|
83
93
|
return mouseEventPayload(runtime, mouseEvent);
|
|
84
94
|
});
|
|
85
95
|
}
|
|
86
96
|
|
|
97
|
+
void HostPlatformViewEventEmitter::onAuxClick(const MouseEvent& mouseEvent) const {
|
|
98
|
+
dispatchEvent("auxClick", [mouseEvent](jsi::Runtime& runtime) {
|
|
99
|
+
return mouseEventPayload(runtime, mouseEvent);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
#pragma mark - Drag and Drop Events
|
|
88
104
|
|
|
89
105
|
jsi::Value HostPlatformViewEventEmitter::dataTransferPayload(
|
|
@@ -33,7 +33,9 @@ class HostPlatformViewEventEmitter : public BaseViewEventEmitter {
|
|
|
33
33
|
|
|
34
34
|
void onMouseEnter(MouseEvent const& mouseEvent) const;
|
|
35
35
|
void onMouseLeave(MouseEvent const& mouseEvent) const;
|
|
36
|
+
void onClick(MouseEvent const& mouseEvent) const;
|
|
36
37
|
void onDoubleClick(MouseEvent const& mouseEvent) const;
|
|
38
|
+
void onAuxClick(MouseEvent const& mouseEvent) const;
|
|
37
39
|
|
|
38
40
|
#pragma mark - Drag and Drop Events
|
|
39
41
|
|
|
@@ -30,6 +30,8 @@ struct HostPlatformViewEvents {
|
|
|
30
30
|
MouseEnter = 4,
|
|
31
31
|
MouseLeave = 5,
|
|
32
32
|
DoubleClick = 6,
|
|
33
|
+
AuxClick = 7,
|
|
34
|
+
Click = 8,
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
constexpr bool operator[](const Offset offset) const {
|
|
@@ -74,6 +76,10 @@ static inline HostPlatformViewEvents convertRawProp(
|
|
|
74
76
|
convertRawProp(context, rawProps, "onMouseLeave", sourceValue[Offset::MouseLeave], defaultValue[Offset::MouseLeave]);
|
|
75
77
|
result[Offset::DoubleClick] =
|
|
76
78
|
convertRawProp(context, rawProps, "onDoubleClick", sourceValue[Offset::DoubleClick], defaultValue[Offset::DoubleClick]);
|
|
79
|
+
result[Offset::AuxClick] =
|
|
80
|
+
convertRawProp(context, rawProps, "onAuxClick", sourceValue[Offset::AuxClick], defaultValue[Offset::AuxClick]);
|
|
81
|
+
result[Offset::Click] =
|
|
82
|
+
convertRawProp(context, rawProps, "onClick", sourceValue[Offset::Click], defaultValue[Offset::Click]);
|
|
77
83
|
|
|
78
84
|
return result;
|
|
79
85
|
}
|
|
@@ -144,6 +144,8 @@ void HostPlatformViewProps::setProp(
|
|
|
144
144
|
VIEW_EVENT_CASE_MACOS(MouseEnter);
|
|
145
145
|
VIEW_EVENT_CASE_MACOS(MouseLeave);
|
|
146
146
|
VIEW_EVENT_CASE_MACOS(DoubleClick);
|
|
147
|
+
VIEW_EVENT_CASE_MACOS(AuxClick);
|
|
148
|
+
VIEW_EVENT_CASE_MACOS(Click);
|
|
147
149
|
RAW_SET_PROP_SWITCH_CASE_BASIC(focusable);
|
|
148
150
|
RAW_SET_PROP_SWITCH_CASE_BASIC(enableFocusRing);
|
|
149
151
|
RAW_SET_PROP_SWITCH_CASE_BASIC(keyDownEvents);
|
|
@@ -54,6 +54,14 @@ struct MouseEvent {
|
|
|
54
54
|
* A flag indicating if the meta key is pressed.
|
|
55
55
|
*/
|
|
56
56
|
bool metaKey{false};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The button number that was pressed when the mouse event was fired:
|
|
60
|
+
* 0 = primary button (usually the left button)
|
|
61
|
+
* 1 = auxiliary button (usually the middle/wheel button)
|
|
62
|
+
* 2 = secondary button (usually the right button)
|
|
63
|
+
*/
|
|
64
|
+
int button{0};
|
|
57
65
|
};
|
|
58
66
|
|
|
59
67
|
struct DataTransferFile {
|
|
@@ -830,6 +830,10 @@ static inline ViewEvents convertRawProp(
|
|
|
830
830
|
"onPointerOutCapture",
|
|
831
831
|
sourceValue[Offset::PointerOutCapture],
|
|
832
832
|
defaultValue[Offset::PointerOutCapture]);
|
|
833
|
+
result[Offset::AuxClick] =
|
|
834
|
+
convertRawProp(context, rawProps, "onAuxClick", sourceValue[Offset::AuxClick], defaultValue[Offset::AuxClick]);
|
|
835
|
+
result[Offset::AuxClickCapture] = convertRawProp(
|
|
836
|
+
context, rawProps, "onAuxClickCapture", sourceValue[Offset::AuxClickCapture], defaultValue[Offset::AuxClickCapture]);
|
|
833
837
|
result[Offset::Click] = convertRawProp(
|
|
834
838
|
context,
|
|
835
839
|
rawProps,
|
|
@@ -146,7 +146,14 @@ inline static RCTUIColor *RCTEffectiveForegroundColorFromTextAttributes(const Te
|
|
|
146
146
|
{
|
|
147
147
|
RCTUIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [RCTUIColor labelColor]; // [macOS]
|
|
148
148
|
|
|
149
|
+
#if TARGET_OS_OSX // [macOS
|
|
150
|
+
// On macOS, colorWithAlphaComponent: converts dynamic system colors (like
|
|
151
|
+
// NSColor.labelColor) to static resolved colors, preventing them from
|
|
152
|
+
// adapting to appearance changes. Skip when opacity is 1.0 (a no-op).
|
|
153
|
+
if (!isnan(textAttributes.opacity) && textAttributes.opacity != 1.0f) {
|
|
154
|
+
#else // macOS]
|
|
149
155
|
if (!isnan(textAttributes.opacity)) {
|
|
156
|
+
#endif
|
|
150
157
|
effectiveForegroundColor = [effectiveForegroundColor
|
|
151
158
|
colorWithAlphaComponent:CGColorGetAlpha(effectiveForegroundColor.CGColor) * textAttributes.opacity];
|
|
152
159
|
}
|
|
@@ -158,7 +165,11 @@ inline static RCTUIColor *RCTEffectiveBackgroundColorFromTextAttributes(const Te
|
|
|
158
165
|
{
|
|
159
166
|
RCTUIColor *effectiveBackgroundColor = RCTUIColorFromSharedColor(textAttributes.backgroundColor); // [macOS]
|
|
160
167
|
|
|
168
|
+
#if TARGET_OS_OSX // [macOS
|
|
169
|
+
if (effectiveBackgroundColor && !isnan(textAttributes.opacity) && textAttributes.opacity != 1.0f) {
|
|
170
|
+
#else // macOS]
|
|
161
171
|
if (effectiveBackgroundColor && !isnan(textAttributes.opacity)) {
|
|
172
|
+
#endif
|
|
162
173
|
effectiveBackgroundColor = [effectiveBackgroundColor
|
|
163
174
|
colorWithAlphaComponent:CGColorGetAlpha(effectiveBackgroundColor.CGColor) * textAttributes.opacity];
|
|
164
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-macos",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.7",
|
|
4
4
|
"description": "React Native for macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,27 @@
|
|
|
27
27
|
"react-native": "cli.js",
|
|
28
28
|
"react-native-macos": "cli.js"
|
|
29
29
|
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"executableFiles": [
|
|
32
|
+
"scripts/find-node-for-xcode.sh",
|
|
33
|
+
"scripts/ios-configure-glog.sh",
|
|
34
|
+
"scripts/node-binary.sh",
|
|
35
|
+
"scripts/packager.sh",
|
|
36
|
+
"scripts/react-native-xcode.sh",
|
|
37
|
+
"scripts/react_native_pods_utils/script_phases.sh",
|
|
38
|
+
"scripts/update-ruby.sh",
|
|
39
|
+
"scripts/xcode/ccache-clang.sh",
|
|
40
|
+
"scripts/xcode/ccache-clang++.sh",
|
|
41
|
+
"scripts/xcode/with-environment.sh",
|
|
42
|
+
"sdks/hermes-engine/utils/build-apple-framework.sh",
|
|
43
|
+
"sdks/hermes-engine/utils/build-hermes-xcode.sh",
|
|
44
|
+
"sdks/hermes-engine/utils/build-hermesc-xcode.sh",
|
|
45
|
+
"sdks/hermes-engine/utils/build-ios-framework.sh",
|
|
46
|
+
"sdks/hermes-engine/utils/build-mac-framework.sh",
|
|
47
|
+
"sdks/hermes-engine/utils/copy-hermes-xcode.sh",
|
|
48
|
+
"sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
30
51
|
"main": "./index.js",
|
|
31
52
|
"types": "types",
|
|
32
53
|
"exports": {
|
|
@@ -111,8 +132,8 @@
|
|
|
111
132
|
"rn-get-polyfills.js",
|
|
112
133
|
"scripts/replace-rncore-version.js",
|
|
113
134
|
"scripts/bundle.js",
|
|
114
|
-
"scripts/cocoapods",
|
|
115
|
-
"scripts/codegen",
|
|
135
|
+
"scripts/cocoapods/**",
|
|
136
|
+
"scripts/codegen/**",
|
|
116
137
|
"scripts/compose-source-maps.js",
|
|
117
138
|
"scripts/find-node-for-xcode.sh",
|
|
118
139
|
"scripts/generate-codegen-artifacts.js",
|
|
@@ -135,7 +156,7 @@
|
|
|
135
156
|
"scripts/xcode/ccache.conf",
|
|
136
157
|
"scripts/xcode/with-environment.sh",
|
|
137
158
|
"sdks/.hermesversion",
|
|
138
|
-
"sdks/hermes-engine",
|
|
159
|
+
"sdks/hermes-engine/**",
|
|
139
160
|
"sdks/hermesc",
|
|
140
161
|
"settings.gradle.kts",
|
|
141
162
|
"src",
|
|
@@ -166,7 +187,7 @@
|
|
|
166
187
|
},
|
|
167
188
|
"dependencies": {
|
|
168
189
|
"@jest/create-cache-key-function": "^29.7.0",
|
|
169
|
-
"@react-native-macos/virtualized-lists": "0.81.
|
|
190
|
+
"@react-native-macos/virtualized-lists": "0.81.7",
|
|
170
191
|
"@react-native/assets-registry": "0.81.6",
|
|
171
192
|
"@react-native/codegen": "0.81.6",
|
|
172
193
|
"@react-native/community-cli-plugin": "0.81.6",
|
package/react-native.config.js
CHANGED
|
@@ -71,13 +71,8 @@ try {
|
|
|
71
71
|
// [macOS
|
|
72
72
|
let apple;
|
|
73
73
|
try {
|
|
74
|
-
const iosPath = require.resolve('@react-native-community/cli-platform-ios', {
|
|
75
|
-
paths: [process.cwd()],
|
|
76
|
-
});
|
|
77
|
-
// $FlowFixMe[untyped-import]
|
|
78
74
|
apple = findCommunityPlatformPackage(
|
|
79
75
|
'@react-native-community/cli-platform-apple',
|
|
80
|
-
iosPath,
|
|
81
76
|
);
|
|
82
77
|
} catch {
|
|
83
78
|
if (verbose) {
|
|
@@ -12,7 +12,8 @@ CURR_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
|
12
12
|
IMPORT_HERMESC_PATH=${HERMES_OVERRIDE_HERMESC_PATH:-$PWD/build_host_hermesc/ImportHermesc.cmake}
|
|
13
13
|
BUILD_TYPE=${BUILD_TYPE:-Debug}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
# [macOS]
|
|
16
|
+
HERMES_PATH=${HERMES_PATH:-"$CURR_SCRIPT_DIR/.."}
|
|
16
17
|
REACT_NATIVE_PATH=${REACT_NATIVE_PATH:-$CURR_SCRIPT_DIR/../../..}
|
|
17
18
|
|
|
18
19
|
NUM_CORES=$(sysctl -n hw.ncpu)
|
|
@@ -10,7 +10,7 @@ fi
|
|
|
10
10
|
set -e
|
|
11
11
|
|
|
12
12
|
# Given a specific target, retrieve the right architecture for it
|
|
13
|
-
# $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst, xros, xrsimulator
|
|
13
|
+
# $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst, macosx, xros, xrsimulator
|
|
14
14
|
function get_architecture {
|
|
15
15
|
if [[ $1 == "iphoneos" || $1 == "xros" ]]; then
|
|
16
16
|
echo "arm64"
|
|
@@ -20,7 +20,7 @@ function get_architecture {
|
|
|
20
20
|
echo "arm64"
|
|
21
21
|
elif [[ $1 == "appletvsimulator" ]]; then
|
|
22
22
|
echo "x86_64;arm64"
|
|
23
|
-
elif [[ $1 == "catalyst" ]]; then
|
|
23
|
+
elif [[ $1 == "catalyst" || $1 == "macosx" ]]; then # [macOS]
|
|
24
24
|
echo "x86_64;arm64"
|
|
25
25
|
else
|
|
26
26
|
echo "Error: unknown architecture passed $1"
|
|
@@ -31,6 +31,10 @@ function get_architecture {
|
|
|
31
31
|
function get_deployment_target {
|
|
32
32
|
if [[ $1 == "xros" || $1 == "xrsimulator" ]]; then
|
|
33
33
|
echo "$(get_visionos_deployment_target)"
|
|
34
|
+
# [macOS
|
|
35
|
+
elif [[ $1 == "macosx" ]]; then
|
|
36
|
+
echo "$(get_mac_deployment_target)"
|
|
37
|
+
# macOS]
|
|
34
38
|
else # tvOS and iOS use the same deployment target
|
|
35
39
|
echo "$(get_ios_deployment_target)"
|
|
36
40
|
fi
|
|
@@ -53,7 +57,7 @@ function build_framework {
|
|
|
53
57
|
# group the frameworks together to create a universal framework
|
|
54
58
|
function build_universal_framework {
|
|
55
59
|
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
|
|
56
|
-
create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator"
|
|
60
|
+
create_universal_framework "macosx" "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator" # [macOS]
|
|
57
61
|
else
|
|
58
62
|
echo "Skipping; Clean \"destroot\" to rebuild".
|
|
59
63
|
fi
|
|
@@ -63,6 +67,7 @@ function build_universal_framework {
|
|
|
63
67
|
# this is used to preserve backward compatibility
|
|
64
68
|
function create_framework {
|
|
65
69
|
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
|
|
70
|
+
build_framework "macosx" # [macOS]
|
|
66
71
|
build_framework "iphoneos"
|
|
67
72
|
build_framework "iphonesimulator"
|
|
68
73
|
build_framework "appletvos"
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
// [macOS]
|
|
9
|
-
|
|
10
|
-
#if TARGET_OS_OSX
|
|
11
|
-
#define RCT_SUBCLASS_SECURETEXTFIELD 1
|
|
12
|
-
#endif
|
|
13
|
-
|
|
14
|
-
#include "../RCTUITextField.mm"
|