react-native-macos 0.0.0-2ae308a98 → 0.0.0-2b31eb9de

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 (208) hide show
  1. package/Libraries/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +2 -3
  2. package/Libraries/Alert/Alert.js +2 -2
  3. package/Libraries/Alert/RCTAlertManager.android.js +1 -1
  4. package/Libraries/Animated/AnimatedImplementation.js +53 -53
  5. package/Libraries/Animated/AnimatedMock.js +8 -8
  6. package/Libraries/Animated/NativeAnimatedHelper.js +23 -20
  7. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  8. package/Libraries/Animated/nodes/AnimatedNode.js +10 -9
  9. package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
  10. package/Libraries/AppState/AppState.js +8 -7
  11. package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +2 -2
  12. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +22 -20
  13. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -2
  14. package/Libraries/Components/Button.js +1 -2
  15. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +6 -7
  16. package/Libraries/Components/Keyboard/Keyboard.js +8 -7
  17. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +5 -10
  18. package/Libraries/Components/Pressable/Pressable.js +1 -2
  19. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +2 -1
  20. package/Libraries/Components/RefreshControl/RefreshControl.js +2 -7
  21. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -3
  22. package/Libraries/Components/SafeAreaView/SafeAreaView.js +2 -2
  23. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -5
  24. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +3 -5
  25. package/Libraries/Components/ScrollView/ScrollView.js +27 -59
  26. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +5 -4
  27. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -2
  28. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +2 -8
  29. package/Libraries/Components/Sound/SoundManager.js +1 -1
  30. package/Libraries/Components/TextInput/InputAccessoryView.js +1 -2
  31. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +3 -5
  32. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +3 -5
  33. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  34. package/Libraries/Components/TextInput/TextInput.js +20 -11
  35. package/Libraries/Components/ToastAndroid/ToastAndroid.android.js +3 -3
  36. package/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +3 -3
  37. package/Libraries/Components/Touchable/BoundingDimensions.js +2 -2
  38. package/Libraries/Components/Touchable/PooledClass.js +6 -6
  39. package/Libraries/Components/Touchable/Position.js +1 -1
  40. package/Libraries/Components/Touchable/Touchable.js +26 -25
  41. package/Libraries/Components/Touchable/TouchableBounce.js +1 -2
  42. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -2
  43. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +4 -11
  44. package/Libraries/Components/Touchable/TouchableOpacity.js +1 -2
  45. package/Libraries/Components/View/View.js +0 -7
  46. package/Libraries/Components/View/ViewNativeComponent.js +3 -4
  47. package/Libraries/Core/Devtools/parseHermesStack.js +2 -1
  48. package/Libraries/Core/ExceptionsManager.js +2 -2
  49. package/Libraries/Core/NativeExceptionsManager.js +2 -3
  50. package/Libraries/Core/ReactNativeVersion.js +1 -1
  51. package/Libraries/Core/Timers/JSTimers.js +17 -13
  52. package/Libraries/Core/setUpAlert.js +1 -1
  53. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  54. package/Libraries/Core/setUpPerformance.js +1 -1
  55. package/Libraries/Core/setUpRegeneratorRuntime.js +1 -1
  56. package/Libraries/Core/setUpSegmentFetcher.js +4 -4
  57. package/Libraries/EventEmitter/NativeEventEmitter.js +2 -1
  58. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +2 -1
  59. package/Libraries/HeapCapture/HeapCapture.js +1 -1
  60. package/Libraries/Image/AssetSourceResolver.js +2 -4
  61. package/Libraries/Image/Image.android.js +4 -4
  62. package/Libraries/Image/Image.ios.js +3 -3
  63. package/Libraries/Image/ImageAnalyticsTagContext.js +2 -3
  64. package/Libraries/Image/ImageBackground.js +1 -2
  65. package/Libraries/Image/ImagePickerIOS.js +6 -6
  66. package/Libraries/Image/ImageViewNativeComponent.js +2 -4
  67. package/Libraries/Image/NativeImageLoaderAndroid.js +1 -3
  68. package/Libraries/Image/RCTImageCache.m +1 -1
  69. package/Libraries/Image/TextInlineImageNativeComponent.js +3 -5
  70. package/Libraries/Inspector/ElementProperties.js +2 -4
  71. package/Libraries/Inspector/InspectorOverlay.js +1 -2
  72. package/Libraries/Inspector/InspectorPanel.js +1 -2
  73. package/Libraries/Inspector/NetworkOverlay.js +5 -11
  74. package/Libraries/Interaction/BridgeSpyStallHandler.js +1 -1
  75. package/Libraries/Interaction/FrameRateLogger.js +2 -2
  76. package/Libraries/Interaction/InteractionManager.js +2 -4
  77. package/Libraries/Interaction/JSEventLoopWatchdog.js +4 -4
  78. package/Libraries/Interaction/PanResponder.js +3 -4
  79. package/Libraries/Interaction/TouchHistoryMath.js +7 -7
  80. package/Libraries/JSInspector/NetworkAgent.js +1 -6
  81. package/Libraries/LayoutAnimation/LayoutAnimation.js +3 -3
  82. package/Libraries/Lists/FillRateHelper.js +1 -3
  83. package/Libraries/Lists/FlatList.js +16 -4
  84. package/Libraries/Lists/ViewabilityHelper.js +4 -10
  85. package/Libraries/Lists/VirtualizeUtils.js +2 -6
  86. package/Libraries/Lists/VirtualizedList.js +102 -78
  87. package/Libraries/Lists/VirtualizedListContext.js +3 -5
  88. package/Libraries/Lists/VirtualizedSectionList.js +54 -63
  89. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  90. package/Libraries/LogBox/Data/parseLogBoxLog.js +12 -23
  91. package/Libraries/LogBox/UI/LogBoxButton.js +2 -4
  92. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +2 -4
  93. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -2
  94. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -2
  95. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +3 -6
  96. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -2
  97. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -4
  98. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +2 -4
  99. package/Libraries/LogBox/UI/LogBoxNotification.js +2 -4
  100. package/Libraries/Modal/Modal.js +2 -4
  101. package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -4
  102. package/Libraries/Network/XHRInterceptor.js +5 -6
  103. package/Libraries/NewAppScreen/components/Header.js +2 -4
  104. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -2
  105. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +2 -4
  106. package/Libraries/Performance/SamplingProfiler.js +3 -3
  107. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -3
  108. package/Libraries/Pressability/Pressability.js +2 -2
  109. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +4 -2
  110. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +8 -7
  111. package/Libraries/ReactNative/AppContainer.js +4 -6
  112. package/Libraries/ReactNative/AppRegistry.js +2 -3
  113. package/Libraries/ReactNative/I18nManager.js +2 -5
  114. package/Libraries/ReactNative/PaperUIManager.js +2 -3
  115. package/Libraries/ReactNative/RootTag.js +2 -3
  116. package/Libraries/ReactNative/renderApplication.js +1 -2
  117. package/Libraries/Storage/AsyncStorage.js +21 -21
  118. package/Libraries/StyleSheet/StyleSheet.js +2 -1
  119. package/Libraries/StyleSheet/StyleSheetTypes.js +1 -1
  120. package/Libraries/StyleSheet/processColor.js +2 -2
  121. package/Libraries/StyleSheet/splitLayoutProps.js +1 -3
  122. package/Libraries/Text/RCTTextAttributes.m +15 -8
  123. package/Libraries/Text/Text.js +2 -1
  124. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +10 -0
  125. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +17 -4
  126. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +8 -0
  127. package/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +12 -0
  128. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +8 -2
  129. package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +3 -2
  130. package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +4 -0
  131. package/Libraries/Text/TextInput/Singleline/RCTUITextField.h +2 -0
  132. package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +28 -2
  133. package/Libraries/Text/TextNativeComponent.js +3 -5
  134. package/Libraries/Utilities/Appearance.js +8 -5
  135. package/Libraries/Utilities/BackHandler.android.js +4 -4
  136. package/Libraries/Utilities/HMRClient.js +2 -2
  137. package/Libraries/Utilities/JSDevSupportModule.js +3 -4
  138. package/Libraries/Utilities/MatrixMath.js +19 -19
  139. package/Libraries/Utilities/PerformanceLoggerContext.js +2 -3
  140. package/Libraries/Utilities/ReactNativeTestTools.js +2 -4
  141. package/Libraries/Utilities/SceneTracker.js +1 -3
  142. package/Libraries/Utilities/__mocks__/BackHandler.js +3 -3
  143. package/Libraries/Utilities/buildStyleInterpolator.js +9 -9
  144. package/Libraries/Utilities/codegenNativeComponent.js +4 -2
  145. package/Libraries/Utilities/differ/deepDiffer.js +1 -1
  146. package/Libraries/Utilities/differ/insetsDiffer.js +1 -1
  147. package/Libraries/Utilities/differ/matricesDiffer.js +1 -1
  148. package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
  149. package/Libraries/Utilities/differ/sizesDiffer.js +1 -1
  150. package/Libraries/Utilities/logError.js +1 -1
  151. package/Libraries/Utilities/mergeIntoFast.js +1 -1
  152. package/Libraries/Utilities/truncate.js +1 -1
  153. package/Libraries/Vibration/Vibration.js +2 -2
  154. package/Libraries/WebSocket/WebSocketInterceptor.js +4 -4
  155. package/Libraries/promiseRejectionTrackingOptions.js +1 -1
  156. package/Libraries/vendor/emitter/_EmitterSubscription.js +2 -1
  157. package/Libraries/vendor/emitter/_EventEmitter.js +2 -1
  158. package/Libraries/vendor/emitter/_EventSubscription.js +2 -1
  159. package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +1 -1
  160. package/React/Base/RCTRootView.m +0 -42
  161. package/React/Base/RCTTouchHandler.m +11 -1
  162. package/React/Base/RCTUIKit.h +2 -0
  163. package/React/Base/RCTVersion.m +1 -1
  164. package/React/Base/macOS/RCTPlatformDisplayLink.m +3 -1
  165. package/React/Base/macOS/RCTUIKit.m +13 -0
  166. package/React/CoreModules/RCTDevLoadingView.mm +1 -1
  167. package/React/Fabric/RCTImageResponseObserverProxy.h +1 -0
  168. package/React/Modules/RCTUIManager.m +31 -12
  169. package/React/Views/RCTView.m +3 -0
  170. package/React/Views/ScrollView/RCTScrollView.m +36 -21
  171. package/React/Views/UIView+React.m +18 -10
  172. package/ReactAndroid/build.gradle +2 -1
  173. package/ReactAndroid/gradle.properties +2 -1
  174. package/ReactAndroid/src/androidTest/js/AnimatedTransformTestModule.js +1 -2
  175. package/ReactAndroid/src/androidTest/js/Asserts.js +2 -2
  176. package/ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js +1 -1
  177. package/ReactAndroid/src/androidTest/js/JSResponderTestApp.js +1 -2
  178. package/ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js +1 -2
  179. package/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js +54 -54
  180. package/ReactAndroid/src/androidTest/js/ProgressBarTestModule.js +1 -1
  181. package/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js +6 -7
  182. package/ReactAndroid/src/androidTest/js/ShareTestModule.js +1 -1
  183. package/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js +12 -19
  184. package/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js +2 -3
  185. package/ReactAndroid/src/androidTest/js/TestJSLocaleModule.js +2 -2
  186. package/ReactAndroid/src/androidTest/js/TestJSToJavaParametersModule.js +17 -17
  187. package/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js +10 -10
  188. package/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js +2 -2
  189. package/ReactAndroid/src/androidTest/js/TextInputTestModule.js +2 -3
  190. package/ReactAndroid/src/androidTest/js/TouchBubblingTestAppModule.js +3 -6
  191. package/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +3 -6
  192. package/ReactAndroid/src/androidTest/js/ViewRenderingTestModule.js +5 -5
  193. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  194. package/ReactAndroid/src/main/third-party/android/androidx/BUCK +16 -4
  195. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  196. package/ReactCommon/hermes/inspector/tools/msggen/package.json +1 -1
  197. package/ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js +1 -1
  198. package/ReactCommon/hermes/inspector/tools/msggen/src/index.js +1 -1
  199. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +346 -1294
  200. package/jest/assetFileTransformer.js +2 -2
  201. package/jest/preprocessor.js +2 -2
  202. package/jest/setup.js +3 -3
  203. package/package.json +26 -27
  204. package/template/App.js +4 -8
  205. package/template/Gemfile.lock +6 -6
  206. package/template/ios/HelloWorldTests/HelloWorldTests.m +1 -0
  207. package/template/package.json +1 -1
  208. package/Libraries/Types/RootTagTypes.js~merged +0 -23
@@ -25,7 +25,7 @@ function unstable_setLogListeners(listeners: ?LogListeners) {
25
25
  /*
26
26
  * @returns {bool} true if different, false if equal
27
27
  */
28
- const deepDiffer = function(
28
+ const deepDiffer = function (
29
29
  one: any,
30
30
  two: any,
31
31
  maxDepthOrOptions: Options | number = -1,
@@ -25,7 +25,7 @@ const dummyInsets = {
25
25
  bottom: undefined,
26
26
  };
27
27
 
28
- const insetsDiffer = function(one: Inset, two: Inset): boolean {
28
+ const insetsDiffer = function (one: Inset, two: Inset): boolean {
29
29
  one = one || dummyInsets;
30
30
  two = two || dummyInsets;
31
31
  return (
@@ -19,7 +19,7 @@
19
19
  * @param {MatrixMath.Matrix} two Second matrix.
20
20
  * @return {boolean} Whether or not the two matrices differ.
21
21
  */
22
- const matricesDiffer = function(
22
+ const matricesDiffer = function (
23
23
  one: ?Array<number>,
24
24
  two: ?Array<number>,
25
25
  ): boolean {
@@ -18,7 +18,7 @@ type Point = {
18
18
 
19
19
  const dummyPoint = {x: undefined, y: undefined};
20
20
 
21
- const pointsDiffer = function(one: ?Point, two: ?Point): boolean {
21
+ const pointsDiffer = function (one: ?Point, two: ?Point): boolean {
22
22
  one = one || dummyPoint;
23
23
  two = two || dummyPoint;
24
24
  return one !== two && (one.x !== two.x || one.y !== two.y);
@@ -13,7 +13,7 @@
13
13
  const dummySize = {width: undefined, height: undefined};
14
14
  type Size = {width: ?number, height: ?number};
15
15
 
16
- const sizesDiffer = function(one: Size, two: Size): boolean {
16
+ const sizesDiffer = function (one: Size, two: Size): boolean {
17
17
  const defaultedOne = one || dummySize;
18
18
  const defaultedTwo = two || dummySize;
19
19
  return (
@@ -15,7 +15,7 @@
15
15
  * `console.error` as a failure callback - it's not properly bound. If passes an
16
16
  * `Error` object, it will print the message and stack.
17
17
  */
18
- const logError = function(...args: $ReadOnlyArray<mixed>) {
18
+ const logError = function (...args: $ReadOnlyArray<mixed>) {
19
19
  if (args.length === 1 && args[0] instanceof Error) {
20
20
  const err = args[0];
21
21
  console.error('Error: "' + err.message + '". Stack:\n' + err.stack);
@@ -17,7 +17,7 @@
17
17
  * @param {object} one Object to assign to.
18
18
  * @param {object} two Object to assign from.
19
19
  */
20
- const mergeIntoFast = function(one: Object, two: Object): void {
20
+ const mergeIntoFast = function (one: Object, two: Object): void {
21
21
  for (const keyTwo in two) {
22
22
  one[keyTwo] = two[keyTwo];
23
23
  }
@@ -24,7 +24,7 @@ const defaultOptions = {
24
24
  };
25
25
 
26
26
  // maxChars (including ellipsis)
27
- const truncate = function(
27
+ const truncate = function (
28
28
  str: ?string,
29
29
  maxChars: number,
30
30
  options?: truncateOptions,
@@ -70,7 +70,7 @@ const Vibration = {
70
70
  *
71
71
  * See https://reactnative.dev/docs/vibration#vibrate
72
72
  */
73
- vibrate: function(
73
+ vibrate: function (
74
74
  pattern: number | Array<number> = _default_vibration_length,
75
75
  repeat: boolean = false,
76
76
  ) {
@@ -100,7 +100,7 @@ const Vibration = {
100
100
  *
101
101
  * See https://reactnative.dev/docs/vibration#cancel
102
102
  */
103
- cancel: function() {
103
+ cancel: function () {
104
104
  if (Platform.OS === 'ios') {
105
105
  _vibrating = false;
106
106
  } else {
@@ -144,7 +144,7 @@ const WebSocketInterceptor = {
144
144
  // Override `connect` method for all RCTWebSocketModule requests
145
145
  // to intercept the request url, protocols, options and socketId,
146
146
  // then pass them through the `connectCallback`.
147
- NativeWebSocketModule.connect = function(
147
+ NativeWebSocketModule.connect = function (
148
148
  url,
149
149
  protocols,
150
150
  options,
@@ -158,7 +158,7 @@ const WebSocketInterceptor = {
158
158
 
159
159
  // Override `send` method for all RCTWebSocketModule requests to intercept
160
160
  // the data sent, then pass them through the `sendCallback`.
161
- NativeWebSocketModule.send = function(data, socketId) {
161
+ NativeWebSocketModule.send = function (data, socketId) {
162
162
  if (sendCallback) {
163
163
  sendCallback(data, socketId);
164
164
  }
@@ -167,7 +167,7 @@ const WebSocketInterceptor = {
167
167
 
168
168
  // Override `sendBinary` method for all RCTWebSocketModule requests to
169
169
  // intercept the data sent, then pass them through the `sendCallback`.
170
- NativeWebSocketModule.sendBinary = function(data, socketId) {
170
+ NativeWebSocketModule.sendBinary = function (data, socketId) {
171
171
  if (sendCallback) {
172
172
  sendCallback(WebSocketInterceptor._arrayBufferToString(data), socketId);
173
173
  }
@@ -176,7 +176,7 @@ const WebSocketInterceptor = {
176
176
 
177
177
  // Override `close` method for all RCTWebSocketModule requests to intercept
178
178
  // the close information, then pass them through the `closeCallback`.
179
- NativeWebSocketModule.close = function() {
179
+ NativeWebSocketModule.close = function () {
180
180
  if (closeCallback) {
181
181
  if (arguments.length === 3) {
182
182
  closeCallback(arguments[0], arguments[1], arguments[2]);
@@ -10,7 +10,7 @@
10
10
 
11
11
  import typeof {enable} from 'promise/setimmediate/rejection-tracking';
12
12
 
13
- type ExtractOptionsType = <P>((options?: ?P) => void) => P;
13
+ type ExtractOptionsType = <P>(((options?: ?P) => void)) => P;
14
14
 
15
15
  let rejectionTrackingOptions: $Call<ExtractOptionsType, enable> = {
16
16
  allRejections: true,
@@ -20,7 +20,8 @@ import {type EventSubscription} from './EventSubscription';
20
20
  */
21
21
  class EmitterSubscription<EventDefinitions: {...}, K: $Keys<EventDefinitions>>
22
22
  extends _EventSubscription<EventDefinitions, K>
23
- implements EventSubscription {
23
+ implements EventSubscription
24
+ {
24
25
  emitter: EventEmitter<EventDefinitions>;
25
26
  listener: ?(...$ElementType<EventDefinitions, K>) => mixed;
26
27
  context: ?$FlowFixMe;
@@ -31,7 +31,8 @@ const sparseFilterPredicate = () => true;
31
31
  * more advanced emitter may use an EventHolder and EventFactory.
32
32
  */
33
33
  class EventEmitter<EventDefinitions: {...}> {
34
- _subscriber: EventSubscriptionVendor<EventDefinitions> = new EventSubscriptionVendor<EventDefinitions>();
34
+ _subscriber: EventSubscriptionVendor<EventDefinitions> =
35
+ new EventSubscriptionVendor<EventDefinitions>();
35
36
 
36
37
  /**
37
38
  * @constructor
@@ -18,7 +18,8 @@ import type EventSubscriptionVendor from './_EventSubscriptionVendor';
18
18
  * remove its own subscription.
19
19
  */
20
20
  class _EventSubscription<EventDefinitions: {...}, K: $Keys<EventDefinitions>>
21
- implements EventSubscription {
21
+ implements EventSubscription
22
+ {
22
23
  eventType: K;
23
24
  key: number;
24
25
  subscriber: EventSubscriptionVendor<EventDefinitions>;
@@ -23,7 +23,7 @@ class EventSubscriptionVendor<EventDefinitions: {...}> {
23
23
  [type: $Keys<EventDefinitions>]: Array<
24
24
  EventSubscription<EventDefinitions, $FlowFixMe>,
25
25
  >,
26
- ...,
26
+ ...
27
27
  };
28
28
 
29
29
  constructor() {
@@ -33,10 +33,6 @@
33
33
  #import "RCTDevMenu.h"
34
34
  #endif // ]TODO(OSS Candidate ISS#2710739)
35
35
 
36
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
37
- #define RCT_LAYOUT_THROTTLE 0.25
38
- #endif // ]TODO(macOS GH#774)
39
-
40
36
  NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification";
41
37
 
42
38
  @interface RCTUIManager (RCTRootView)
@@ -51,11 +47,6 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
51
47
  RCTRootContentView *_contentView;
52
48
  BOOL _passThroughTouches;
53
49
  CGSize _intrinsicContentSize;
54
-
55
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
56
- NSDate *_lastLayout;
57
- BOOL _throttleLayout;
58
- #endif // ]TODO(macOS GH#774)
59
50
  }
60
51
 
61
52
  - (instancetype)initWithFrame:(CGRect)frame
@@ -85,10 +76,6 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
85
76
  _sizeFlexibility = RCTRootViewSizeFlexibilityNone;
86
77
  _minimumSize = CGSizeZero;
87
78
 
88
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
89
- _lastLayout = [NSDate new];
90
- #endif // ]TODO(macOS GH#774)
91
-
92
79
  [[NSNotificationCenter defaultCenter] addObserver:self
93
80
  selector:@selector(bridgeDidReload)
94
81
  name:RCTJavaScriptWillStartLoadingNotification
@@ -182,35 +169,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
182
169
  return fitSize;
183
170
  }
184
171
 
185
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
186
- // TODO: https://github.com/microsoft/react-native-macos/issues/459
187
- // This is a workaround for window resizing events overloading the shadow queue:
188
- // - https://github.com/microsoft/react-native-macos/issues/322
189
- // - https://github.com/microsoft/react-native-macos/issues/422
190
- // We should revisit this issue when we switch over to Fabric.
191
- - (void)layout
192
- {
193
- if (self.window != nil && !_throttleLayout) {
194
- NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:_lastLayout];
195
- if (interval >= RCT_LAYOUT_THROTTLE) {
196
- _lastLayout = [NSDate new];
197
- [self layoutSubviews];
198
- } else {
199
- _throttleLayout = YES;
200
- __weak typeof(self) weakSelf = self;
201
- int64_t delta = (RCT_LAYOUT_THROTTLE - interval) * NSEC_PER_SEC;
202
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delta), dispatch_get_main_queue(), ^{
203
- typeof(self) strongSelf = weakSelf;
204
- if (strongSelf != nil) {
205
- strongSelf->_throttleLayout = NO;
206
- [strongSelf setNeedsLayout];
207
- }
208
- });
209
- }
210
- }
211
- }
212
- #endif // ]TODO(macOS GH#774)
213
-
214
172
  - (void)layoutSubviews
215
173
  {
216
174
  [super layoutSubviews];
@@ -129,6 +129,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
129
129
  // The assumption here is that a RCTUIView/RCTSurfaceView will always have a superview.
130
130
  CGPoint touchLocation = [self.view.superview convertPoint:touch.locationInWindow fromView:nil];
131
131
  NSView *targetView = [self.view hitTest:touchLocation];
132
+ // Don't record clicks on scrollbars.
133
+ if ([targetView isKindOfClass:[NSScroller class]]) {
134
+ continue;
135
+ }
132
136
  // Pair the mouse down events with mouse up events so our _nativeTouches cache doesn't get stale
133
137
  if ([targetView isKindOfClass:[NSControl class]]) {
134
138
  _shouldSendMouseUpOnSystemBehalf = [(NSControl*)targetView isEnabled];
@@ -221,7 +225,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
221
225
  NSEvent *nativeTouch = _nativeTouches[touchIndex];
222
226
  CGPoint location = nativeTouch.locationInWindow;
223
227
  CGPoint rootViewLocation = CGPointMake(location.x, CGRectGetHeight(self.view.window.frame) - location.y);
224
- CGPoint touchViewLocation = rootViewLocation;
228
+ NSView *touchView = _touchViews[touchIndex];
229
+ CGPoint touchViewLocation = [touchView convertPoint:location fromView:nil];
225
230
  #endif // ]TODO(macOS GH#774)
226
231
 
227
232
  NSMutableDictionary *reactTouch = _reactTouches[touchIndex];
@@ -394,6 +399,11 @@ static BOOL RCTAnyTouchesChanged(NSSet *touches) // [TODO(macOS GH#774)
394
399
  // "end"/"cancel" needs to remove the touch *after* extracting the event.
395
400
  [self _recordNewTouches:touches];
396
401
 
402
+ // [TODO(macOS GH#774) - Filter out touches that were ignored.
403
+ touches = [touches objectsPassingTest:^(id touch, BOOL *stop) {
404
+ return [_nativeTouches containsObject:touch];
405
+ }]; // ]TODO(macOS GH#774)
406
+
397
407
  [self _updateAndDispatchTouches:touches eventName:@"touchStart"];
398
408
 
399
409
  if (self.state == UIGestureRecognizerStatePossible) {
@@ -425,6 +425,8 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
425
425
  @property (nonatomic, assign) CGFloat zoomScale;
426
426
  @property (nonatomic, assign) BOOL alwaysBounceHorizontal;
427
427
  @property (nonatomic, assign) BOOL alwaysBounceVertical;
428
+ // macOS specific properties
429
+ @property (nonatomic, assign) BOOL enableFocusRing;
428
430
 
429
431
  @end
430
432
 
@@ -28,7 +28,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
28
28
  RCTVersionMajor: @(0),
29
29
  RCTVersionMinor: @(0),
30
30
  RCTVersionPatch: @(0),
31
- RCTVersionPrerelease: @"2ae308a98",
31
+ RCTVersionPrerelease: @"2b31eb9de",
32
32
  };
33
33
  });
34
34
  return __rnVersion;
@@ -51,7 +51,9 @@ static CVReturn RCTPlatformDisplayLinkCallBack(__unused CVDisplayLinkRef display
51
51
  if (rctDisplayLink->_runLoop != nil) {
52
52
  CFRunLoopRef cfRunLoop = [rctDisplayLink->_runLoop getCFRunLoop];
53
53
  CFRunLoopPerformBlock(cfRunLoop, (__bridge CFArrayRef)rctDisplayLink->_modes, ^{
54
- [rctDisplayLink tick];
54
+ @autoreleasepool {
55
+ [rctDisplayLink tick];
56
+ }
55
57
  });
56
58
  CFRunLoopWakeUp(cfRunLoop);
57
59
  }
@@ -429,6 +429,19 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
429
429
 
430
430
  @implementation RCTUIScrollView // TODO(macOS ISS#3536887)
431
431
 
432
+ - (void)setEnableFocusRing:(BOOL)enableFocusRing {
433
+ if (_enableFocusRing != enableFocusRing) {
434
+ _enableFocusRing = enableFocusRing;
435
+ }
436
+
437
+ if (enableFocusRing) {
438
+ // NSTextView has no focus ring by default so let's use the standard Aqua focus ring.
439
+ [self setFocusRingType:NSFocusRingTypeExterior];
440
+ } else {
441
+ [self setFocusRingType:NSFocusRingTypeNone];
442
+ }
443
+ }
444
+
432
445
  // UIScrollView properties missing from NSScrollView
433
446
  - (CGPoint)contentOffset
434
447
  {
@@ -226,7 +226,7 @@ RCT_EXPORT_METHOD(hide)
226
226
  [NSAnimationContext runAnimationGroup:^(__unused NSAnimationContext *context) {
227
227
  self->_window.animator.alphaValue = 0.0;
228
228
  } completionHandler:^{
229
- [self->_window orderFront:self];
229
+ [self->_window close];
230
230
  self->_window = nil;
231
231
  }];
232
232
  });
@@ -27,6 +27,7 @@ class RCTImageResponseObserverProxy final : public ImageResponseObserver {
27
27
  private:
28
28
  __weak id<RCTImageResponseDelegate> delegate_;
29
29
  };
30
+
30
31
  } // namespace react
31
32
  } // namespace facebook
32
33
 
@@ -354,6 +354,8 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
354
354
  return name;
355
355
  }
356
356
 
357
+ // Re-enable componentViewName_DO_NOT_USE_THIS_IS_BROKEN once macOS uses Fabric
358
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
357
359
  __block RCTPlatformView *view; // TODO(macOS GH#774)
358
360
  RCTUnsafeExecuteOnMainQueueSync(^{
359
361
  view = self->_viewRegistry[reactTag];
@@ -367,6 +369,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
367
369
  }
368
370
 
369
371
  #pragma clang diagnostic pop
372
+ #endif // ]TODO(macOS GH#774)
370
373
  return nil;
371
374
  }
372
375
 
@@ -409,21 +412,34 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
409
412
  - (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView // TODO(macOS ISS#3536887)
410
413
  {
411
414
  RCTAssertMainQueue();
412
- [self
413
- _executeBlockWithShadowView:^(RCTShadowView *shadowView) {
414
- RCTAssert(
415
- [shadowView isKindOfClass:[RCTRootShadowView class]], @"Located shadow view is actually not root view.");
416
415
 
417
- RCTRootShadowView *rootShadowView = (RCTRootShadowView *)shadowView;
416
+ void (^block)(RCTShadowView *) = ^(RCTShadowView *shadowView) {
417
+ RCTAssert(
418
+ [shadowView isKindOfClass:[RCTRootShadowView class]], @"Located shadow view is actually not root view.");
418
419
 
419
- if (CGSizeEqualToSize(availableSize, rootShadowView.availableSize)) {
420
- return;
421
- }
420
+ RCTRootShadowView *rootShadowView = (RCTRootShadowView *)shadowView;
422
421
 
423
- rootShadowView.availableSize = availableSize;
424
- [self setNeedsLayout];
425
- }
426
- forTag:rootView.reactTag];
422
+ if (CGSizeEqualToSize(availableSize, rootShadowView.availableSize)) {
423
+ return;
424
+ }
425
+
426
+ rootShadowView.availableSize = availableSize;
427
+ [self setNeedsLayout];
428
+ };
429
+
430
+ #if TARGET_OS_OSX // [TODO(macOS GH#744)
431
+ if (rootView.inLiveResize) {
432
+ NSNumber* tag = rootView.reactTag;
433
+ // Synchronously relayout to prevent "tearing" when resizing windows.
434
+ // Still run block asynchronously below so it "wins" after any in-flight layout.
435
+ RCTUnsafeExecuteOnUIManagerQueueSync(^{
436
+ RCTShadowView *shadowView = self->_shadowViewRegistry[tag];
437
+ block(shadowView);
438
+ });
439
+ }
440
+ #endif // ]TODO(macOS GH#744)
441
+
442
+ [self _executeBlockWithShadowView:block forTag:rootView.reactTag];
427
443
  }
428
444
 
429
445
  - (void)setLocalData:(NSObject *)localData forView:(RCTUIView *)view // TODO(macOS ISS#3536887)
@@ -1135,6 +1151,8 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand
1135
1151
  RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
1136
1152
  RCTComponentData *componentData = _componentDataByName[shadowView.viewName];
1137
1153
 
1154
+ // Re-enable componentViewName_DO_NOT_USE_THIS_IS_BROKEN once macOS uses Fabric
1155
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
1138
1156
  // Achtung! Achtung!
1139
1157
  // This is a remarkably hacky and ugly workaround.
1140
1158
  // We need this only temporary for some testing. We need this hack until Fabric fully implements command-execution
@@ -1152,6 +1170,7 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand
1152
1170
  }
1153
1171
  }
1154
1172
  #pragma clang diagnostic pop
1173
+ #endif // ]TODO(macOS GH#774)
1155
1174
 
1156
1175
  Class managerClass = componentData.managerClass;
1157
1176
  RCTModuleData *moduleData = [_bridge moduleDataForName:RCTBridgeModuleNameForClass(managerClass)];
@@ -1596,6 +1596,9 @@ NSString* const downArrowPressKey = @"ArrowDown";
1596
1596
  BOOL tabKeyPressed = NO;
1597
1597
  BOOL escapeKeyPressed = NO;
1598
1598
  NSString *key = event.charactersIgnoringModifiers;
1599
+ if ([key length] == 0) {
1600
+ return nil;
1601
+ }
1599
1602
  unichar const code = [key characterAtIndex:0];
1600
1603
 
1601
1604
  // detect arrow key presses
@@ -1258,16 +1258,22 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
1258
1258
 
1259
1259
  #if TARGET_OS_OSX // [TODO(macOS GH#774)
1260
1260
 
1261
- - (NSString*)keyCommandFromKeyCode:(NSInteger)keyCode
1261
+ - (NSString*)keyCommandFromKeyCode:(NSInteger)keyCode modifierFlags:(NSEventModifierFlags)modifierFlags
1262
1262
  {
1263
1263
  switch (keyCode)
1264
1264
  {
1265
1265
  case 36:
1266
1266
  return @"ENTER";
1267
1267
 
1268
+ case 115:
1269
+ return @"HOME";
1270
+
1268
1271
  case 116:
1269
1272
  return @"PAGE_UP";
1270
1273
 
1274
+ case 119:
1275
+ return @"END";
1276
+
1271
1277
  case 121:
1272
1278
  return @"PAGE_DOWN";
1273
1279
 
@@ -1278,10 +1284,18 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
1278
1284
  return @"RIGHT_ARROW";
1279
1285
 
1280
1286
  case 125:
1281
- return @"DOWN_ARROW";
1287
+ if (modifierFlags & NSEventModifierFlagOption) {
1288
+ return @"OPTION_DOWN";
1289
+ } else {
1290
+ return @"DOWN_ARROW";
1291
+ }
1282
1292
 
1283
1293
  case 126:
1284
- return @"UP_ARROW";
1294
+ if (modifierFlags & NSEventModifierFlagOption) {
1295
+ return @"OPTION_UP";
1296
+ } else {
1297
+ return @"UP_ARROW";
1298
+ }
1285
1299
  }
1286
1300
  return @"";
1287
1301
  }
@@ -1289,24 +1303,25 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
1289
1303
  - (void)keyDown:(UIEvent*)theEvent
1290
1304
  {
1291
1305
  // Don't emit a scroll event if tab was pressed while the scrollview is first responder
1292
- if (self == [[self window] firstResponder] &&
1293
- theEvent.keyCode != 48) {
1294
- NSString *keyCommand = [self keyCommandFromKeyCode:theEvent.keyCode];
1295
- RCT_SEND_SCROLL_EVENT(onScrollKeyDown, (@{ @"key": keyCommand}));
1296
- } else {
1297
- [super keyDown:theEvent];
1298
-
1299
- // AX: if a tab key was pressed and the first responder is currently clipped by the scroll view,
1300
- // automatically scroll to make the view visible to make it navigable via keyboard.
1301
- if ([theEvent keyCode] == 48) { //tab key
1302
- id firstResponder = [[self window] firstResponder];
1303
- if ([firstResponder isKindOfClass:[NSView class]] &&
1304
- [firstResponder isDescendantOf:[_scrollView documentView]]) {
1305
- NSView *view = (NSView*)firstResponder;
1306
- NSRect visibleRect = ([view superview] == [_scrollView documentView]) ? NSInsetRect(view.frame, -1, -1) :
1307
- [view convertRect:view.frame toView:_scrollView.documentView];
1308
- [[_scrollView documentView] scrollRectToVisible:visibleRect];
1309
- }
1306
+ if (!(self == [[self window] firstResponder] && theEvent.keyCode == 48)) {
1307
+ NSString *keyCommand = [self keyCommandFromKeyCode:theEvent.keyCode modifierFlags:theEvent.modifierFlags];
1308
+ if (![keyCommand isEqual: @""]) {
1309
+ RCT_SEND_SCROLL_EVENT(onScrollKeyDown, (@{ @"key": keyCommand}));
1310
+ } else {
1311
+ [super keyDown:theEvent];
1312
+ }
1313
+ }
1314
+
1315
+ // AX: if a tab key was pressed and the first responder is currently clipped by the scroll view,
1316
+ // automatically scroll to make the view visible to make it navigable via keyboard.
1317
+ if ([theEvent keyCode] == 48) { //tab key
1318
+ id firstResponder = [[self window] firstResponder];
1319
+ if ([firstResponder isKindOfClass:[NSView class]] &&
1320
+ [firstResponder isDescendantOf:[_scrollView documentView]]) {
1321
+ NSView *view = (NSView*)firstResponder;
1322
+ NSRect visibleRect = ([view superview] == [_scrollView documentView]) ? NSInsetRect(view.frame, -1, -1) :
1323
+ [view convertRect:view.frame toView:_scrollView.documentView];
1324
+ [[_scrollView documentView] scrollRectToVisible:visibleRect];
1310
1325
  }
1311
1326
  }
1312
1327
  }
@@ -282,29 +282,37 @@
282
282
 
283
283
  - (void)reactFocus
284
284
  {
285
- if (![self becomeFirstResponder]) {
286
- self.reactIsFocusNeeded = YES;
287
- }
285
+ #if TARGET_OS_OSX // [TODO(macOS GH#774)
286
+ if (![[self window] makeFirstResponder:self]) {
287
+ #else
288
+ if (![self becomeFirstResponder]) {
289
+ #endif //// TODO(macOS GH#774)]
290
+ self.reactIsFocusNeeded = YES;
291
+ }
288
292
  }
289
293
 
290
294
  - (void)reactFocusIfNeeded
291
295
  {
292
- if (self.reactIsFocusNeeded) {
293
- if ([self becomeFirstResponder]) {
294
- self.reactIsFocusNeeded = NO;
295
- }
296
- }
296
+ if (self.reactIsFocusNeeded) {
297
+ #if TARGET_OS_OSX // [TODO(macOS GH#774)
298
+ if ([[self window] makeFirstResponder:self]) {
299
+ #else
300
+ if ([self becomeFirstResponder]) {
301
+ #endif // TODO(macOS GH#774)]
302
+ self.reactIsFocusNeeded = NO;
303
+ }
304
+ }
297
305
  }
298
306
 
299
307
  - (void)reactBlur
300
308
  {
301
- #if TARGET_OS_OSX // TODO(macOS GH#774)
309
+ #if TARGET_OS_OSX // [TODO(macOS GH#774)
302
310
  if (self == [[self window] firstResponder]) {
303
311
  [[self window] makeFirstResponder:[[self window] nextResponder]];
304
312
  }
305
313
  #else
306
314
  [self resignFirstResponder];
307
- #endif
315
+ #endif // TODO(macOS GH#774)]
308
316
  }
309
317
 
310
318
  #pragma mark - Layout
@@ -364,7 +364,8 @@ dependencies {
364
364
  api("com.facebook.infer.annotation:infer-annotation:0.18.0")
365
365
  api("com.facebook.yoga:proguard-annotations:1.19.0")
366
366
  api("javax.inject:javax.inject:1")
367
- api("androidx.appcompat:appcompat:1.0.2")
367
+ api("androidx.appcompat:appcompat:${APPCOMPAT_VERSION}")
368
+ api("androidx.appcompat:appcompat-resources:${APPCOMPAT_VERSION}")
368
369
  api("androidx.autofill:autofill:1.1.0")
369
370
  api("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
370
371
  api("com.facebook.fresco:fresco:${FRESCO_VERSION}")
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.0.0-2ae308a98
1
+ VERSION_NAME=0.0.0-2b31eb9de
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  POM_NAME=ReactNative
@@ -11,6 +11,7 @@ ROBOLECTRIC_VERSION=4.4
11
11
  JUNIT_VERSION=4.12
12
12
 
13
13
  ANDROIDX_TEST_VERSION=1.1.0
14
+ APPCOMPAT_VERSION=1.4.1
14
15
  FRESCO_VERSION=2.5.0
15
16
  OKHTTP_VERSION=4.9.2
16
17
  SO_LOADER_VERSION=0.10.3
@@ -65,8 +65,7 @@ class AnimatedTransformTestApp extends React.Component {
65
65
  <TouchableOpacity
66
66
  onPress={this.toggle}
67
67
  testID="TouchableOpacity"
68
- style={[styles.base, this.state.flag ? styles.transformed : null]}
69
- >
68
+ style={[styles.base, this.state.flag ? styles.transformed : null]}>
70
69
  <Text>TouchableOpacity</Text>
71
70
  </TouchableOpacity>
72
71
  </View>
@@ -14,7 +14,7 @@ const {NativeModules} = require('react-native');
14
14
  const {Assert} = NativeModules;
15
15
 
16
16
  const Asserts = {
17
- assertEquals: function(expected, actual, msg) {
17
+ assertEquals: function (expected, actual, msg) {
18
18
  if (expected !== actual) {
19
19
  Assert.fail(
20
20
  msg ||
@@ -30,7 +30,7 @@ const Asserts = {
30
30
  Assert.success();
31
31
  }
32
32
  },
33
- assertTrue: function(expr, msg) {
33
+ assertTrue: function (expr, msg) {
34
34
  Asserts.assertEquals(true, expr, msg);
35
35
  },
36
36
  };