@office-iss/react-native-win32 0.0.0-canary.274 → 0.0.0-canary.276

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 (96) hide show
  1. package/.flowconfig +5 -1
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
  6. package/Libraries/Animated/animations/Animation.js +1 -5
  7. package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
  8. package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
  9. package/Libraries/Animated/useAnimatedProps.js +2 -14
  10. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +16 -2
  11. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +21 -2
  12. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +2 -0
  13. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
  14. package/Libraries/Components/ScrollView/ScrollView.js +35 -74
  15. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
  16. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +0 -1
  17. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  18. package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
  19. package/Libraries/Components/TextInput/TextInput.js +7 -1
  20. package/Libraries/Components/TextInput/TextInput.win32.js +7 -1
  21. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
  22. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  23. package/Libraries/Components/View/ViewPropTypes.js +0 -3
  24. package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
  25. package/Libraries/Core/ExceptionsManager.js +7 -4
  26. package/Libraries/Core/ReactNativeVersion.js +1 -1
  27. package/Libraries/Core/setUpErrorHandling.js +20 -18
  28. package/Libraries/Core/setUpTimers.js +4 -12
  29. package/Libraries/Image/Image.android.js +0 -2
  30. package/Libraries/Image/Image.d.ts +2 -0
  31. package/Libraries/Image/ImageProps.js +2 -1
  32. package/Libraries/Image/ImageResizeMode.d.ts +8 -1
  33. package/Libraries/Image/ImageResizeMode.js +4 -1
  34. package/Libraries/Image/ImageSource.d.ts +0 -2
  35. package/Libraries/Image/ImageSource.js +0 -2
  36. package/Libraries/Image/ImageUtils.js +6 -3
  37. package/Libraries/Image/ImageViewNativeComponent.js +3 -1
  38. package/Libraries/Inspector/Inspector.win32.js +1 -1
  39. package/Libraries/Interaction/InteractionManager.js +6 -1
  40. package/Libraries/Interaction/InteractionManagerStub.js +176 -0
  41. package/Libraries/Lists/FlatList.js +2 -2
  42. package/Libraries/LogBox/LogBox.js +1 -1
  43. package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
  44. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
  45. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
  46. package/Libraries/Modal/Modal.d.ts +5 -0
  47. package/Libraries/Modal/Modal.js +17 -0
  48. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
  49. package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
  50. package/Libraries/Pressability/usePressability.js +4 -1
  51. package/Libraries/ReactNative/AppRegistry.js +0 -6
  52. package/Libraries/ReactNative/RendererImplementation.js +12 -12
  53. package/Libraries/ReactNative/renderApplication.js +3 -4
  54. package/Libraries/ReactNative/requireNativeComponent.js +2 -1
  55. package/Libraries/Renderer/implementations/ReactFabric-dev.js +26149 -15434
  56. package/Libraries/Renderer/implementations/ReactFabric-prod.js +1630 -2675
  57. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1691 -2954
  58. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27069 -16192
  59. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1657 -2714
  60. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1733 -2980
  61. package/Libraries/Renderer/shims/ReactFabric.js +3 -3
  62. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  63. package/Libraries/Renderer/shims/ReactNative.js +3 -3
  64. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  65. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +7 -1
  66. package/Libraries/StyleSheet/StyleSheetTypes.js +5 -4
  67. package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
  68. package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
  69. package/Libraries/Utilities/Appearance.js +3 -1
  70. package/Libraries/Utilities/BackHandler.android.js +6 -18
  71. package/Libraries/Utilities/BackHandler.d.ts +0 -4
  72. package/Libraries/Utilities/BackHandler.ios.js +0 -7
  73. package/Libraries/Utilities/BackHandler.win32.js +6 -18
  74. package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
  75. package/jest/setup.js +5 -1
  76. package/overrides.json +9 -9
  77. package/package.json +14 -14
  78. package/src/private/components/HScrollViewNativeComponents.js +1 -26
  79. package/src/private/components/VScrollViewNativeComponents.js +2 -24
  80. package/src/private/featureflags/ReactNativeFeatureFlags.js +24 -55
  81. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -7
  82. package/src/private/setup/setUpDOM.js +14 -6
  83. package/src/private/setup/setUpMutationObserver.js +5 -0
  84. package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
  85. package/src/private/specs/modules/NativeAccessibilityInfo.js +6 -0
  86. package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +6 -0
  87. package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
  88. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +96 -11
  89. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
  90. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
  91. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  92. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
  93. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  94. package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
  95. package/src/private/components/useSyncOnScroll.js +0 -48
  96. package/types/experimental.d.ts +0 -59
@@ -7,7 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow
10
- * @generated SignedSource<<bb39e39880fecbf572b5f8e7c2a95c5d>>
10
+ * @generated SignedSource<<cf323fc5ca893bab5669c7d321660412>>
11
11
  */
12
12
 
13
13
  'use strict';
@@ -16,7 +16,7 @@ import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePriv
16
16
 
17
17
  import type {ReactFabricType} from './ReactNativeTypes';
18
18
 
19
- let ReactFabric;
19
+ let ReactFabric: ReactFabricType;
20
20
 
21
21
  if (__DEV__) {
22
22
  ReactFabric = require('../implementations/ReactFabric-dev');
@@ -30,4 +30,4 @@ if (global.RN$Bridgeless !== true) {
30
30
  BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
31
31
  }
32
32
 
33
- module.exports = (ReactFabric: ReactFabricType);
33
+ export default ReactFabric;
@@ -7,7 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict-local
10
- * @generated SignedSource<<b1b5e34e426103a69612278fd5c9f77c>>
10
+ * @generated SignedSource<<908f5fb85384725318e261f40e49d9a6>>
11
11
  */
12
12
 
13
13
  'use strict';
@@ -16,4 +16,4 @@ const ReactFeatureFlags = {
16
16
  debugRenderPhaseSideEffects: false,
17
17
  };
18
18
 
19
- module.exports = ReactFeatureFlags;
19
+ export default ReactFeatureFlags;
@@ -7,13 +7,13 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow
10
- * @generated SignedSource<<475c7d864efc2948c6125ddb8a38a4fc>>
10
+ * @generated SignedSource<<8f46fdc9267fcc4fdc9e76842fe24066>>
11
11
  */
12
12
  'use strict';
13
13
 
14
14
  import type {ReactNativeType} from './ReactNativeTypes';
15
15
 
16
- let ReactNative;
16
+ let ReactNative: ReactNativeType;
17
17
 
18
18
  if (__DEV__) {
19
19
  ReactNative = require('../implementations/ReactNativeRenderer-dev');
@@ -21,4 +21,4 @@ if (__DEV__) {
21
21
  ReactNative = require('../implementations/ReactNativeRenderer-prod');
22
22
  }
23
23
 
24
- module.exports = (ReactNative: ReactNativeType);
24
+ export default ReactNative;
@@ -7,7 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict-local
10
- * @generated SignedSource<<62e766b69d440dab0a2d249f0cea38e0>>
10
+ * @generated SignedSource<<52163887de05f1cff05388145cf85b3b>>
11
11
  */
12
12
 
13
13
  'use strict';
@@ -32,4 +32,4 @@ const createReactNativeComponentClass = function (
32
32
  return register(name, callback);
33
33
  };
34
34
 
35
- module.exports = createReactNativeComponentClass;
35
+ export default createReactNativeComponentClass;
@@ -434,6 +434,12 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
434
434
  cursor?: CursorValue | undefined;
435
435
  boxShadow?: ReadonlyArray<BoxShadowValue> | string | undefined;
436
436
  filter?: ReadonlyArray<FilterFunction> | string | undefined;
437
+
438
+ mixBlendMode?: BlendMode | undefined;
439
+ experimental_backgroundImage?:
440
+ | ReadonlyArray<GradientValue>
441
+ | string
442
+ | undefined;
437
443
  }
438
444
 
439
445
  export type FontVariant =
@@ -562,6 +568,6 @@ export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
562
568
  overlayColor?: ColorValue | undefined;
563
569
  tintColor?: ColorValue | undefined;
564
570
  opacity?: AnimatableNumericValue | undefined;
565
- objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | undefined;
571
+ objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none' | undefined;
566
572
  cursor?: CursorValue | undefined;
567
573
  }
@@ -11,6 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  import type AnimatedNode from '../Animated/nodes/AnimatedNode';
14
+ import type {ImageResizeMode} from './../Image/ImageResizeMode';
14
15
  import type {
15
16
  ____DangerouslyImpreciseStyle_InternalOverrides,
16
17
  ____ImageStyle_InternalOverrides,
@@ -941,8 +942,8 @@ export type ____TextStyle_Internal = $ReadOnly<{
941
942
 
942
943
  export type ____ImageStyle_InternalCore = $ReadOnly<{
943
944
  ...$Exact<____ViewStyle_Internal>,
944
- resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat',
945
- objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down',
945
+ resizeMode?: ImageResizeMode,
946
+ objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
946
947
  tintColor?: ____ColorValue_Internal,
947
948
  overlayColor?: string,
948
949
  }>;
@@ -954,8 +955,8 @@ export type ____ImageStyle_Internal = $ReadOnly<{
954
955
 
955
956
  export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{
956
957
  ...$Exact<____TextStyle_Internal>,
957
- resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat',
958
- objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down',
958
+ resizeMode?: ImageResizeMode,
959
+ objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
959
960
  tintColor?: ____ColorValue_Internal,
960
961
  overlayColor?: string,
961
962
  }>;
@@ -14,25 +14,28 @@ import type {ProcessedColorValue} from './processColor';
14
14
  import type {GradientValue} from './StyleSheetTypes';
15
15
 
16
16
  const processColor = require('./processColor').default;
17
- const DIRECTION_REGEX =
18
- /^to\s+(?:top|bottom|left|right)(?:\s+(?:top|bottom|left|right))?/;
17
+ const DIRECTION_KEYWORD_REGEX =
18
+ /^to\s+(?:top|bottom|left|right)(?:\s+(?:top|bottom|left|right))?/i;
19
19
  const ANGLE_UNIT_REGEX = /^([+-]?\d*\.?\d+)(deg|grad|rad|turn)$/i;
20
20
 
21
- const TO_BOTTOM_START_END_POINTS = {
22
- start: {x: 0.5, y: 0},
23
- end: {x: 0.5, y: 1},
24
- };
21
+ type LinearGradientDirection =
22
+ | {type: 'angle', value: number}
23
+ | {type: 'keyword', value: string};
25
24
 
26
25
  type ParsedGradientValue = {
27
26
  type: 'linearGradient',
28
- start: {x: number, y: number},
29
- end: {x: number, y: number},
27
+ direction: LinearGradientDirection,
30
28
  colorStops: $ReadOnlyArray<{
31
29
  color: ProcessedColorValue,
32
30
  position: number,
33
31
  }>,
34
32
  };
35
33
 
34
+ const DEFAULT_DIRECTION: LinearGradientDirection = {
35
+ type: 'angle',
36
+ value: 180,
37
+ };
38
+
36
39
  export default function processBackgroundImage(
37
40
  backgroundImage: ?($ReadOnlyArray<GradientValue> | string),
38
41
  ): $ReadOnlyArray<ParsedGradientValue> {
@@ -76,37 +79,43 @@ export default function processBackgroundImage(
76
79
  }
77
80
  }
78
81
 
79
- let points: {
80
- start: ParsedGradientValue['start'],
81
- end: ParsedGradientValue['end'],
82
- } | null = null;
83
-
84
- if (typeof bgImage.direction === 'undefined') {
85
- points = TO_BOTTOM_START_END_POINTS;
86
- } else if (ANGLE_UNIT_REGEX.test(bgImage.direction)) {
87
- const angle = parseAngle(bgImage.direction);
88
- if (angle != null) {
89
- points = calculateStartEndPointsFromAngle(angle);
90
- }
91
- } else if (DIRECTION_REGEX.test(bgImage.direction)) {
92
- const processedPoints = calculateStartEndPointsFromDirection(
93
- bgImage.direction,
94
- );
95
- if (processedPoints != null) {
96
- points = processedPoints;
82
+ let direction: LinearGradientDirection = DEFAULT_DIRECTION;
83
+ const bgDirection =
84
+ bgImage.direction != null ? bgImage.direction.toLowerCase() : null;
85
+
86
+ if (bgDirection != null) {
87
+ if (ANGLE_UNIT_REGEX.test(bgDirection)) {
88
+ const parsedAngle = getAngleInDegrees(bgDirection);
89
+ if (parsedAngle != null) {
90
+ direction = {
91
+ type: 'angle',
92
+ value: parsedAngle,
93
+ };
94
+ } else {
95
+ // If an angle is invalid, return an empty array and do not apply any gradient. Same as web.
96
+ return [];
97
+ }
98
+ } else if (DIRECTION_KEYWORD_REGEX.test(bgDirection)) {
99
+ const parsedDirection = getDirectionForKeyword(bgDirection);
100
+ if (parsedDirection != null) {
101
+ direction = parsedDirection;
102
+ } else {
103
+ // If a direction is invalid, return an empty array and do not apply any gradient. Same as web.
104
+ return [];
105
+ }
106
+ } else {
107
+ // If a direction is invalid, return an empty array and do not apply any gradient. Same as web.
108
+ return [];
97
109
  }
98
110
  }
99
111
 
100
112
  const fixedColorStops = getFixedColorStops(processedColorStops);
101
113
 
102
- if (points != null) {
103
- result = result.concat({
104
- type: 'linearGradient',
105
- start: points.start,
106
- end: points.end,
107
- colorStops: fixedColorStops,
108
- });
109
- }
114
+ result = result.concat({
115
+ type: 'linearGradient',
116
+ direction,
117
+ colorStops: fixedColorStops,
118
+ });
110
119
  }
111
120
  }
112
121
 
@@ -118,30 +127,39 @@ function parseCSSLinearGradient(
118
127
  ): $ReadOnlyArray<ParsedGradientValue> {
119
128
  const gradients = [];
120
129
  let match;
130
+
131
+ // matches one or more linear-gradient functions in CSS
121
132
  const linearGradientRegex = /linear-gradient\s*\(((?:\([^)]*\)|[^())])*)\)/gi;
122
133
 
123
134
  while ((match = linearGradientRegex.exec(cssString))) {
124
135
  const gradientContent = match[1];
125
136
  const parts = gradientContent.split(',');
126
- let points = TO_BOTTOM_START_END_POINTS;
137
+ let direction: LinearGradientDirection = DEFAULT_DIRECTION;
127
138
  const trimmedDirection = parts[0].trim().toLowerCase();
139
+
140
+ // matches individual color stops in a gradient function
141
+ // supports various color formats: named colors, hex colors, rgb(a), and hsl(a)
142
+ // e.g. "red 20%", "blue 50%", "rgba(0, 0, 0, 0.5) 30% 50%"
143
+ // TODO: does not support color hint syntax yet. It is WIP.
128
144
  const colorStopRegex =
129
145
  /\s*((?:(?:rgba?|hsla?)\s*\([^)]+\))|#[0-9a-fA-F]+|[a-zA-Z]+)(?:\s+(-?[0-9.]+%?)(?:\s+(-?[0-9.]+%?))?)?\s*/gi;
130
146
 
131
147
  if (ANGLE_UNIT_REGEX.test(trimmedDirection)) {
132
- const angle = parseAngle(trimmedDirection);
133
- if (angle != null) {
134
- points = calculateStartEndPointsFromAngle(angle);
148
+ const parsedAngle = getAngleInDegrees(trimmedDirection);
149
+ if (parsedAngle != null) {
150
+ direction = {
151
+ type: 'angle',
152
+ value: parsedAngle,
153
+ };
135
154
  parts.shift();
136
155
  } else {
137
156
  // If an angle is invalid, return an empty array and do not apply any gradient. Same as web.
138
157
  return [];
139
158
  }
140
- } else if (DIRECTION_REGEX.test(trimmedDirection)) {
141
- const parsedPoints =
142
- calculateStartEndPointsFromDirection(trimmedDirection);
143
- if (parsedPoints != null) {
144
- points = parsedPoints;
159
+ } else if (DIRECTION_KEYWORD_REGEX.test(trimmedDirection)) {
160
+ const parsedDirection = getDirectionForKeyword(trimmedDirection);
161
+ if (parsedDirection != null) {
162
+ direction = parsedDirection;
145
163
  parts.shift();
146
164
  } else {
147
165
  // If a direction is invalid, return an empty array and do not apply any gradient. Same as web.
@@ -198,8 +216,7 @@ function parseCSSLinearGradient(
198
216
 
199
217
  gradients.push({
200
218
  type: 'linearGradient',
201
- start: points.start,
202
- end: points.end,
219
+ direction,
203
220
  colorStops: fixedColorStops,
204
221
  });
205
222
  }
@@ -207,83 +224,43 @@ function parseCSSLinearGradient(
207
224
  return gradients;
208
225
  }
209
226
 
210
- function calculateStartEndPointsFromDirection(direction: string): ?{
211
- start: {x: number, y: number},
212
- end: {x: number, y: number},
213
- } {
227
+ function getDirectionForKeyword(direction?: string): ?LinearGradientDirection {
228
+ if (direction == null) {
229
+ return null;
230
+ }
214
231
  // Remove extra whitespace
215
- const normalizedDirection = direction.replace(/\s+/g, ' ');
232
+ const normalized = direction.replace(/\s+/g, ' ').toLowerCase();
216
233
 
217
- switch (normalizedDirection) {
234
+ switch (normalized) {
235
+ case 'to top':
236
+ return {type: 'angle', value: 0};
218
237
  case 'to right':
219
- return {
220
- start: {x: 0, y: 0.5},
221
- end: {x: 1, y: 0.5},
222
- };
223
- case 'to left':
224
- return {
225
- start: {x: 1, y: 0.5},
226
- end: {x: 0, y: 0.5},
227
- };
238
+ return {type: 'angle', value: 90};
228
239
  case 'to bottom':
229
- return TO_BOTTOM_START_END_POINTS;
230
- case 'to top':
231
- return {
232
- start: {x: 0.5, y: 1},
233
- end: {x: 0.5, y: 0},
234
- };
240
+ return {type: 'angle', value: 180};
241
+ case 'to left':
242
+ return {type: 'angle', value: 270};
243
+ case 'to top right':
244
+ case 'to right top':
245
+ return {type: 'keyword', value: 'to top right'};
235
246
  case 'to bottom right':
236
247
  case 'to right bottom':
237
- return {
238
- start: {x: 0, y: 0},
239
- end: {x: 1, y: 1},
240
- };
248
+ return {type: 'keyword', value: 'to bottom right'};
241
249
  case 'to top left':
242
250
  case 'to left top':
243
- return {
244
- start: {x: 1, y: 1},
245
- end: {x: 0, y: 0},
246
- };
251
+ return {type: 'keyword', value: 'to top left'};
247
252
  case 'to bottom left':
248
253
  case 'to left bottom':
249
- return {
250
- start: {x: 1, y: 0},
251
- end: {x: 0, y: 1},
252
- };
253
- case 'to top right':
254
- case 'to right top':
255
- return {
256
- start: {x: 0, y: 1},
257
- end: {x: 1, y: 0},
258
- };
254
+ return {type: 'keyword', value: 'to bottom left'};
259
255
  default:
260
256
  return null;
261
257
  }
262
258
  }
263
259
 
264
- function calculateStartEndPointsFromAngle(angleRadians: number): {
265
- start: {x: number, y: number},
266
- end: {x: number, y: number},
267
- } {
268
- // Normalize angle to be between 0 and 2π
269
- let angleRadiansNormalized = angleRadians % (2 * Math.PI);
270
- if (angleRadiansNormalized < 0) {
271
- angleRadiansNormalized += 2 * Math.PI;
260
+ function getAngleInDegrees(angle?: string): ?number {
261
+ if (angle == null) {
262
+ return null;
272
263
  }
273
-
274
- const endX = 0.5 + 0.5 * Math.sin(angleRadiansNormalized);
275
- const endY = 0.5 - 0.5 * Math.cos(angleRadiansNormalized);
276
-
277
- const startX = 1 - endX;
278
- const startY = 1 - endY;
279
-
280
- return {
281
- start: {x: startX, y: startY},
282
- end: {x: endX, y: endY},
283
- };
284
- }
285
-
286
- function parseAngle(angle: string): ?number {
287
264
  const match = angle.match(ANGLE_UNIT_REGEX);
288
265
  if (!match) {
289
266
  return null;
@@ -294,13 +271,13 @@ function parseAngle(angle: string): ?number {
294
271
  const numericValue = parseFloat(value);
295
272
  switch (unit) {
296
273
  case 'deg':
297
- return (numericValue * Math.PI) / 180;
274
+ return numericValue;
298
275
  case 'grad':
299
- return (numericValue * Math.PI) / 200;
276
+ return numericValue * 0.9; // 1 grad = 0.9 degrees
300
277
  case 'rad':
301
- return numericValue;
278
+ return (numericValue * 180) / Math.PI;
302
279
  case 'turn':
303
- return numericValue * 2 * Math.PI;
280
+ return numericValue * 360; // 1 turn = 360 degrees
304
281
  default:
305
282
  return null;
306
283
  }
@@ -16,9 +16,6 @@ const NativeModules = require('../BatchedBridge/NativeModules');
16
16
 
17
17
  const turboModuleProxy = global.__turboModuleProxy;
18
18
 
19
- const useLegacyNativeModuleInterop =
20
- global.RN$Bridgeless !== true || global.RN$TurboInterop === true;
21
-
22
19
  function requireModule<T: TurboModule>(name: string): ?T {
23
20
  if (turboModuleProxy != null) {
24
21
  const module: ?T = turboModuleProxy(name);
@@ -27,8 +24,11 @@ function requireModule<T: TurboModule>(name: string): ?T {
27
24
  }
28
25
  }
29
26
 
30
- if (useLegacyNativeModuleInterop) {
31
- // Backward compatibility layer during migration.
27
+ if (
28
+ global.RN$Bridgeless !== true ||
29
+ global.RN$TurboInterop === true ||
30
+ global.RN$UnifiedNativeModuleProxy === true
31
+ ) {
32
32
  const legacyModule: ?T = NativeModules[name];
33
33
  if (legacyModule != null) {
34
34
  return legacyModule;
@@ -105,7 +105,9 @@ export function setColorScheme(colorScheme: ?ColorSchemeName): void {
105
105
  const {NativeAppearance} = state;
106
106
  if (NativeAppearance != null) {
107
107
  NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
108
- state.appearance = {colorScheme};
108
+ state.appearance = {
109
+ colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
110
+ };
109
111
  }
110
112
  }
111
113
 
@@ -59,10 +59,6 @@ type TBackHandler = {|
59
59
  eventName: BackPressEventName,
60
60
  handler: () => ?boolean,
61
61
  ) => {remove: () => void, ...},
62
- +removeEventListener: (
63
- eventName: BackPressEventName,
64
- handler: () => ?boolean,
65
- ) => void,
66
62
  |};
67
63
  const BackHandler: TBackHandler = {
68
64
  exitApp: function (): void {
@@ -86,22 +82,14 @@ const BackHandler: TBackHandler = {
86
82
  _backPressSubscriptions.push(handler);
87
83
  }
88
84
  return {
89
- remove: (): void => BackHandler.removeEventListener(eventName, handler),
85
+ remove: (): void => {
86
+ const index = _backPressSubscriptions.indexOf(handler);
87
+ if (index !== -1) {
88
+ _backPressSubscriptions.splice(index, 1);
89
+ }
90
+ },
90
91
  };
91
92
  },
92
-
93
- /**
94
- * Removes the event handler.
95
- */
96
- removeEventListener: function (
97
- eventName: BackPressEventName,
98
- handler: () => ?boolean,
99
- ): void {
100
- const index = _backPressSubscriptions.indexOf(handler);
101
- if (index !== -1) {
102
- _backPressSubscriptions.splice(index, 1);
103
- }
104
- },
105
93
  };
106
94
 
107
95
  module.exports = BackHandler;
@@ -28,10 +28,6 @@ export interface BackHandlerStatic {
28
28
  eventName: BackPressEventName,
29
29
  handler: () => boolean | null | undefined,
30
30
  ): NativeEventSubscription;
31
- removeEventListener(
32
- eventName: BackPressEventName,
33
- handler: () => boolean | null | undefined,
34
- ): void;
35
31
  }
36
32
 
37
33
  export const BackHandler: BackHandlerStatic;
@@ -10,8 +10,6 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- module.exports = require('../Components/UnimplementedViews/UnimplementedView');
14
-
15
13
  type BackPressEventName = 'backPress' | 'hardwareBackPress';
16
14
 
17
15
  function emptyFunction(): void {}
@@ -22,10 +20,6 @@ type TBackHandler = {|
22
20
  eventName: BackPressEventName,
23
21
  handler: () => ?boolean,
24
22
  ) => {remove: () => void, ...},
25
- +removeEventListener: (
26
- eventName: BackPressEventName,
27
- handler: () => ?boolean,
28
- ) => void,
29
23
  |};
30
24
 
31
25
  let BackHandler: TBackHandler = {
@@ -35,7 +29,6 @@ let BackHandler: TBackHandler = {
35
29
  remove: emptyFunction,
36
30
  };
37
31
  },
38
- removeEventListener(_eventName: BackPressEventName, _handler: Function) {},
39
32
  };
40
33
 
41
34
  module.exports = BackHandler;
@@ -59,10 +59,6 @@ type TBackHandler = {|
59
59
  eventName: BackPressEventName,
60
60
  handler: () => ?boolean,
61
61
  ) => {remove: () => void, ...},
62
- +removeEventListener: (
63
- eventName: BackPressEventName,
64
- handler: () => ?boolean,
65
- ) => void,
66
62
  |};
67
63
  const BackHandler: TBackHandler = {
68
64
  exitApp: function (): void {
@@ -86,22 +82,14 @@ const BackHandler: TBackHandler = {
86
82
  _backPressSubscriptions.push(handler);
87
83
  }
88
84
  return {
89
- remove: (): void => BackHandler.removeEventListener(eventName, handler),
85
+ remove: (): void => {
86
+ const index = _backPressSubscriptions.indexOf(handler);
87
+ if (index !== -1) {
88
+ _backPressSubscriptions.splice(index, 1);
89
+ }
90
+ },
90
91
  };
91
92
  },
92
-
93
- /**
94
- * Removes the event handler.
95
- */
96
- removeEventListener: function (
97
- eventName: BackPressEventName,
98
- handler: () => ?boolean,
99
- ): void {
100
- const index = _backPressSubscriptions.indexOf(handler);
101
- if (index !== -1) {
102
- _backPressSubscriptions.splice(index, 1);
103
- }
104
- },
105
93
  };
106
94
 
107
95
  module.exports = BackHandler;
@@ -20,17 +20,12 @@ const BackHandler = {
20
20
  ): {remove: () => void} {
21
21
  _backPressSubscriptions.add(handler);
22
22
  return {
23
- remove: () => BackHandler.removeEventListener(eventName, handler),
23
+ remove: () => {
24
+ _backPressSubscriptions.delete(handler);
25
+ },
24
26
  };
25
27
  },
26
28
 
27
- removeEventListener: function (
28
- eventName: BackPressEventName,
29
- handler: () => ?boolean,
30
- ): void {
31
- _backPressSubscriptions.delete(handler);
32
- },
33
-
34
29
  mockPressBack: function () {
35
30
  let invokeDefault = true;
36
31
  const subscriptions = [..._backPressSubscriptions].reverse();
package/jest/setup.js CHANGED
@@ -448,4 +448,8 @@ jest
448
448
  return jest.requireActual(
449
449
  '../Libraries/ReactNative/RendererImplementation',
450
450
  );
451
- });
451
+ })
452
+ .mock('../Libraries/Utilities/useColorScheme', () => ({
453
+ __esModule: true,
454
+ default: jest.fn().mockReturnValue('light'),
455
+ }));