react-native-macos 0.0.0-4c3fb808f → 0.0.0-4ce83a6b1

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.
@@ -9,13 +9,9 @@
9
9
  * @flow strict
10
10
  */
11
11
 
12
- // [TODO(macOS GH#944)
13
- // Note: Be careful not to override these version numbers
14
- // when we merge upstream stable branches into main
15
- // TODO(macOS GH#944)]
16
12
  exports.version = {
17
13
  major: 0,
18
14
  minor: 0,
19
15
  patch: 0,
20
- prerelease: '4c3fb808f',
16
+ prerelease: '4ce83a6b1',
21
17
  };
@@ -6,14 +6,6 @@
6
6
  */
7
7
 
8
8
  #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
- #if !TARGET_OS_OSX // [TODO(macOS GH#774)
10
- #import <UIKit/UIKit.h>
11
- #else // [TODO(macOS GH#774)
12
- typedef NS_ENUM(NSInteger, UIImageRenderingMode) {
13
- UIImageRenderingModeAlwaysOriginal,
14
- UIImageRenderingModeAlwaysTemplate,
15
- };
16
- #endif // ]TODO(macOS GH#774)
17
9
  #import <React/RCTView.h>
18
10
  #import <React/RCTResizeMode.h>
19
11
 
@@ -212,8 +212,12 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
212
212
 
213
213
  - (BOOL)resignFirstResponder
214
214
  {
215
- BOOL success = [super resignFirstResponder];
215
+ if (self.selectable) {
216
+ self.selectedRange = NSMakeRange(NSNotFound, 0);
217
+ }
216
218
 
219
+ BOOL success = [super resignFirstResponder];
220
+
217
221
  if (success) {
218
222
  // Break undo coalescing when losing focus.
219
223
  [self breakUndoCoalescing];
@@ -436,13 +440,13 @@ static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739)
436
440
  {
437
441
  [super selectAll:sender];
438
442
 
439
- #if !TARGET_OS_OSX // TODO(macOS GH#774) For `selectTextOnFocus` prop, which isn't supported on macOS atm.
443
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
440
444
  // `selectAll:` does not work for UITextView when it's being called inside UITextView's delegate methods.
441
445
  dispatch_async(dispatch_get_main_queue(), ^{
442
446
  UITextRange *selectionRange = [self textRangeFromPosition:self.beginningOfDocument toPosition:self.endOfDocument];
443
447
  [self setSelectedTextRange:selectionRange notifyDelegate:NO];
444
448
  });
445
- #endif
449
+ #endif // TODO(macOS GH#774)
446
450
  }
447
451
 
448
452
  #pragma mark - Layout
@@ -379,7 +379,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder)
379
379
  }
380
380
 
381
381
  if (_selectTextOnFocus) {
382
- [self.backedTextInputView selectAll:nil];
382
+ if ([self.backedTextInputView respondsToSelector:@selector(selectAll:)]) {
383
+ [self.backedTextInputView selectAll:nil];
384
+ }
385
+ #if TARGET_OS_OSX // [TODO(macOS GH#774)
386
+ } else {
387
+ [self.backedTextInputView setSelectedTextRange:NSMakeRange(NSNotFound, 0) notifyDelegate:NO];
388
+ #endif // ]TODO(macOS GH#774)
383
389
  }
384
390
 
385
391
  [_eventDispatcher sendTextEventWithType:RCTTextEventTypeFocus
@@ -56,11 +56,11 @@ RCT_REMAP_NOT_OSX_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButton
56
56
  RCT_REMAP_NOT_OSX_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL) // TODO(macOS GH#774)
57
57
  RCT_EXPORT_VIEW_PROPERTY(autoFocus, BOOL)
58
58
  RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL)
59
- RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(clearTextOnFocus, BOOL) // TODO(macOS GH#774)
59
+ RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
60
60
  RCT_REMAP_NOT_OSX_VIEW_PROPERTY(keyboardType, backedTextInputView.keyboardType, UIKeyboardType) // TODO(macOS GH#774)
61
61
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(showSoftInputOnFocus, BOOL) // TODO(macOS GH#774)
62
62
  RCT_EXPORT_VIEW_PROPERTY(maxLength, NSNumber)
63
- RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(selectTextOnFocus, BOOL) // TODO(macOS GH#774)
63
+ RCT_EXPORT_VIEW_PROPERTY(selectTextOnFocus, BOOL)
64
64
  RCT_EXPORT_VIEW_PROPERTY(selection, RCTTextSelection)
65
65
  RCT_EXPORT_VIEW_PROPERTY(inputAccessoryViewID, NSString)
66
66
  RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString)
@@ -206,8 +206,7 @@ enum : NSUInteger
206
206
  };
207
207
 
208
208
  // UIView/NSView.h
209
- enum : NSInteger
210
- {
209
+ typedef NS_ENUM(NSInteger, UIViewContentMode) {
211
210
  UIViewContentModeScaleAspectFill = NSViewLayerContentsPlacementScaleProportionallyToFill,
212
211
  UIViewContentModeScaleAspectFit = NSViewLayerContentsPlacementScaleProportionallyToFit,
213
212
  UIViewContentModeScaleToFill = NSViewLayerContentsPlacementScaleAxesIndependently,
@@ -322,6 +321,11 @@ NS_INLINE NSEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat botto
322
321
  // UIImage
323
322
  @compatibility_alias UIImage NSImage;
324
323
 
324
+ typedef NS_ENUM(NSInteger, UIImageRenderingMode) {
325
+ UIImageRenderingModeAlwaysOriginal,
326
+ UIImageRenderingModeAlwaysTemplate,
327
+ };
328
+
325
329
  #ifdef __cplusplus
326
330
  extern "C"
327
331
  #endif
@@ -15,10 +15,6 @@ NSString* const RCTVersionPatch = @"patch";
15
15
  NSString* const RCTVersionPrerelease = @"prerelease";
16
16
 
17
17
 
18
- // [TODO(macOS GH#944)
19
- // Note: Be careful not to override these version numbers
20
- // when we merge upstream stable branches into main
21
- // TODO(macOS GH#944)]
22
18
  NSDictionary* RCTGetReactNativeVersion(void)
23
19
  {
24
20
  static NSDictionary* __rnVersion;
@@ -28,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
28
24
  RCTVersionMajor: @(0),
29
25
  RCTVersionMinor: @(0),
30
26
  RCTVersionPatch: @(0),
31
- RCTVersionPrerelease: @"4c3fb808f",
27
+ RCTVersionPrerelease: @"4ce83a6b1",
32
28
  };
33
29
  });
34
30
  return __rnVersion;
@@ -9,7 +9,11 @@
9
9
 
10
10
  NS_ASSUME_NONNULL_BEGIN
11
11
 
12
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
12
13
  @interface RCTAccessibilityElement : UIAccessibilityElement
14
+ #else // [TODO(macOS GH#774)
15
+ @interface RCTAccessibilityElement : NSAccessibilityElement
16
+ #endif // ]TODO(macOS GH#774)
13
17
 
14
18
  /*
15
19
  * Frame of the accessibility element in parent coordinate system.
@@ -9,6 +9,7 @@
9
9
 
10
10
  @implementation RCTAccessibilityElement
11
11
 
12
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
12
13
  - (CGRect)accessibilityFrame
13
14
  {
14
15
  RCTUIView *container = (RCTUIView *)self.accessibilityContainer; // TODO(macOS GH#774)
@@ -18,5 +19,6 @@
18
19
  return UIAccessibilityConvertFrameToScreenCoordinates(_frame, container);
19
20
  }
20
21
  }
22
+ #endif // TODO(macOS GH#774)
21
23
 
22
24
  @end
@@ -21,10 +21,12 @@
21
21
  frame:(CGRect)frame
22
22
  view:(RCTUIView *)view; // TODO(macOS GH#774)
23
23
 
24
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
24
25
  /*
25
26
  * Returns an array of `UIAccessibilityElement`s to be used for `UIAccessibilityContainer` implementation.
26
27
  */
27
28
  - (NSArray<UIAccessibilityElement *> *)accessibilityElements;
29
+ #endif // TODO(macOS GH#774)
28
30
 
29
31
  /**
30
32
  @abstract To make sure the provider is up to date.
@@ -21,7 +21,9 @@
21
21
  using namespace facebook::react;
22
22
 
23
23
  @implementation RCTParagraphComponentAccessibilityProvider {
24
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
24
25
  NSMutableArray<UIAccessibilityElement *> *_accessibilityElements;
26
+ #endif // TODO(macOS GH#774)
25
27
  AttributedString _attributedString;
26
28
  RCTTextLayoutManager *_layoutManager;
27
29
  ParagraphAttributes _paragraphAttributes;
@@ -45,6 +47,7 @@ using namespace facebook::react;
45
47
  return self;
46
48
  }
47
49
 
50
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
48
51
  - (NSArray<UIAccessibilityElement *> *)accessibilityElements
49
52
  {
50
53
  if (_accessibilityElements) {
@@ -171,6 +174,7 @@ using namespace facebook::react;
171
174
  _accessibilityElements = elements;
172
175
  return _accessibilityElements;
173
176
  }
177
+ #endif // TODO(macOS GH#774)
174
178
 
175
179
  - (BOOL)isUpToDate:(facebook::react::AttributedString)currentAttributedString
176
180
  {
@@ -8,9 +8,9 @@
8
8
  #import "RCTParagraphComponentView.h"
9
9
  #import "RCTParagraphComponentAccessibilityProvider.h"
10
10
 
11
- #if !TARGET_OS_OSX // [TODO(macOS GH#774)
11
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
12
12
  #import <MobileCoreServices/UTCoreTypes.h>
13
- #endif // ]TODO(macOS GH#774)
13
+ #endif // TODO(macOS GH#774)
14
14
 
15
15
  #import <react/renderer/components/text/ParagraphComponentDescriptor.h>
16
16
  #import <react/renderer/components/text/ParagraphProps.h>
@@ -32,7 +32,9 @@ using namespace facebook::react;
32
32
  ParagraphShadowNode::ConcreteState::Shared _state;
33
33
  ParagraphAttributes _paragraphAttributes;
34
34
  RCTParagraphComponentAccessibilityProvider *_accessibilityProvider;
35
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
35
36
  UILongPressGestureRecognizer *_longPressGestureRecognizer;
37
+ #endif // TODO(macOS GH#774)
36
38
  }
37
39
 
38
40
  - (instancetype)initWithFrame:(CGRect)frame
@@ -42,7 +44,9 @@ using namespace facebook::react;
42
44
  _props = defaultProps;
43
45
 
44
46
  self.opaque = NO;
47
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
45
48
  self.contentMode = UIViewContentModeRedraw;
49
+ #endif // TODO(macOS GH#774)
46
50
  }
47
51
 
48
52
  return self;
@@ -91,11 +95,13 @@ using namespace facebook::react;
91
95
  _paragraphAttributes = newParagraphProps.paragraphAttributes;
92
96
 
93
97
  if (newParagraphProps.isSelectable != oldParagraphProps.isSelectable) {
98
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
94
99
  if (newParagraphProps.isSelectable) {
95
100
  [self enableContextMenu];
96
101
  } else {
97
102
  [self disableContextMenu];
98
103
  }
104
+ #endif // TODO(macOS GH#774)
99
105
  }
100
106
 
101
107
  [super updateProps:props oldProps:oldProps];
@@ -151,6 +157,7 @@ using namespace facebook::react;
151
157
  return NO;
152
158
  }
153
159
 
160
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
154
161
  - (NSArray *)accessibilityElements
155
162
  {
156
163
  auto const &paragraphProps = *std::static_pointer_cast<ParagraphProps const>(_props);
@@ -186,6 +193,7 @@ using namespace facebook::react;
186
193
  {
187
194
  return [super accessibilityTraits] | UIAccessibilityTraitStaticText;
188
195
  }
196
+ #endif // TODO(macOS GH#774)
189
197
 
190
198
  #pragma mark - RCTTouchableComponentViewProtocol
191
199
 
@@ -220,6 +228,7 @@ using namespace facebook::react;
220
228
 
221
229
  #pragma mark - Context Menu
222
230
 
231
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
223
232
  - (void)enableContextMenu
224
233
  {
225
234
  _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
@@ -251,6 +260,7 @@ using namespace facebook::react;
251
260
  [menuController setMenuVisible:YES animated:YES];
252
261
  #endif
253
262
  }
263
+ #endif // TODO(macOS GH#774)
254
264
 
255
265
  - (BOOL)canBecomeFirstResponder
256
266
  {
@@ -258,6 +268,7 @@ using namespace facebook::react;
258
268
  return paragraphProps.isSelectable;
259
269
  }
260
270
 
271
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
261
272
  - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
262
273
  {
263
274
  auto const &paragraphProps = *std::static_pointer_cast<ParagraphProps const>(_props);
@@ -268,6 +279,7 @@ using namespace facebook::react;
268
279
 
269
280
  return [self.nextResponder canPerformAction:action withSender:sender];
270
281
  }
282
+ #endif // TODO(macOS GH#774)
271
283
 
272
284
  - (void)copy:(id)sender
273
285
  {
@@ -285,8 +297,14 @@ using namespace facebook::react;
285
297
 
286
298
  [item setObject:attributedText.string forKey:(id)kUTTypeUTF8PlainText];
287
299
 
300
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
288
301
  UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
289
302
  pasteboard.items = @[ item ];
303
+ #else // [TODO(macOS GH#774)
304
+ NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
305
+ [pasteboard clearContents];
306
+ [pasteboard setData:rtf forType:NSPasteboardTypeRTFD];
307
+ #endif // ]TODO(macOS GH#774)
290
308
  }
291
309
 
292
310
  @end
@@ -38,7 +38,9 @@ using namespace facebook::react;
38
38
  static auto const defaultProps = std::make_shared<ViewProps const>();
39
39
  _props = defaultProps;
40
40
  _reactSubviews = [NSMutableArray new];
41
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
41
42
  self.multipleTouchEnabled = YES;
43
+ #endif // TODO(macOS GH#774)
42
44
  }
43
45
  return self;
44
46
  }
@@ -246,7 +248,11 @@ using namespace facebook::react;
246
248
  // `shouldRasterize`
247
249
  if (oldViewProps.shouldRasterize != newViewProps.shouldRasterize) {
248
250
  self.layer.shouldRasterize = newViewProps.shouldRasterize;
251
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
249
252
  self.layer.rasterizationScale = newViewProps.shouldRasterize ? [UIScreen mainScreen].scale : 1.0;
253
+ #else // [TODO(macOS GH#774)
254
+ self.layer.rasterizationScale = 1.0;
255
+ #endif // ]TODO(macOS GH#774)
250
256
  }
251
257
 
252
258
  // `pointerEvents`
@@ -287,6 +293,7 @@ using namespace facebook::react;
287
293
  self.nativeId = RCTNSStringFromStringNilIfEmpty(newViewProps.nativeId);
288
294
  }
289
295
 
296
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
290
297
  // `accessible`
291
298
  if (oldViewProps.accessible != newViewProps.accessible) {
292
299
  self.accessibilityElement.isAccessibilityElement = newViewProps.accessible;
@@ -351,6 +358,7 @@ using namespace facebook::react;
351
358
  self.accessibilityElement.accessibilityValue = nil;
352
359
  }
353
360
  }
361
+ #endif // TODO(macOS GH#774)
354
362
 
355
363
  // `testId`
356
364
  if (oldViewProps.testId != newViewProps.testId) {
@@ -695,6 +703,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS G
695
703
  auto const &props = *std::static_pointer_cast<ViewProps const>(_props);
696
704
 
697
705
  // Handle Switch.
706
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
698
707
  if ((self.accessibilityTraits & AccessibilityTraitSwitch) == AccessibilityTraitSwitch) {
699
708
  if (props.accessibilityState.checked == AccessibilityState::Checked) {
700
709
  return @"1";
@@ -702,6 +711,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS G
702
711
  return @"0";
703
712
  }
704
713
  }
714
+ #endif // TODO(macOS GH#774)
705
715
 
706
716
  // Handle states which haven't already been handled.
707
717
  if (props.accessibilityState.checked == AccessibilityState::Checked) {
@@ -340,7 +340,9 @@ static void RCTPerformMountInstructions(
340
340
  {
341
341
  if ([@"focus" isEqualToString:eventType]) {
342
342
  RCTUIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774)
343
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
343
344
  UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, componentView);
345
+ #endif // TODO(macOS GH#774)
344
346
  }
345
347
  }
346
348
 
@@ -83,6 +83,7 @@ inline UIEdgeInsets RCTUIEdgeInsetsFromEdgeInsets(const facebook::react::EdgeIns
83
83
  return {edgeInsets.top, edgeInsets.left, edgeInsets.bottom, edgeInsets.right};
84
84
  }
85
85
 
86
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
86
87
  UIAccessibilityTraits const AccessibilityTraitSwitch = 0x20000000000001;
87
88
 
88
89
  inline UIAccessibilityTraits RCTUIAccessibilityTraitsFromAccessibilityTraits(
@@ -146,6 +147,7 @@ inline UIAccessibilityTraits RCTUIAccessibilityTraitsFromAccessibilityTraits(
146
147
  }
147
148
  return result;
148
149
  };
150
+ #endif // TODO(macOS GH#774)
149
151
 
150
152
  inline CATransform3D RCTCATransform3DFromTransformMatrix(const facebook::react::Transform &transformMatrix)
151
153
  {
@@ -66,10 +66,12 @@ using namespace facebook::react;
66
66
 
67
67
  [self _updateLayoutContext];
68
68
 
69
+ #if !TARGET_OS_OSX // TODO(macOS GH#774)
69
70
  [[NSNotificationCenter defaultCenter] addObserver:self
70
71
  selector:@selector(handleContentSizeCategoryDidChangeNotification:)
71
72
  name:UIContentSizeCategoryDidChangeNotification
72
73
  object:nil];
74
+ #endif // TODO(macOS GH#774)
73
75
  }
74
76
 
75
77
  return self;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.0.0-4c3fb808f
1
+ VERSION_NAME=0.0.0-4ce83a6b1
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  POM_NAME=ReactNative
@@ -13,14 +13,10 @@ import com.facebook.react.common.MapBuilder;
13
13
 
14
14
  import java.util.Map;
15
15
 
16
- // [TODO(macOS GH#944)
17
- // Note: Be careful not to override these version numbers
18
- // when we merge upstream stable branches into main
19
- // TODO(macOS GH#944)]
20
16
  public class ReactNativeVersion {
21
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
22
18
  "major", 0,
23
19
  "minor", 0,
24
20
  "patch", 0,
25
- "prerelease", "4c3fb808f");
21
+ "prerelease", "4ce83a6b1");
26
22
  }
@@ -14,15 +14,11 @@
14
14
 
15
15
  namespace facebook::react {
16
16
 
17
- // [TODO(macOS GH#944)
18
- // Note: Be careful not to override these version numbers
19
- // when we merge upstream stable branches into main
20
- // TODO(macOS GH#944)]
21
17
  constexpr struct {
22
18
  int32_t Major = 0;
23
19
  int32_t Minor = 0;
24
20
  int32_t Patch = 0;
25
- std::string_view Prerelease = "4c3fb808f";
21
+ std::string_view Prerelease = "4ce83a6b1";
26
22
  } ReactNativeVersion;
27
23
 
28
24
  } // namespace facebook::react
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.0.0-4c3fb808f",
3
+ "version": "0.0.0-4ce83a6b1",
4
4
  "bin": "./cli.js",
5
5
  "description": "React Native for macOS",
6
6
  "license": "MIT",
@@ -66,7 +66,7 @@ GEM
66
66
  i18n (1.12.0)
67
67
  concurrent-ruby (~> 1.0)
68
68
  json (2.6.3)
69
- minitest (5.16.3)
69
+ minitest (5.17.0)
70
70
  molinillo (0.8.0)
71
71
  nanaimo (0.3.0)
72
72
  nap (1.1.0)
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "react": "17.0.2",
15
15
  "react-native-macos": "1000.0.0",
16
- "react-native": "0.0.0-4c3fb808f"
16
+ "react-native": "0.0.0-4ce83a6b1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@babel/core": "^7.12.9",