react-native-macos 0.0.0-90501d6f2 → 0.0.0-9afecd51b

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 (61) hide show
  1. package/Libraries/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +25 -0
  2. package/Libraries/Animated/nodes/AnimatedValue.js +0 -1
  3. package/Libraries/Components/Button.js +1 -1
  4. package/Libraries/Components/CheckBox/CheckBox.macos.js +8 -4
  5. package/Libraries/Components/Keyboard/Keyboard.js +2 -2
  6. package/Libraries/Components/Touchable/TouchableBounce.js +11 -22
  7. package/Libraries/Components/Touchable/TouchableHighlight.js +19 -30
  8. package/Libraries/Components/Touchable/TouchableOpacity.js +14 -29
  9. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +8 -18
  10. package/Libraries/Components/View/ReactNativeViewAttributes.js +8 -7
  11. package/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +1 -2
  12. package/Libraries/Components/View/View.js +8 -10
  13. package/Libraries/Components/View/ViewAccessibility.js +0 -1
  14. package/Libraries/Components/View/ViewPropTypes.js +1 -7
  15. package/Libraries/Core/ReactNativeVersion.js +5 -1
  16. package/Libraries/LogBox/Data/LogBoxData.js +18 -18
  17. package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +16 -1
  18. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js +2 -0
  19. package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js +8 -1
  20. package/Libraries/Text/Text/RCTTextView.m +7 -1
  21. package/Libraries/Types/RootTagTypes.js~merged +23 -0
  22. package/README.md +14 -39
  23. package/React/Base/RCTBridgeModule.h +1 -1
  24. package/React/Base/RCTConvert.m +22 -5
  25. package/React/Base/RCTVersion.m +5 -1
  26. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +1 -1
  27. package/React/CoreModules/RCTAddressSanitizerCrashManager.h +12 -0
  28. package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +18 -0
  29. package/React/CoreModules/RCTAlertController.m +8 -4
  30. package/React/CoreModules/RCTAppearance.mm +5 -1
  31. package/React/CoreModules/RCTDevLoadingView.mm +14 -9
  32. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2126 -0
  33. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +2682 -0
  34. package/React/Modules/RCTEventEmitter.h +2 -2
  35. package/React/Views/RCTView.h +2 -2
  36. package/React/Views/RCTView.m +2 -2
  37. package/React/Views/RCTViewManager.m +0 -7
  38. package/React-Core.podspec +0 -11
  39. package/ReactAndroid/gradle.properties +1 -1
  40. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +7 -0
  41. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +7 -0
  42. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java +3 -1
  43. package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java +10 -1
  44. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +5 -1
  45. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +8 -8
  46. package/ReactAndroid/src/main/jni/third-party/libevent/event-config.h +339 -339
  47. package/ReactCommon/cxxreact/ReactNativeVersion.h +5 -1
  48. package/jest/preprocessor.js +7 -75
  49. package/local-cli/cli.js +0 -0
  50. package/package.json +8 -10
  51. package/scripts/react-native-xcode.sh +1 -1
  52. package/scripts/react_native_pods.rb +1 -1
  53. package/template/package.json +3 -1
  54. package/CHANGELOG.json +0 -500
  55. package/CHANGELOG.md +0 -240
  56. package/Libraries/.npmignore +0 -1
  57. package/React/Base/macOS/RCTDynamicColor.h +0 -28
  58. package/React/Base/macOS/RCTDynamicColor.m +0 -217
  59. package/ReactAndroid/.npmignore +0 -5
  60. package/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore +0 -2
  61. package/ReactCommon/hermes/inspector/tools/msggen/.gitignore +0 -3
package/README.md CHANGED
@@ -16,11 +16,11 @@
16
16
  </a>
17
17
  </p>
18
18
 
19
- > See the official [React Native website](https://reactnative.dev/) for an introduction to React Native.
19
+ > See the official [React Native website](https://reactnative.dev/) for an introduction to React Native.
20
20
 
21
21
  [React Native](https://reactnative.dev) is a framework developed by Facebook that enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and [React](https://reactjs.org/). The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere.
22
22
 
23
- This repository is a working fork of **facebook/react-native** that adds support for the official React Native for macOS implementation from Microsoft.
23
+ This repository is a working fork of **facebook/react-native** that adds support for the official React Native for macOS implementation from Microsoft.
24
24
 
25
25
  [hello-world]: https://snack.expo.io/@hramos/hello,-world!
26
26
  [new-app]: https://reactnative.dev/docs/getting-started
@@ -28,38 +28,6 @@ This repository is a working fork of **facebook/react-native** that adds support
28
28
 
29
29
  You can read more about the macOS implementation in our website - [React Native for Windows + macOS](https://microsoft.github.io/react-native-windows/)
30
30
 
31
- The full documentation for React Native can be found on our [website][docs].
32
-
33
- The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the [React documentation][r-docs].
34
-
35
- The source for the React Native documentation and website is hosted on a separate repo, [**@facebook/react-native-website**][repo-website].
36
-
37
- [docs]: https://reactnative.dev/docs/getting-started
38
- [r-docs]: https://reactjs.org/docs/getting-started.html
39
- [repo-website]: https://github.com/facebook/react-native-website
40
-
41
- ## 🚀 Upgrading
42
-
43
- Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the [Upgrading Guide][u] for instructions.
44
-
45
- React Native releases are discussed in the React Native Community, [**@react-native-community/react-native-releases**][repo-releases].
46
-
47
- [u]: https://reactnative.dev/docs/upgrading
48
- [repo-releases]: https://github.com/react-native-community/react-native-releases
49
-
50
- ## 👏 How to Contribute
51
-
52
- You can read more about the macOS implementation on our website - [React Native for Windows + macOS](https://microsoft.github.io/react-native-windows/)
53
-
54
- ## Contents
55
-
56
- - [Requirements](#requirements)
57
- - [Getting Started](#getting-started)
58
- - [Contributing](#contributing)
59
- - [Documentation](#documentation)
60
- - [License](#license)
61
- - [Code of Conduct](#code-of-conduct)
62
-
63
31
  ## Requirements
64
32
 
65
33
  You can run React Native for macOS apps on Mac devices with versions Catalina (10.15) or newer.
@@ -67,25 +35,31 @@ You can run React Native for macOS apps on Mac devices with versions Catalina (1
67
35
  For a full and detailed list of the system requirements and how to set up your development platform, see our [System Requirements](https://microsoft.github.io/react-native-windows/docs/rnm-dependencies) documentation on our website.
68
36
 
69
37
  ## Getting Started
38
+
70
39
  See the [Getting Started Guide](https://microsoft.github.io/react-native-windows/docs/rnm-getting-started) on our React Native for Windows + macOS website to build your first React Native for macOS app.
71
40
 
72
41
  ### Logging Issues
42
+
73
43
  Search the [existing issues](https://github.com/microsoft/react-native-macos/issues) and try to make sure your problem doesn’t already exist before opening a new issue. If your issue doesn't exist yet, try to make sure you provide as much information as possible to us so we can help you sooner. It’s helpful if you include information like:
74
44
 
75
45
  - The version of macOS, React Native, React Native macOS extension where you ran into the issue.
76
46
  - A stack trace and reduced repro case when possible.
77
47
  - Ensure the [appropriate template](https://github.com/microsoft/react-native-macos/issues/new/choose) is used when filing your issue(s).
78
48
 
79
- ## Contributing
49
+ ## Contributing
50
+
80
51
  See [Contributing guidelines](https://github.com/microsoft/react-native-macos/blob/master/CONTRIBUTING.md) for how to set up your fork of the repo and start a PR to contribute to React Native for macOS.
81
52
 
82
53
  [Good First Issue](https://github.com/microsoft/react-native-macos/labels/good%20first%20issue) and [help wanted](https://github.com/microsoft/react-native-macos/labels/help%20wanted) are great starting points for PRs.
83
54
 
84
55
  ## Documentation
85
- [React Native already has great documentation](https://reactnative.dev/docs/getting-started) and we're working to ensure the React Native for Windows + macOS are part of that documentation story.
56
+
57
+ The full documentation for React Native can be found on the [documentation website][docs]. The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the [React documentation][r-docs].
58
+
59
+ The source for the React Native documentation and website is hosted on a separate repo, [**@facebook/react-native-website**][repo-website].
86
60
 
87
61
  [React Native for Windows + macOS](https://microsoft.github.io/react-native-windows/) has its own separate documentation site where Windows and macOS
88
- specific information, like API docs and blog updates live. We are bootstrapping documentation for macOS at this time, tune in for updates.
62
+ specific information, like API docs and blog updates live. We are still working on the documentation for macOS, contributions are welcome!
89
63
 
90
64
  ### Examples
91
65
 
@@ -100,5 +74,6 @@ The React Native for macOS extension, including modifications to the original Fa
100
74
 
101
75
  This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
102
76
 
103
- [l]: https://github.com/facebook/react-native/blob/HEAD/LICENSE
104
- [ld]: https://github.com/facebook/react-native/blob/HEAD/LICENSE-docs
77
+ [docs]: https://reactnative.dev/docs/getting-started
78
+ [r-docs]: https://reactjs.org/docs/getting-started.html
79
+ [repo-website]: https://github.com/facebook/react-native-website
@@ -441,7 +441,7 @@ typedef NSURL * (^RCTBridgelessBundleURLGetter)(void);
441
441
  andSetter:(RCTBridgelessBundleURLSetter)setter
442
442
  andDefaultGetter:(RCTBridgelessBundleURLGetter)defaultGetter;
443
443
  - (void)resetBundleURL;
444
- @property NSURL *bundleURL;
444
+ @property (strong) NSURL *bundleURL; // TODO(macOS GH#774)
445
445
  @end
446
446
 
447
447
  typedef RCTPlatformView * (^RCTBridgelessComponentViewProvider)(NSNumber *); // TODO(macOS GH#774)
@@ -16,10 +16,6 @@
16
16
  #import "RCTParserUtils.h"
17
17
  #import "RCTUtils.h"
18
18
 
19
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
20
- #import "RCTDynamicColor.h"
21
- #endif // ]TODO(macOS GH#774)
22
-
23
19
  @implementation RCTConvert
24
20
 
25
21
  RCT_CONVERTER(id, id, self)
@@ -1043,7 +1039,28 @@ static NSColor *RCTColorWithSystemEffect(NSColor* color, NSString *systemEffectS
1043
1039
  RCTUIColor *highContrastDarkColor = [RCTConvert UIColor:highContrastDark]; // TODO(macOS GH#750)
1044
1040
  if (lightColor != nil && darkColor != nil) {
1045
1041
  #if TARGET_OS_OSX
1046
- RCTDynamicColor *color = [[RCTDynamicColor alloc] initWithAquaColor:lightColor darkAquaColor:darkColor];
1042
+ NSColor *color = [NSColor colorWithName:nil dynamicProvider:^NSColor * _Nonnull(NSAppearance * _Nonnull appearance) {
1043
+ NSMutableArray<NSAppearanceName> *appearances = [NSMutableArray arrayWithArray:@[NSAppearanceNameAqua,NSAppearanceNameDarkAqua]];
1044
+ if (highContrastLightColor != nil) {
1045
+ [appearances addObject:NSAppearanceNameAccessibilityHighContrastAqua];
1046
+ }
1047
+ if (highContrastDarkColor != nil) {
1048
+ [appearances addObject:NSAppearanceNameAccessibilityHighContrastDarkAqua];
1049
+ }
1050
+ NSAppearanceName bestMatchingAppearance = [appearance bestMatchFromAppearancesWithNames:appearances];
1051
+ if (bestMatchingAppearance == NSAppearanceNameAqua) {
1052
+ return lightColor;
1053
+ } else if (bestMatchingAppearance == NSAppearanceNameDarkAqua) {
1054
+ return darkColor;
1055
+ } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastAqua) {
1056
+ return highContrastLightColor;
1057
+ } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastDarkAqua) {
1058
+ return highContrastDarkColor;
1059
+ } else {
1060
+ RCTLogConvertError(json, @"an NSColorColor. Could not resolve current appearance. Defaulting to light.");
1061
+ return lightColor;
1062
+ }
1063
+ }];
1047
1064
  return color;
1048
1065
  #else
1049
1066
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
@@ -15,6 +15,10 @@ 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)]
18
22
  NSDictionary* RCTGetReactNativeVersion(void)
19
23
  {
20
24
  static NSDictionary* __rnVersion;
@@ -24,7 +28,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
28
  RCTVersionMajor: @(0),
25
29
  RCTVersionMinor: @(0),
26
30
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"90501d6f2",
31
+ RCTVersionPrerelease: @"9afecd51b",
28
32
  };
29
33
  });
30
34
  return __rnVersion;
@@ -62,7 +62,7 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
62
62
  [self _updateViews];
63
63
 
64
64
  // For backward compatibility with RCTRootView, set a color here instead of transparent (OS default).
65
- self.backgroundColor = [RCTUIColor whiteColor];
65
+ self.backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
66
66
  }
67
67
 
68
68
  return self;
@@ -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
@@ -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