react-native-macos 0.0.0-5ad4444cf → 0.0.0-5cd43232a

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 (88) 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/Image/RCTImageView.mm +2 -8
  18. package/Libraries/LogBox/Data/LogBoxData.js +18 -18
  19. package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +16 -1
  20. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js +2 -0
  21. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js +8 -1
  22. package/Libraries/Text/RawText/RCTRawTextShadowView.m +2 -0
  23. package/Libraries/Text/Text/RCTTextView.m +8 -4
  24. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +10 -8
  25. package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +2 -0
  26. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +15 -3
  27. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +9 -0
  28. package/Libraries/Types/RootTagTypes.js~merged +23 -0
  29. package/README.md +19 -43
  30. package/React/Base/RCTBridgeModule.h +1 -1
  31. package/React/Base/RCTConvert.m +23 -6
  32. package/React/Base/RCTImageSource.m +2 -0
  33. package/React/Base/RCTJSStackFrame.m +2 -0
  34. package/React/Base/RCTJavaScriptLoader.mm +2 -0
  35. package/React/Base/RCTKeyCommands.m +2 -0
  36. package/React/Base/RCTModuleData.mm +2 -0
  37. package/React/Base/RCTModuleMethod.mm +2 -0
  38. package/React/Base/RCTTouchEvent.m +2 -0
  39. package/React/Base/RCTVersion.m +5 -1
  40. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +1 -1
  41. package/React/Base/macOS/RCTPlatformDisplayLink.m +4 -1
  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 +22 -23
  46. package/React/CoreModules/RCTDevLoadingView.mm +14 -9
  47. package/React/CxxModule/RCTCxxMethod.mm +2 -0
  48. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2126 -0
  49. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +2682 -0
  50. package/React/Modules/RCTEventEmitter.h +2 -2
  51. package/React/Modules/RCTLayoutAnimation.m +2 -0
  52. package/React/Modules/RCTLayoutAnimationGroup.m +2 -0
  53. package/React/Views/RCTShadowView.m +3 -1
  54. package/React/Views/RCTSwitch.h +1 -1
  55. package/React/Views/RCTSwitch.m +0 -15
  56. package/React/Views/RCTView.h +5 -2
  57. package/React/Views/RCTView.m +22 -10
  58. package/React/Views/RCTViewManager.m +9 -15
  59. package/React/Views/SafeAreaView/RCTSafeAreaView.m +2 -0
  60. package/React-Core.podspec +0 -11
  61. package/ReactAndroid/gradle.properties +1 -1
  62. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +7 -0
  63. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +7 -0
  64. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java +3 -1
  65. package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java +10 -1
  66. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +5 -1
  67. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +0 -8
  68. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +8 -8
  69. package/ReactAndroid/src/main/jni/third-party/libevent/event-config.h +339 -339
  70. package/ReactCommon/cxxreact/ReactNativeVersion.h +5 -1
  71. package/jest/preprocessor.js +7 -75
  72. package/local-cli/cli.js +0 -0
  73. package/local-cli/generator-macos/templates/macos/Podfile +2 -7
  74. package/package.json +18 -23
  75. package/scripts/react-native-xcode.sh +1 -1
  76. package/scripts/react_native_pods.rb +1 -1
  77. package/template/package.json +4 -2
  78. package/third-party-podspecs/RCT-Folly.podspec +1 -1
  79. package/CHANGELOG.json +0 -500
  80. package/CHANGELOG.md +0 -240
  81. package/Libraries/.npmignore +0 -1
  82. package/React/Base/macOS/RCTDynamicColor.h +0 -28
  83. package/React/Base/macOS/RCTDynamicColor.m +0 -219
  84. package/ReactAndroid/.npmignore +0 -5
  85. package/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore +0 -2
  86. package/ReactCommon/hermes/inspector/tools/msggen/.gitignore +0 -3
  87. package/scripts/fixmacscripts.sh +0 -9
  88. package/scripts/postInstall.js +0 -6
@@ -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];
@@ -66,29 +66,28 @@ NSString *RCTColorSchemePreference(UITraitCollection *traitCollection)
66
66
  #else // [TODO(macOS GH#774)
67
67
  NSString *RCTColorSchemePreference(NSAppearance *appearance)
68
68
  {
69
- if (@available(macOS 10.14, *)) {
70
- static NSDictionary *appearances;
71
- static dispatch_once_t onceToken;
72
-
73
- dispatch_once(&onceToken, ^{
74
- appearances = @{
75
- NSAppearanceNameAqua: RCTAppearanceColorSchemeLight,
76
- NSAppearanceNameDarkAqua: RCTAppearanceColorSchemeDark
77
- };
78
- });
79
-
80
- if (!sAppearancePreferenceEnabled) {
81
- // Return the default if the app doesn't allow different color schemes.
82
- return RCTAppearanceColorSchemeLight;
83
- }
84
-
85
- appearance = appearance ?: [NSAppearance currentAppearance];
86
- NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
87
- return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight;
69
+ static NSDictionary *appearances;
70
+ static dispatch_once_t onceToken;
71
+
72
+ dispatch_once(&onceToken, ^{
73
+ appearances = @{
74
+ NSAppearanceNameAqua: RCTAppearanceColorSchemeLight,
75
+ NSAppearanceNameDarkAqua: RCTAppearanceColorSchemeDark
76
+ };
77
+ });
78
+
79
+ if (!sAppearancePreferenceEnabled) {
80
+ // Return the default if the app doesn't allow different color schemes.
81
+ return RCTAppearanceColorSchemeLight;
88
82
  }
89
83
 
90
- // Default to light on older OS version - same behavior as Android.
91
- return RCTAppearanceColorSchemeLight;
84
+ if (@available(macOS 11.0, *)) {
85
+ appearance = appearance ?: [NSAppearance currentDrawingAppearance];
86
+ } else {
87
+ appearance = appearance ?: [NSAppearance currentAppearance];
88
+ }
89
+ NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
90
+ return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight;
92
91
  }
93
92
  #endif // ]TODO(macOS GH#774)
94
93
 
@@ -165,7 +164,7 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme)
165
164
 
166
165
  - (void)startObserving
167
166
  {
168
- if (@available(macOS 10.14, iOS 13.0, *)) { // TODO(macOS GH#774)
167
+ if (@available(iOS 13.0, *)) {
169
168
  [[NSNotificationCenter defaultCenter] addObserver:self
170
169
  selector:@selector(appearanceChanged:)
171
170
  name:RCTUserInterfaceStyleDidChangeNotification
@@ -175,7 +174,7 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme)
175
174
 
176
175
  - (void)stopObserving
177
176
  {
178
- if (@available(macOS 10.14, iOS 13.0, *)) { // TODO(macOS GH#774)
177
+ if (@available(iOS 13.0, *)) {
179
178
  [[NSNotificationCenter defaultCenter] removeObserver:self];
180
179
  }
181
180
  }
@@ -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