react-native-macos 0.64.27 → 0.64.30

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.
Files changed (29) hide show
  1. package/Libraries/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +25 -0
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/Text/RawText/RCTRawTextShadowView.m +2 -0
  4. package/Libraries/Text/Text/RCTTextView.m +6 -4
  5. package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +2 -0
  6. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +15 -3
  7. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +9 -0
  8. package/React/Base/RCTImageSource.m +2 -0
  9. package/React/Base/RCTJSStackFrame.m +2 -0
  10. package/React/Base/RCTJavaScriptLoader.mm +2 -0
  11. package/React/Base/RCTKeyCommands.m +2 -0
  12. package/React/Base/RCTModuleData.mm +2 -0
  13. package/React/Base/RCTModuleMethod.mm +2 -0
  14. package/React/Base/RCTTouchEvent.m +2 -0
  15. package/React/Base/RCTVersion.m +1 -1
  16. package/React/CoreModules/RCTAddressSanitizerCrashManager.h +12 -0
  17. package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +18 -0
  18. package/React/CxxModule/RCTCxxMethod.mm +2 -0
  19. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +1 -1
  20. package/React/Modules/RCTLayoutAnimation.m +2 -0
  21. package/React/Modules/RCTLayoutAnimationGroup.m +2 -0
  22. package/React/Views/RCTShadowView.m +3 -1
  23. package/React/Views/RCTView.m +4 -8
  24. package/React/Views/SafeAreaView/RCTSafeAreaView.m +2 -0
  25. package/ReactAndroid/gradle.properties +1 -1
  26. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  27. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  28. package/package.json +1 -1
  29. package/template/package.json +1 -1
@@ -0,0 +1,25 @@
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
+ * @format
8
+ * @flow
9
+ */
10
+
11
+ 'use strict';
12
+ import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
13
+ import type {ViewProps} from '../Components/View/ViewPropTypes';
14
+
15
+ const {requireNativeComponent} = require('react-native');
16
+
17
+ type NativeProps = $ReadOnly<{|
18
+ ...ViewProps,
19
+ |}>;
20
+
21
+ const RCTAddressSanitizerCrash: HostComponent<NativeProps> = requireNativeComponent<NativeProps>(
22
+ 'RCTAddressSanitizerCrash',
23
+ );
24
+
25
+ module.exports = RCTAddressSanitizerCrash;
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 64,
15
- patch: 27,
15
+ patch: 30,
16
16
  prerelease: null,
17
17
  };
@@ -24,10 +24,12 @@
24
24
  [self.superview dirtyLayout];
25
25
  }
26
26
 
27
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
27
28
  - (NSString *)description
28
29
  {
29
30
  NSString *superDescription = super.description;
30
31
  return [[superDescription substringToIndex:superDescription.length - 1] stringByAppendingFormat:@"; text: %@>", self.text];
31
32
  }
33
+ #endif // TODO(macOS GH#774)
32
34
 
33
35
  @end
@@ -99,13 +99,15 @@
99
99
  }
100
100
  #endif // ]TODO(macOS GH#774)
101
101
 
102
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
102
103
  - (NSString *)description
103
104
  {
104
- NSString *superDescription = super.description;
105
- NSRange semicolonRange = [superDescription rangeOfString:@";"];
106
- NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@; text: %@", self.reactTag, _textStorage.string];
107
- return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement];
105
+ // [TODO(macOS GH#774): we shouldn't make assumptions on what super's description is. Just append additional content.
106
+ NSString *stringToAppend = [NSString stringWithFormat:@" reactTag: %@; text: %@", self.reactTag, _textStorage.string];
107
+ return [[super description] stringByAppendingString:stringToAppend];
108
+ // TODO(macOS GH#774)]
108
109
  }
110
+ #endif // TODO(macOS GH#774)
109
111
 
110
112
  - (void)setSelectable:(BOOL)selectable
111
113
  {
@@ -36,6 +36,8 @@ NS_ASSUME_NONNULL_BEGIN
36
36
  - (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)
37
37
  #if TARGET_OS_OSX // [TODO(macOS GH#774)
38
38
  - (BOOL)textInputShouldHandleDeleteForward:(id<RCTBackedTextInputViewProtocol>)sender; // Return `YES` to have the deleteForward event handled normally. Return `NO` to disallow it and handle it yourself.
39
+
40
+ - (void)textInputDidCancel; // Handle `Escape` key press.
39
41
  #endif // ]TODO(macOS GH#774)
40
42
 
41
43
  @optional
@@ -187,17 +187,17 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
187
187
 
188
188
  - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector
189
189
  {
190
+ id<RCTBackedTextInputDelegate> textInputDelegate = [_backedTextInputView textInputDelegate];
190
191
  BOOL commandHandled = NO;
191
192
  // enter/return
192
193
  if (commandSelector == @selector(insertNewline:) || commandSelector == @selector(insertNewlineIgnoringFieldEditor:)) {
193
194
  [self textFieldDidEndEditingOnExit];
194
- if ([[_backedTextInputView textInputDelegate] textInputShouldReturn]) {
195
+ if ([textInputDelegate textInputShouldReturn]) {
195
196
  [[_backedTextInputView window] makeFirstResponder:nil];
196
197
  }
197
198
  commandHandled = YES;
198
199
  //backspace
199
200
  } else if (commandSelector == @selector(deleteBackward:)) {
200
- id<RCTBackedTextInputDelegate> textInputDelegate = [_backedTextInputView textInputDelegate];
201
201
  if (textInputDelegate != nil && ![textInputDelegate textInputShouldHandleDeleteBackward:_backedTextInputView]) {
202
202
  commandHandled = YES;
203
203
  } else {
@@ -214,7 +214,13 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
214
214
  //paste
215
215
  } else if (commandSelector == @selector(paste:)) {
216
216
  _backedTextInputView.textWasPasted = YES;
217
- }
217
+ //escape
218
+ } else if (commandSelector == @selector(cancelOperation:)) {
219
+ [textInputDelegate textInputDidCancel];
220
+ [[_backedTextInputView window] makeFirstResponder:nil];
221
+ commandHandled = YES;
222
+ }
223
+
218
224
  return commandHandled;
219
225
  }
220
226
 
@@ -411,6 +417,12 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
411
417
  //deleteForward
412
418
  } else if (commandSelector == @selector(deleteForward:)) {
413
419
  commandHandled = textInputDelegate != nil && ![textInputDelegate textInputShouldHandleDeleteForward:_backedTextInputView];
420
+ //escape
421
+ } else if (commandSelector == @selector(cancelOperation:)) {
422
+ [textInputDelegate textInputDidCancel];
423
+ [_backedTextInputView.window makeFirstResponder:nil];
424
+ commandHandled = YES;
425
+
414
426
  }
415
427
 
416
428
  return commandHandled;
@@ -561,6 +561,15 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
561
561
  - (BOOL)textInputShouldHandleDeleteForward:(__unused id)sender {
562
562
  return YES;
563
563
  }
564
+
565
+ - (void)textInputDidCancel {
566
+ [_eventDispatcher sendTextEventWithType:RCTTextEventTypeKeyPress
567
+ reactTag:self.reactTag
568
+ text:nil
569
+ key:@"Escape"
570
+ eventCount:_nativeEventCount];
571
+ [self textInputDidEndEditing];
572
+ }
564
573
  #endif // ]TODO(macOS GH#774)
565
574
 
566
575
  - (void)updateLocalData
@@ -42,6 +42,7 @@
42
42
  (CGSizeEqualToSize(_size, object.size) || CGSizeEqualToSize(object.size, CGSizeZero));
43
43
  }
44
44
 
45
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
45
46
  - (NSString *)description
46
47
  {
47
48
  return [NSString stringWithFormat:@"<RCTImageSource: %p URL=%@, size=%@, scale=%0.f>",
@@ -50,6 +51,7 @@
50
51
  NSStringFromCGSize(_size),
51
52
  _scale];
52
53
  }
54
+ #endif // TODO(macOS GH#774)
53
55
 
54
56
  @end
55
57
 
@@ -136,6 +136,7 @@ static NSRegularExpression *RCTJSStackFrameRegex()
136
136
  return stack;
137
137
  }
138
138
 
139
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
139
140
  - (NSString *)description
140
141
  {
141
142
  return [NSString stringWithFormat:@"<%@: %p method name: %@; file name: %@; line: %ld; column: %ld>",
@@ -146,5 +147,6 @@ static NSRegularExpression *RCTJSStackFrameRegex()
146
147
  (long)self.lineNumber,
147
148
  (long)self.column];
148
149
  }
150
+ #endif // TODO(macOS GH#774)
149
151
 
150
152
  @end
@@ -62,6 +62,7 @@ static RCTSource *RCTSourceCreate(NSURL *url, NSData *data, int64_t length) NS_R
62
62
 
63
63
  @implementation RCTLoadingProgress
64
64
 
65
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
65
66
  - (NSString *)description
66
67
  {
67
68
  NSMutableString *desc = [NSMutableString new];
@@ -77,6 +78,7 @@ static RCTSource *RCTSourceCreate(NSURL *url, NSData *data, int64_t length) NS_R
77
78
  [desc appendString:@"\u2026"];
78
79
  return desc;
79
80
  }
81
+ #endif // TODO(macOS GH#774)
80
82
 
81
83
  @end
82
84
 
@@ -74,6 +74,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
74
74
  return [_key isEqual:input] && (_flags == flags || flags == 0);
75
75
  }
76
76
 
77
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
77
78
  - (NSString *)description
78
79
  {
79
80
  return [NSString stringWithFormat:@"<%@:%p input=\"%@\" flags=%lld hasBlock=%@>",
@@ -83,6 +84,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
83
84
  (long long)_flags,
84
85
  _block ? @"YES" : @"NO"];
85
86
  }
87
+ #endif // TODO(macOS GH#774)
86
88
 
87
89
  @end
88
90
 
@@ -452,9 +452,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init);
452
452
  _methodQueue = nil;
453
453
  }
454
454
 
455
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
455
456
  - (NSString *)description
456
457
  {
457
458
  return [NSString stringWithFormat:@"<%@: %p; name=\"%@\">", [self class], self, self.name];
458
459
  }
460
+ #endif // TODO(macOS GH#774)
459
461
 
460
462
  @end
@@ -602,6 +602,7 @@ RCT_EXTERN_C_END
602
602
  return [NSString stringWithFormat:@"-[%@ %s]", _moduleClass, sel_getName(_selector)];
603
603
  }
604
604
 
605
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
605
606
  - (NSString *)description
606
607
  {
607
608
  return [NSString stringWithFormat:@"<%@: %p; exports %@ as %s(); type: %s>",
@@ -611,5 +612,6 @@ RCT_EXTERN_C_END
611
612
  self.JSMethodName,
612
613
  RCTFunctionDescriptorFromType(self.functionType)];
613
614
  }
615
+ #endif // TODO(macOS GH#774)
614
616
 
615
617
  @end
@@ -98,10 +98,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
98
98
  return _coalescingKey;
99
99
  }
100
100
 
101
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
101
102
  - (NSString *)description
102
103
  {
103
104
  return [NSString
104
105
  stringWithFormat:@"<%@: %p; name = %@; coalescing key = %hu>", [self class], self, _eventName, _coalescingKey];
105
106
  }
107
+ #endif // TODO(macOS GH#774)
106
108
 
107
109
  @end
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(64),
26
- RCTVersionPatch: @(27),
26
+ RCTVersionPatch: @(30),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -0,0 +1,12 @@
1
+ /*
2
+ *
3
+ * This source code is licensed under the MIT license found in the
4
+ * LICENSE file in the root directory of this source tree.
5
+ */
6
+
7
+ #import <React/RCTUIKit.h>
8
+ #import <React/RCTBridge.h>
9
+
10
+ @interface RCTAddressSanitizerCrashManager : NSObject <RCTBridgeModule>
11
+
12
+ @end
@@ -0,0 +1,18 @@
1
+ //
2
+ // RCTAddressSanitizerCrashManager.mm
3
+ // Pods
4
+ //
5
+
6
+ #import "RCTAddressSanitizerCrashManager.h"
7
+
8
+ @implementation RCTAddressSanitizerCrashManager
9
+
10
+ RCT_EXPORT_MODULE(ASANCrash)
11
+
12
+ RCT_EXPORT_METHOD(invokeMemoryCrash) {
13
+ char *s = (char*)malloc(100);
14
+ free(s);
15
+ strcpy(s, "Hello world!"); // AddressSanitizer: heap-use-after-free
16
+ }
17
+
18
+ @end
@@ -131,9 +131,11 @@ using namespace facebook::react;
131
131
  }
132
132
  }
133
133
 
134
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
134
135
  - (NSString *)description
135
136
  {
136
137
  return [NSString stringWithFormat:@"<%@: %p; name = %s>", [self class], self, self.JSMethodName];
137
138
  }
139
+ #endif // TODO(macOS GH#774)
138
140
 
139
141
  @end
@@ -2326,7 +2326,7 @@ inline facebook::react::LazyVector<JS::NativeExceptionsManager::StackFrame> JS::
2326
2326
  }
2327
2327
  inline double JS::NativeExceptionsManager::ExceptionData::id_() const
2328
2328
  {
2329
- id const p = _v[@"id_"];
2329
+ id const p = _v[@"id"];
2330
2330
  return RCTBridgingToDouble(p);
2331
2331
  }
2332
2332
  inline bool JS::NativeExceptionsManager::ExceptionData::isFatal() const
@@ -190,6 +190,7 @@ static NSString *CAMediaTimingFunctionNameFromRCTAnimationType(RCTAnimationType
190
190
  _animationType == animation.animationType;
191
191
  }
192
192
 
193
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
193
194
  - (NSString *)description
194
195
  {
195
196
  return [NSString
@@ -204,5 +205,6 @@ static NSString *CAMediaTimingFunctionNameFromRCTAnimationType(RCTAnimationType
204
205
  _initialVelocity,
205
206
  (long)_animationType];
206
207
  }
208
+ #endif // TODO(macOS GH#774)
207
209
 
208
210
  @end
@@ -64,6 +64,7 @@
64
64
  [_deletingLayoutAnimation isEqual:deletingLayoutAnimation]);
65
65
  }
66
66
 
67
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
67
68
  - (NSString *)description
68
69
  {
69
70
  return
@@ -75,5 +76,6 @@
75
76
  [_updatingLayoutAnimation description],
76
77
  [_deletingLayoutAnimation description]];
77
78
  }
79
+ #endif // TODO(macOS GH#774)
78
80
 
79
81
  @end
@@ -52,7 +52,7 @@ typedef NS_ENUM(unsigned int, meta_prop_t) {
52
52
  #if !TARGET_OS_OSX // [TODO(macOS GH#774)
53
53
  float pixelsInPoint = RCTScreenScale();
54
54
  #else
55
- float pixelsInPoint = 0; // TODO(ISS#1656079): Turn off pixel rounding for macOS until we can get screen resolution passed here
55
+ float pixelsInPoint = 1; // TODO(ISS#1656079): Use 1x alignment for macOS until we can use backing resolution
56
56
  #endif // ]TODO(macOS GH#774)
57
57
  YGConfigSetPointScaleFactor(yogaConfig, pixelsInPoint);
58
58
  YGConfigSetUseLegacyStretchBehaviour(yogaConfig, true);
@@ -392,6 +392,7 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
392
392
  return self.reactTag;
393
393
  }
394
394
 
395
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
395
396
  - (NSString *)description
396
397
  {
397
398
  NSString *description = super.description;
@@ -402,6 +403,7 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
402
403
  NSStringFromCGRect(self.layoutMetrics.frame)];
403
404
  return description;
404
405
  }
406
+ #endif // TODO(macOS GH#774)
405
407
 
406
408
  - (void)addRecursiveDescriptionToString:(NSMutableString *)string atLevel:(NSUInteger)level
407
409
  {
@@ -708,17 +708,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
708
708
  }
709
709
  #endif // ]TODO(macOS GH#774)
710
710
 
711
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
711
712
  - (NSString *)description
712
713
  {
713
- NSString *superDescription = super.description;
714
- NSRange semicolonRange = [superDescription rangeOfString:@";"];
715
- if (semicolonRange.location == NSNotFound) { // [TODO(macOS GH#774)
716
- return [[superDescription substringToIndex:superDescription.length - 1] stringByAppendingFormat:@"; reactTag: %@; frame = %@; layer = %@>", self.reactTag, NSStringFromCGRect(self.frame), self.layer];
717
- } else { // ]TODO(macOS GH#774)
718
- NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@;", self.reactTag];
719
- return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement];
720
- } // TODO(macOS GH#774)
714
+ // TODO(macOS GH#774): we shouldn't make assumptions on what super's description is. Just append additional content.
715
+ return [[super description] stringByAppendingFormat:@" reactTag: %@; frame = %@; layer = %@", self.reactTag, NSStringFromCGRect(self.frame), self.layer];
721
716
  }
717
+ #endif // TODO(macOS GH#774)
722
718
 
723
719
  #if TARGET_OS_OSX // [TODO(macOS GH#774)
724
720
  - (void)viewDidMoveToWindow
@@ -30,6 +30,7 @@
30
30
  RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
31
31
  RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
32
32
 
33
+ #if DEBUG // TODO(macOS GH#774) description is a debug-only feature
33
34
  - (NSString *)description
34
35
  {
35
36
  NSString *superDescription = [super description];
@@ -44,6 +45,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
44
45
  NSStringFromUIEdgeInsets([self safeAreaInsetsIfSupportedAndEnabled]),
45
46
  NSStringFromUIEdgeInsets(_currentSafeAreaInsets)];
46
47
  }
48
+ #endif // TODO(macOS GH#774)
47
49
 
48
50
  - (BOOL)isSupportedByOS
49
51
  {
@@ -1,5 +1,5 @@
1
1
  # TODO :: ANDROID patch to stay consistant with the npm version.
2
- VERSION_NAME=0.64.27
2
+ VERSION_NAME=0.64.30
3
3
  GROUP=com.facebook.react
4
4
 
5
5
  POM_NAME=ReactNative
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 64,
20
- "patch", 27,
20
+ "patch", 30,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 64;
20
- int32_t Patch = 27;
20
+ int32_t Patch = 30;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.64.27",
3
+ "version": "0.64.30",
4
4
  "bin": "./cli.js",
5
5
  "description": "[Microsoft Fork] A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "17.0.1",
14
- "react-native": "0.64.27"
14
+ "react-native": "0.64.30"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.12.9",