react-native-macos 0.0.0-643b056e8 → 0.0.0-659375de3

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 (91) hide show
  1. package/Libraries/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +25 -0
  2. package/Libraries/Animated/nodes/AnimatedValue.js +0 -1
  3. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +22 -12
  4. package/Libraries/Components/Button.js +1 -1
  5. package/Libraries/Components/CheckBox/CheckBox.macos.js +8 -4
  6. package/Libraries/Components/Keyboard/Keyboard.js +2 -2
  7. package/Libraries/Components/Touchable/TouchableBounce.js +11 -22
  8. package/Libraries/Components/Touchable/TouchableHighlight.js +19 -30
  9. package/Libraries/Components/Touchable/TouchableOpacity.js +14 -29
  10. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +8 -18
  11. package/Libraries/Components/View/ReactNativeViewAttributes.js +8 -7
  12. package/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +1 -2
  13. package/Libraries/Components/View/View.js +8 -10
  14. package/Libraries/Components/View/ViewAccessibility.js +0 -1
  15. package/Libraries/Components/View/ViewPropTypes.js +1 -7
  16. package/Libraries/Core/ReactNativeVersion.js +5 -1
  17. package/Libraries/LogBox/Data/LogBoxData.js +18 -18
  18. package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +16 -1
  19. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js +2 -0
  20. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js +8 -1
  21. package/Libraries/Text/RawText/RCTRawTextShadowView.m +2 -0
  22. package/Libraries/Text/Text/RCTTextView.m +8 -4
  23. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +10 -8
  24. package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +2 -0
  25. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +15 -3
  26. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +10 -1
  27. package/Libraries/Types/RootTagTypes.js~merged +23 -0
  28. package/README.md +18 -42
  29. package/React/Base/RCTBridgeModule.h +1 -1
  30. package/React/Base/RCTConvert.m +23 -6
  31. package/React/Base/RCTImageSource.m +2 -0
  32. package/React/Base/RCTJSStackFrame.m +2 -0
  33. package/React/Base/RCTJavaScriptLoader.mm +2 -0
  34. package/React/Base/RCTKeyCommands.m +2 -0
  35. package/React/Base/RCTModuleData.mm +2 -0
  36. package/React/Base/RCTModuleMethod.mm +2 -0
  37. package/React/Base/RCTTouchEvent.m +2 -0
  38. package/React/Base/RCTVersion.m +5 -1
  39. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +1 -1
  40. package/React/Base/macOS/RCTPlatformDisplayLink.m +4 -1
  41. package/React/CoreModules/RCTActionSheetManager.mm +4 -0
  42. package/React/CoreModules/RCTAddressSanitizerCrashManager.h +12 -0
  43. package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +18 -0
  44. package/React/CoreModules/RCTAlertController.m +8 -4
  45. package/React/CoreModules/RCTAppearance.mm +5 -1
  46. package/React/CoreModules/RCTDevLoadingView.mm +14 -9
  47. package/React/CxxModule/RCTCxxMethod.mm +2 -0
  48. package/React/DevSupport/RCTInspectorDevServerHelper.mm +12 -0
  49. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2126 -0
  50. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +2682 -0
  51. package/React/Modules/RCTEventEmitter.h +2 -2
  52. package/React/Modules/RCTLayoutAnimation.m +2 -0
  53. package/React/Modules/RCTLayoutAnimationGroup.m +2 -0
  54. package/React/Views/RCTShadowView.m +3 -1
  55. package/React/Views/RCTSwitch.h +1 -1
  56. package/React/Views/RCTSwitch.m +0 -15
  57. package/React/Views/RCTView.h +5 -2
  58. package/React/Views/RCTView.m +22 -10
  59. package/React/Views/RCTViewManager.m +9 -15
  60. package/React/Views/SafeAreaView/RCTSafeAreaView.m +2 -0
  61. package/React-Core.podspec +0 -11
  62. package/ReactAndroid/gradle.properties +1 -1
  63. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +7 -0
  64. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +7 -0
  65. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java +3 -1
  66. package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java +10 -1
  67. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +5 -1
  68. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +0 -8
  69. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +8 -8
  70. package/ReactAndroid/src/main/jni/third-party/libevent/event-config.h +339 -339
  71. package/ReactCommon/cxxreact/ReactNativeVersion.h +5 -1
  72. package/ReactCommon/hermes/inspector/tools/msggen/package.json +1 -1
  73. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +1225 -1481
  74. package/jest/preprocessor.js +7 -75
  75. package/local-cli/cli.js +0 -0
  76. package/local-cli/generator-macos/templates/macos/Podfile +2 -7
  77. package/package.json +27 -24
  78. package/scripts/react-native-xcode.sh +1 -1
  79. package/scripts/react_native_pods.rb +1 -1
  80. package/template/package.json +4 -2
  81. package/third-party-podspecs/RCT-Folly.podspec +1 -1
  82. package/CHANGELOG.json +0 -500
  83. package/CHANGELOG.md +0 -240
  84. package/Libraries/.npmignore +0 -1
  85. package/React/Base/macOS/RCTDynamicColor.h +0 -28
  86. package/React/Base/macOS/RCTDynamicColor.m +0 -217
  87. package/ReactAndroid/.npmignore +0 -5
  88. package/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore +0 -2
  89. package/ReactCommon/hermes/inspector/tools/msggen/.gitignore +0 -3
  90. package/scripts/fixmacscripts.sh +0 -9
  91. package/scripts/postInstall.js +0 -6
@@ -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
@@ -32,12 +32,16 @@
32
32
 
33
33
  - (void)show:(BOOL)animated completion:(void (^)(void))completion
34
34
  {
35
- [self.alertWindow makeKeyAndVisible];
36
-
37
35
  // [TODO(macOS GH#774)
36
+ // Call self.alertWindow to ensure that it gets populated
37
+ UIWindow *alertWindow = self.alertWindow;
38
+
38
39
  // If the window is tracked by our application then it will show the alert
39
- if ([[[UIApplication sharedApplication] windows] containsObject:self.alertWindow]) {
40
- [self.alertWindow.rootViewController presentViewController:self animated:animated completion:completion];
40
+ if ([[[UIApplication sharedApplication] windows] containsObject:alertWindow]) {
41
+ // On iOS 14, makeKeyAndVisible should only be called if alertWindow is tracked by the application.
42
+ // Later versions of iOS appear to already do this check for us behind the scenes.
43
+ [alertWindow makeKeyAndVisible];
44
+ [alertWindow.rootViewController presentViewController:self animated:animated completion:completion];
41
45
  } else {
42
46
  // When using Scenes, we must present the alert from a view controller associated with a window in the Scene. A fresh window (i.e. _alertWindow) cannot show the alert.
43
47
  [RCTPresentedViewController() presentViewController:self animated:animated completion:completion];
@@ -81,7 +81,11 @@ NSString *RCTColorSchemePreference(NSAppearance *appearance)
81
81
  return RCTAppearanceColorSchemeLight;
82
82
  }
83
83
 
84
- appearance = appearance ?: [NSAppearance currentAppearance];
84
+ if (@available(macOS 11.0, *)) {
85
+ appearance = appearance ?: [NSAppearance currentDrawingAppearance];
86
+ } else {
87
+ appearance = appearance ?: [NSAppearance currentAppearance];
88
+ }
85
89
  NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
86
90
  return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight;
87
91
  }
@@ -266,16 +266,21 @@ RCT_EXPORT_METHOD(hide)
266
266
 
267
267
  - (void)showOfflineMessage
268
268
  {
269
- RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
270
- RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // TODO(macOS GH#774)
271
-
272
- if ([self isDarkModeEnabled]) {
273
- color = [RCTUIColor blackColor]; // TODO(macOS GH#774)
274
- backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
275
- }
269
+ // [TODO(macOS GH#774) - isDarkModeEnabled should only be run on the main thread
270
+ __weak __typeof(self) weakSelf = self;
271
+ RCTExecuteOnMainQueue(^{
272
+ RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
273
+ RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // TODO(macOS GH#774)
274
+
275
+ if ([weakSelf isDarkModeEnabled]) {
276
+ color = [RCTUIColor blackColor]; // TODO(macOS GH#774)
277
+ backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
278
+ }
276
279
 
277
- NSString *message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
278
- [self showMessage:message color:color backgroundColor:backgroundColor];
280
+ NSString *message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
281
+ [weakSelf showMessage:message color:color backgroundColor:backgroundColor];
282
+ });
283
+ // ]TODO(macOS GH#774)
279
284
  }
280
285
 
281
286
  - (BOOL)isDarkModeEnabled
@@ -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
@@ -110,9 +110,21 @@ static void sendEventToAllConnections(NSString *event)
110
110
  }
111
111
 
112
112
  NSString *key = [inspectorURL absoluteString];
113
+ // [TODO(macOS GH#774) - safety check to avoid a crash
114
+ if (key == nil) {
115
+ RCTLogError(@"failed to get inspector URL");
116
+ return nil;
117
+ }
118
+ // ]TODO(macOS GH#774)
113
119
  RCTInspectorPackagerConnection *connection = socketConnections[key];
114
120
  if (!connection || !connection.isConnected) {
115
121
  connection = [[RCTInspectorPackagerConnection alloc] initWithURL:inspectorURL];
122
+ // [TODO(macOS GH#774) - safety check to avoid a crash
123
+ if (connection == nil) {
124
+ RCTLogError(@"failed to initialize RCTInspectorPackagerConnection");
125
+ return nil;
126
+ }
127
+ // ]TODO(macOS GH#774)
116
128
  socketConnections[key] = connection;
117
129
  [connection connect];
118
130
  }