@office-iss/react-native-win32 0.68.0-preview.3 → 0.69.0-preview.2

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 (180) hide show
  1. package/.flowconfig +1 -3
  2. package/CHANGELOG.json +388 -22
  3. package/CHANGELOG.md +162 -13
  4. package/IntegrationTests/BUCK +4 -1
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -0
  6. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +1 -0
  7. package/Libraries/Alert/Alert.win32.js +1 -1
  8. package/Libraries/Animated/AnimatedImplementation.js +1 -1
  9. package/Libraries/Animated/NativeAnimatedHelper.js +55 -9
  10. package/Libraries/Animated/NativeAnimatedModule.js +1 -0
  11. package/Libraries/Animated/NativeAnimatedTurboModule.js +1 -0
  12. package/Libraries/Animated/animations/TimingAnimation.js +6 -11
  13. package/Libraries/Animated/createAnimatedComponent.js +2 -2
  14. package/Libraries/Animated/nodes/AnimatedColor.js +95 -29
  15. package/Libraries/Animated/nodes/AnimatedInterpolation.js +19 -22
  16. package/Libraries/Animated/nodes/AnimatedNode.js +2 -2
  17. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  18. package/Libraries/AppState/AppState.js +1 -1
  19. package/Libraries/Blob/URL.js +7 -1
  20. package/Libraries/Components/Button.js +3 -0
  21. package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +5 -0
  22. package/Libraries/Components/Pressable/Pressable.js +3 -3
  23. package/Libraries/Components/Pressable/Pressable.win32.js +3 -3
  24. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +47 -38
  25. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +15 -7
  26. package/Libraries/Components/ScrollView/ScrollView.js +1 -1
  27. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -3
  28. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +3 -1
  29. package/Libraries/Components/Slider/Slider.js +0 -2
  30. package/Libraries/Components/Slider/SliderNativeComponent.js +0 -1
  31. package/Libraries/Components/StatusBar/StatusBar.js +6 -1
  32. package/Libraries/Components/Switch/Switch.js +13 -2
  33. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +114 -109
  34. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +17 -9
  35. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +13 -5
  36. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +10 -0
  37. package/Libraries/Components/TextInput/TextInput.js +1 -8
  38. package/Libraries/Components/TextInput/TextInputState.js +10 -2
  39. package/Libraries/Components/TextInput/TextInputState.win32.js +10 -2
  40. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  41. package/Libraries/Components/Touchable/TouchableBounce.js +1 -0
  42. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -0
  43. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -0
  44. package/Libraries/Components/Touchable/TouchableOpacity.js +7 -1
  45. package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +3 -1
  46. package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
  47. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -0
  48. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  49. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  50. package/Libraries/Components/View/View.win32.js +33 -1
  51. package/Libraries/Components/View/ViewNativeComponent.js +68 -8
  52. package/Libraries/Components/View/ViewPropTypes.js +36 -4
  53. package/Libraries/Components/View/ViewPropTypes.win32.js +36 -4
  54. package/Libraries/Components/View/ViewWin32.Props.d.ts +1 -1
  55. package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
  56. package/Libraries/Core/Devtools/parseHermesStack.js +1 -1
  57. package/Libraries/Core/ExceptionsManager.js +1 -1
  58. package/Libraries/Core/RawEventEmitter.js +38 -0
  59. package/Libraries/Core/ReactNativeVersion.js +2 -2
  60. package/Libraries/Core/polyfillPromise.js +32 -0
  61. package/Libraries/Core/setUpReactDevTools.js +3 -2
  62. package/Libraries/EventEmitter/NativeEventEmitter.js +3 -3
  63. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +2 -1
  64. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -3
  65. package/Libraries/Events/CustomEvent.js +32 -0
  66. package/Libraries/Events/EventPolyfill.js +239 -0
  67. package/Libraries/Image/Image.android.js +0 -6
  68. package/Libraries/Image/Image.ios.js +0 -6
  69. package/Libraries/Image/Image.win32.js +2 -8
  70. package/Libraries/Image/ImageViewNativeComponent.js +18 -3
  71. package/Libraries/Image/TextInlineImageNativeComponent.js +23 -15
  72. package/Libraries/Image/resolveAssetSource.win32.js +1 -1
  73. package/Libraries/Inspector/Inspector.js +2 -4
  74. package/Libraries/Inspector/Inspector.win32.js +7 -9
  75. package/Libraries/Interaction/BridgeSpyStallHandler.js +4 -3
  76. package/Libraries/Interaction/InteractionManager.js +1 -12
  77. package/Libraries/Interaction/TaskQueue.js +5 -4
  78. package/Libraries/LayoutAnimation/LayoutAnimation.js +13 -0
  79. package/Libraries/Linking/Linking.js +1 -1
  80. package/Libraries/Lists/FlatList.js +27 -6
  81. package/Libraries/Lists/VirtualizedList.js +71 -55
  82. package/Libraries/Lists/VirtualizedListContext.js +7 -3
  83. package/Libraries/Lists/VirtualizedSectionList.js +2 -2
  84. package/Libraries/Lists/__tests__/{FillRateHelper-test.windows.js → FillRateHelper-test.js} +2 -2
  85. package/Libraries/Lists/__tests__/{FlatList-test.windows.js → FlatList-test.js} +2 -2
  86. package/Libraries/Lists/__tests__/{SectionList-test.windows.js → SectionList-test.js} +14 -14
  87. package/Libraries/Lists/__tests__/{VirtualizeUtils-test.windows.js → VirtualizeUtils-test.js} +3 -3
  88. package/Libraries/Lists/__tests__/{VirtualizedList-test.windows.js → VirtualizedList-test.js} +92 -43
  89. package/Libraries/Lists/__tests__/{VirtualizedSectionList-test.windows.js → VirtualizedSectionList-test.js} +16 -14
  90. package/Libraries/LogBox/Data/LogBoxData.js +2 -2
  91. package/Libraries/LogBox/Data/LogBoxLog.js +1 -1
  92. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  93. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  94. package/Libraries/LogBox/LogBox.js +2 -21
  95. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -0
  96. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +2 -1
  97. package/Libraries/NativeComponent/BaseViewConfig.android.js +295 -0
  98. package/Libraries/NativeComponent/BaseViewConfig.ios.js +333 -0
  99. package/Libraries/NativeComponent/BaseViewConfig.win32.js +334 -0
  100. package/Libraries/NativeComponent/NativeComponentRegistry.js +0 -2
  101. package/Libraries/NativeComponent/PlatformBaseViewConfig.js +24 -0
  102. package/Libraries/NativeComponent/StaticViewConfigValidator.js +7 -42
  103. package/Libraries/NativeComponent/ViewConfig.js +4 -4
  104. package/Libraries/NativeComponent/ViewConfigIgnore.js +54 -0
  105. package/Libraries/Network/FormData.js +7 -1
  106. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  107. package/Libraries/Pressability/Pressability.js +115 -46
  108. package/Libraries/Pressability/Pressability.win32.js +174 -69
  109. package/Libraries/Pressability/PressabilityDebug.js +5 -9
  110. package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +1 -0
  111. package/Libraries/ReactNative/AppContainer.js +1 -1
  112. package/Libraries/ReactNative/{DummyUIManager.js → BridgelessUIManager.js} +62 -40
  113. package/Libraries/ReactNative/PaperUIManager.win32.js +5 -5
  114. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +39 -0
  115. package/Libraries/ReactNative/UIManager.js +2 -3
  116. package/Libraries/ReactNative/renderApplication.js +4 -0
  117. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +8 -0
  118. package/Libraries/Renderer/implementations/ReactFabric-dev.js +5908 -4906
  119. package/Libraries/Renderer/implementations/ReactFabric-prod.js +2100 -1918
  120. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2567 -2352
  121. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5610 -4844
  122. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1710 -1556
  123. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1830 -1639
  124. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  125. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -1
  126. package/Libraries/StyleSheet/EdgeInsetsPropType.js +4 -1
  127. package/Libraries/StyleSheet/StyleSheetTypes.js +59 -66
  128. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  129. package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +15 -0
  130. package/Libraries/StyleSheet/private/_TransformStyle.js +53 -0
  131. package/Libraries/Text/Text.js +13 -7
  132. package/Libraries/Text/TextNativeComponent.js +2 -0
  133. package/Libraries/Text/TextNativeComponent.win32.js +2 -0
  134. package/Libraries/Text/TextProps.js +10 -0
  135. package/Libraries/Types/CoreEventTypes.js +13 -1
  136. package/Libraries/Types/CoreEventTypes.win32.js +26 -1
  137. package/Libraries/Utilities/Appearance.js +0 -8
  138. package/Libraries/Utilities/HMRClient.js +1 -1
  139. package/Libraries/Utilities/ReactNativeTestTools.js +1 -0
  140. package/Libraries/Utilities/codegenNativeComponent.js +17 -6
  141. package/Libraries/Utilities/stringifySafe.js +4 -1
  142. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +3 -3
  143. package/Libraries/WebSocket/WebSocket.js +1 -1
  144. package/Libraries/vendor/emitter/_EmitterSubscription.js +1 -1
  145. package/Libraries/vendor/emitter/_EventEmitter.js +1 -1
  146. package/Libraries/vendor/emitter/_EventSubscription.js +1 -1
  147. package/index.js +30 -25
  148. package/index.win32.js +30 -25
  149. package/jest/preprocessor.js +24 -107
  150. package/jest/preprocessor_DO_NOT_USE.js +122 -0
  151. package/metro.config.js +3 -47
  152. package/overrides.json +39 -46
  153. package/package.json +28 -27
  154. package/rntypes/index.d.ts +19 -7
  155. package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +1 -1
  156. package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +3 -1
  157. package/src/Libraries/Components/View/ViewWin32.Props.ts +1 -0
  158. package/src/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +427 -0
  159. package/src/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap +391 -0
  160. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +3 -0
  161. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap +4565 -0
  162. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap +1153 -0
  163. package/src/rntypes/index.d.ts +19 -7
  164. package/typings-index.js +5 -1
  165. package/typings-index.js.map +1 -1
  166. package/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js +0 -44
  167. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js +0 -45
  168. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +0 -123
  169. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.js +0 -45
  170. package/Libraries/Components/View/ReactNativeViewViewConfig.js +0 -360
  171. package/Libraries/Components/View/ReactNativeViewViewConfig.win32.js +0 -401
  172. package/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js +0 -83
  173. package/Libraries/ReactNative/UIManagerInjection.js +0 -15
  174. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +0 -24527
  175. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +0 -8309
  176. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +0 -8961
  177. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +0 -24948
  178. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +0 -8400
  179. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +0 -9049
  180. package/flow/Promise.js +0 -47
@@ -143,6 +143,13 @@ const ActionSheetIOS = {
143
143
  successCallback,
144
144
  );
145
145
  },
146
+
147
+ dismissActionSheet: () => {
148
+ invariant(RCTActionSheetManager, "ActionSheetManager doesn't exist");
149
+ if (typeof RCTActionSheetManager.dismissActionSheet === 'function') {
150
+ RCTActionSheetManager.dismissActionSheet();
151
+ }
152
+ },
146
153
  };
147
154
 
148
155
  module.exports = ActionSheetIOS;
@@ -47,6 +47,7 @@ export interface Spec extends TurboModule {
47
47
  |}) => void,
48
48
  successCallback: (completed: boolean, activityType: ?string) => void,
49
49
  ) => void;
50
+ +dismissActionSheet?: () => void;
50
51
  }
51
52
 
52
53
  export default (TurboModuleRegistry.get<Spec>('ActionSheetManager'): ?Spec);
@@ -50,7 +50,7 @@ class Alert {
50
50
  message || '',
51
51
  buttons,
52
52
  options,
53
- (buttonIndex) => {
53
+ buttonIndex => {
54
54
  if (
55
55
  buttonIndex >= 0 &&
56
56
  buttons &&
@@ -91,7 +91,7 @@ const diffClamp = function (
91
91
 
92
92
  const _combineCallbacks = function (
93
93
  callback: ?EndCallback,
94
- config: {...AnimationConfig, ...},
94
+ config: $ReadOnly<{...AnimationConfig, ...}>,
95
95
  ) {
96
96
  if (callback && config.onComplete) {
97
97
  return (...args) => {
@@ -90,6 +90,18 @@ const API = {
90
90
  NativeAnimatedModule.createAnimatedNode(tag, config),
91
91
  );
92
92
  },
93
+ updateAnimatedNodeConfig: function (
94
+ tag: number,
95
+ config: AnimatedNodeConfig,
96
+ ): void {
97
+ invariant(NativeAnimatedModule, 'Native animated module is not available');
98
+ if (typeof NativeAnimatedModule.updateAnimatedNodeConfig === 'function') {
99
+ API.queueOperation(() =>
100
+ // $FlowIgnore[not-a-function] - checked above
101
+ NativeAnimatedModule.updateAnimatedNodeConfig(tag, config),
102
+ );
103
+ }
104
+ },
93
105
  startListeningToAnimatedNodeValue: function (tag: number) {
94
106
  invariant(NativeAnimatedModule, 'Native animated module is not available');
95
107
  API.queueOperation(() =>
@@ -222,22 +234,36 @@ const API = {
222
234
  /**
223
235
  * Styles allowed by the native animated implementation.
224
236
  *
225
- * In general native animated implementation should support any numeric property that doesn't need
226
- * to be updated through the shadow view hierarchy (all non-layout properties).
237
+ * In general native animated implementation should support any numeric or color property that
238
+ * doesn't need to be updated through the shadow view hierarchy (all non-layout properties).
227
239
  */
240
+ const SUPPORTED_COLOR_STYLES = {
241
+ backgroundColor: true,
242
+ borderBottomColor: true,
243
+ borderColor: true,
244
+ borderEndColor: true,
245
+ borderLeftColor: true,
246
+ borderRightColor: true,
247
+ borderStartColor: true,
248
+ borderTopColor: true,
249
+ color: true,
250
+ tintColor: true,
251
+ };
252
+
228
253
  const SUPPORTED_STYLES = {
229
- opacity: true,
230
- transform: true,
231
- borderRadius: true,
254
+ ...SUPPORTED_COLOR_STYLES,
232
255
  borderBottomEndRadius: true,
233
256
  borderBottomLeftRadius: true,
234
257
  borderBottomRightRadius: true,
235
258
  borderBottomStartRadius: true,
259
+ borderRadius: true,
236
260
  borderTopEndRadius: true,
237
261
  borderTopLeftRadius: true,
238
262
  borderTopRightRadius: true,
239
263
  borderTopStartRadius: true,
240
264
  elevation: true,
265
+ opacity: true,
266
+ transform: true,
241
267
  zIndex: true,
242
268
  /* ios styles */
243
269
  shadowOpacity: true,
@@ -282,6 +308,22 @@ function addWhitelistedInterpolationParam(param: string): void {
282
308
  SUPPORTED_INTERPOLATION_PARAMS[param] = true;
283
309
  }
284
310
 
311
+ function isSupportedColorStyleProp(prop: string): boolean {
312
+ return SUPPORTED_COLOR_STYLES.hasOwnProperty(prop);
313
+ }
314
+
315
+ function isSupportedStyleProp(prop: string): boolean {
316
+ return SUPPORTED_STYLES.hasOwnProperty(prop);
317
+ }
318
+
319
+ function isSupportedTransformProp(prop: string): boolean {
320
+ return SUPPORTED_TRANSFORMS.hasOwnProperty(prop);
321
+ }
322
+
323
+ function isSupportedInterpolationParam(param: string): boolean {
324
+ return SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(param);
325
+ }
326
+
285
327
  function validateTransform(
286
328
  configs: Array<
287
329
  | {
@@ -299,7 +341,7 @@ function validateTransform(
299
341
  >,
300
342
  ): void {
301
343
  configs.forEach(config => {
302
- if (!SUPPORTED_TRANSFORMS.hasOwnProperty(config.property)) {
344
+ if (!isSupportedTransformProp(config.property)) {
303
345
  throw new Error(
304
346
  `Property '${config.property}' is not supported by native animated module`,
305
347
  );
@@ -309,7 +351,7 @@ function validateTransform(
309
351
 
310
352
  function validateStyles(styles: {[key: string]: ?number, ...}): void {
311
353
  for (const key in styles) {
312
- if (!SUPPORTED_STYLES.hasOwnProperty(key)) {
354
+ if (!isSupportedStyleProp(key)) {
313
355
  throw new Error(
314
356
  `Style property '${key}' is not supported by native animated module`,
315
357
  );
@@ -319,7 +361,7 @@ function validateStyles(styles: {[key: string]: ?number, ...}): void {
319
361
 
320
362
  function validateInterpolation(config: InterpolationConfigType): void {
321
363
  for (const key in config) {
322
- if (!SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(key)) {
364
+ if (!isSupportedInterpolationParam(key)) {
323
365
  throw new Error(
324
366
  `Interpolation property '${key}' is not supported by native animated module`,
325
367
  );
@@ -342,7 +384,7 @@ function assertNativeAnimatedModule(): void {
342
384
  let _warnedMissingNativeAnimated = false;
343
385
 
344
386
  function shouldUseNativeDriver(
345
- config: {...AnimationConfig, ...} | EventConfig,
387
+ config: $ReadOnly<{...AnimationConfig, ...}> | EventConfig,
346
388
  ): boolean {
347
389
  if (config.useNativeDriver == null) {
348
390
  console.warn(
@@ -385,6 +427,10 @@ function transformDataType(value: number | string): number | string {
385
427
 
386
428
  module.exports = {
387
429
  API,
430
+ isSupportedColorStyleProp,
431
+ isSupportedStyleProp,
432
+ isSupportedTransformProp,
433
+ isSupportedInterpolationParam,
388
434
  addWhitelistedStyleProp,
389
435
  addWhitelistedTransformProp,
390
436
  addWhitelistedInterpolationParam,
@@ -29,6 +29,7 @@ export interface Spec extends TurboModule {
29
29
  +startOperationBatch: () => void;
30
30
  +finishOperationBatch: () => void;
31
31
  +createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void;
32
+ +updateAnimatedNodeConfig?: (tag: number, config: AnimatedNodeConfig) => void;
32
33
  +getValue: (tag: number, saveValueCallback: SaveValueCallback) => void;
33
34
  +startListeningToAnimatedNodeValue: (tag: number) => void;
34
35
  +stopListeningToAnimatedNodeValue: (tag: number) => void;
@@ -29,6 +29,7 @@ export interface Spec extends TurboModule {
29
29
  +startOperationBatch: () => void;
30
30
  +finishOperationBatch: () => void;
31
31
  +createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void;
32
+ +updateAnimatedNodeConfig?: (tag: number, config: AnimatedNodeConfig) => void;
32
33
  +getValue: (tag: number, saveValueCallback: SaveValueCallback) => void;
33
34
  +startListeningToAnimatedNodeValue: (tag: number) => void;
34
35
  +stopListeningToAnimatedNodeValue: (tag: number) => void;
@@ -19,10 +19,11 @@ const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
19
19
 
20
20
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
21
21
  import type {AnimationConfig, EndCallback} from './Animation';
22
+ import type {RgbaValue} from '../nodes/AnimatedColor';
22
23
 
23
24
  import AnimatedColor from '../nodes/AnimatedColor';
24
25
 
25
- export type TimingAnimationConfig = {
26
+ export type TimingAnimationConfig = $ReadOnly<{
26
27
  ...AnimationConfig,
27
28
  toValue:
28
29
  | number
@@ -33,27 +34,21 @@ export type TimingAnimationConfig = {
33
34
  ...
34
35
  }
35
36
  | AnimatedValueXY
36
- | {
37
- r: number,
38
- g: number,
39
- b: number,
40
- a: number,
41
- ...
42
- }
37
+ | RgbaValue
43
38
  | AnimatedColor
44
39
  | AnimatedInterpolation,
45
40
  easing?: (value: number) => number,
46
41
  duration?: number,
47
42
  delay?: number,
48
- };
43
+ }>;
49
44
 
50
- export type TimingAnimationConfigSingle = {
45
+ export type TimingAnimationConfigSingle = $ReadOnly<{
51
46
  ...AnimationConfig,
52
47
  toValue: number | AnimatedValue | AnimatedInterpolation,
53
48
  easing?: (value: number) => number,
54
49
  duration?: number,
55
50
  delay?: number,
56
- };
51
+ }>;
57
52
 
58
53
  let _easeInOut;
59
54
  function easeInOut() {
@@ -24,8 +24,8 @@ const setAndForwardRef = require('../Utilities/setAndForwardRef');
24
24
  let animatedComponentNextId = 1;
25
25
 
26
26
  export type AnimatedComponentType<
27
- Props: {+[string]: mixed, ...},
28
- Instance,
27
+ -Props: {+[string]: mixed, ...},
28
+ +Instance = mixed,
29
29
  > = React.AbstractComponent<
30
30
  $ObjMap<
31
31
  Props &
@@ -14,12 +14,15 @@ import AnimatedValue from './AnimatedValue';
14
14
  import AnimatedWithChildren from './AnimatedWithChildren';
15
15
  import normalizeColor from '../../StyleSheet/normalizeColor';
16
16
  import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes';
17
+ import NativeAnimatedHelper from '../NativeAnimatedHelper';
17
18
 
19
+ import type {PlatformConfig} from '../AnimatedPlatformConfig';
18
20
  import type {ColorValue} from '../../StyleSheet/StyleSheet';
19
21
  import type {NativeColorValue} from '../../StyleSheet/PlatformColorValueTypes';
22
+ import type {ProcessedColorValue} from '../../StyleSheet/processColor';
20
23
 
21
24
  type ColorListenerCallback = (value: string) => mixed;
22
- type RgbaValue = {
25
+ export type RgbaValue = {
23
26
  +r: number,
24
27
  +g: number,
25
28
  +b: number,
@@ -38,26 +41,37 @@ const defaultColor: RgbaValue = {r: 0, g: 0, b: 0, a: 1.0};
38
41
  let _uniqueId = 1;
39
42
 
40
43
  /* eslint no-bitwise: 0 */
41
- function processColor(color?: ?ColorValue): ?(RgbaValue | NativeColorValue) {
44
+ function processColor(
45
+ color?: ?(ColorValue | RgbaValue),
46
+ ): ?(RgbaValue | NativeColorValue) {
42
47
  if (color === undefined || color === null) {
43
48
  return null;
44
49
  }
45
50
 
46
- let normalizedColor = normalizeColor(color);
51
+ if (isRgbaValue(color)) {
52
+ // $FlowIgnore[incompatible-cast] - Type is verified above
53
+ return (color: RgbaValue);
54
+ }
55
+
56
+ let normalizedColor: ?ProcessedColorValue = normalizeColor(
57
+ // $FlowIgnore[incompatible-cast] - Type is verified above
58
+ (color: ColorValue),
59
+ );
47
60
  if (normalizedColor === undefined || normalizedColor === null) {
48
61
  return null;
49
62
  }
50
63
 
51
64
  if (typeof normalizedColor === 'object') {
52
- const processedColorObj = processColorObject(normalizedColor);
65
+ const processedColorObj: ?NativeColorValue =
66
+ processColorObject(normalizedColor);
53
67
  if (processedColorObj != null) {
54
68
  return processedColorObj;
55
69
  }
56
70
  } else if (typeof normalizedColor === 'number') {
57
- const r = (normalizedColor & 0xff000000) >>> 24;
58
- const g = (normalizedColor & 0x00ff0000) >>> 16;
59
- const b = (normalizedColor & 0x0000ff00) >>> 8;
60
- const a = (normalizedColor & 0x000000ff) / 255;
71
+ const r: number = (normalizedColor & 0xff000000) >>> 24;
72
+ const g: number = (normalizedColor & 0x00ff0000) >>> 16;
73
+ const b: number = (normalizedColor & 0x0000ff00) >>> 8;
74
+ const a: number = (normalizedColor & 0x000000ff) / 255;
61
75
 
62
76
  return {r, g, b, a};
63
77
  }
@@ -90,6 +104,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
90
104
  g: AnimatedValue;
91
105
  b: AnimatedValue;
92
106
  a: AnimatedValue;
107
+ nativeColor: ?NativeColorValue;
93
108
  _listeners: {
94
109
  [key: string]: {
95
110
  r: string,
@@ -99,13 +114,12 @@ export default class AnimatedColor extends AnimatedWithChildren {
99
114
  ...
100
115
  },
101
116
  ...
102
- };
117
+ } = {};
103
118
 
104
119
  constructor(valueIn?: ?(RgbaValue | RgbaAnimatedValue | ColorValue)) {
105
120
  super();
106
121
  let value: RgbaValue | RgbaAnimatedValue | ColorValue =
107
- valueIn || defaultColor;
108
-
122
+ valueIn ?? defaultColor;
109
123
  if (isRgbaAnimatedValue(value)) {
110
124
  // $FlowIgnore[incompatible-cast] - Type is verified above
111
125
  const rgbaAnimatedValue: RgbaAnimatedValue = (value: RgbaAnimatedValue);
@@ -114,32 +128,65 @@ export default class AnimatedColor extends AnimatedWithChildren {
114
128
  this.b = rgbaAnimatedValue.b;
115
129
  this.a = rgbaAnimatedValue.a;
116
130
  } else {
117
- // Handle potential parsable string color or platform color object
118
- if (!isRgbaValue(value)) {
119
- // $FlowIgnore[incompatible-cast] - Type is verified via conditionals
120
- value = processColor((value: ColorValue)) || {r: 0, g: 0, b: 0, a: 1.0};
121
- // TODO: support platform color
131
+ const processedColor: RgbaValue | NativeColorValue =
132
+ // $FlowIgnore[incompatible-cast] - Type is verified above
133
+ processColor((value: ColorValue | RgbaValue)) ?? defaultColor;
134
+ let initColor: RgbaValue = defaultColor;
135
+ if (isRgbaValue(processedColor)) {
136
+ // $FlowIgnore[incompatible-cast] - Type is verified above
137
+ initColor = (processedColor: RgbaValue);
138
+ } else {
139
+ // $FlowIgnore[incompatible-cast] - Type is verified above
140
+ this.nativeColor = (processedColor: NativeColorValue);
122
141
  }
123
142
 
124
- // $FlowIgnore[incompatible-cast] - Type is verified via conditionals
125
- const rgbaValue: RgbaValue = (value: RgbaValue);
126
- this.r = new AnimatedValue(rgbaValue.r);
127
- this.g = new AnimatedValue(rgbaValue.g);
128
- this.b = new AnimatedValue(rgbaValue.b);
129
- this.a = new AnimatedValue(rgbaValue.a);
143
+ this.r = new AnimatedValue(initColor.r);
144
+ this.g = new AnimatedValue(initColor.g);
145
+ this.b = new AnimatedValue(initColor.b);
146
+ this.a = new AnimatedValue(initColor.a);
147
+
148
+ if (this.nativeColor) {
149
+ if (!this.__isNative) {
150
+ this.__makeNative();
151
+ }
152
+ }
130
153
  }
131
- this._listeners = {};
132
154
  }
133
155
 
134
156
  /**
135
157
  * Directly set the value. This will stop any animations running on the value
136
158
  * and update all the bound properties.
137
159
  */
138
- setValue(value: {r: number, g: number, b: number, a: number, ...}): void {
139
- this.r.setValue(value.r);
140
- this.g.setValue(value.g);
141
- this.b.setValue(value.b);
142
- this.a.setValue(value.a);
160
+ setValue(value: RgbaValue | ColorValue): void {
161
+ this.nativeColor = null;
162
+
163
+ const processedColor: RgbaValue | NativeColorValue =
164
+ processColor(value) ?? defaultColor;
165
+ if (isRgbaValue(processedColor)) {
166
+ // $FlowIgnore[incompatible-cast] - Type is verified above
167
+ const rgbaValue: RgbaValue = (processedColor: RgbaValue);
168
+ this.r.setValue(rgbaValue.r);
169
+ this.g.setValue(rgbaValue.g);
170
+ this.b.setValue(rgbaValue.b);
171
+ this.a.setValue(rgbaValue.a);
172
+ } else {
173
+ // $FlowIgnore[incompatible-cast] - Type is verified above
174
+ this.nativeColor = (processedColor: NativeColorValue);
175
+ }
176
+
177
+ if (this.nativeColor) {
178
+ if (!this.__isNative) {
179
+ this.__makeNative();
180
+ }
181
+
182
+ const nativeTag = this.__getNativeTag();
183
+ NativeAnimatedHelper.API.setWaitingForIdentifier(nativeTag.toString());
184
+ NativeAnimatedHelper.API.updateAnimatedNodeConfig(
185
+ nativeTag,
186
+ this.__getNativeConfig(),
187
+ );
188
+ NativeAnimatedHelper.API.unsetWaitingForIdentifier(nativeTag.toString());
189
+ }
143
190
  }
144
191
 
145
192
  /**
@@ -147,7 +194,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
147
194
  * via `setValue`, an animation, or `Animated.event`. Useful for compensating
148
195
  * things like the start of a pan gesture.
149
196
  */
150
- setOffset(offset: {r: number, g: number, b: number, a: number, ...}): void {
197
+ setOffset(offset: RgbaValue): void {
151
198
  this.r.setOffset(offset.r);
152
199
  this.g.setOffset(offset.g);
153
200
  this.b.setOffset(offset.b);
@@ -263,4 +310,23 @@ export default class AnimatedColor extends AnimatedWithChildren {
263
310
  this.a.__removeChild(this);
264
311
  super.__detach();
265
312
  }
313
+
314
+ __makeNative(platformConfig: ?PlatformConfig) {
315
+ this.r.__makeNative(platformConfig);
316
+ this.g.__makeNative(platformConfig);
317
+ this.b.__makeNative(platformConfig);
318
+ this.a.__makeNative(platformConfig);
319
+ super.__makeNative(platformConfig);
320
+ }
321
+
322
+ __getNativeConfig(): {...} {
323
+ return {
324
+ type: 'color',
325
+ r: this.r.__getNativeTag(),
326
+ g: this.g.__getNativeTag(),
327
+ b: this.b.__getNativeTag(),
328
+ a: this.a.__getNativeTag(),
329
+ nativeColor: this.nativeColor,
330
+ };
331
+ }
266
332
  }
@@ -23,14 +23,14 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
23
23
 
24
24
  type ExtrapolateType = 'extend' | 'identity' | 'clamp';
25
25
 
26
- export type InterpolationConfigType = {
26
+ export type InterpolationConfigType = $ReadOnly<{
27
27
  inputRange: $ReadOnlyArray<number>,
28
28
  outputRange: $ReadOnlyArray<number> | $ReadOnlyArray<string>,
29
29
  easing?: (input: number) => number,
30
30
  extrapolate?: ExtrapolateType,
31
31
  extrapolateLeft?: ExtrapolateType,
32
32
  extrapolateRight?: ExtrapolateType,
33
- };
33
+ }>;
34
34
 
35
35
  const linear = (t: number) => t;
36
36
 
@@ -46,20 +46,23 @@ function createInterpolation(
46
46
  }
47
47
 
48
48
  const outputRange: Array<number> = (config.outputRange: any);
49
- checkInfiniteRange('outputRange', outputRange);
50
49
 
51
50
  const inputRange = config.inputRange;
52
- checkInfiniteRange('inputRange', inputRange);
53
- checkValidInputRange(inputRange);
54
51
 
55
- invariant(
56
- inputRange.length === outputRange.length,
57
- 'inputRange (' +
58
- inputRange.length +
59
- ') and outputRange (' +
60
- outputRange.length +
61
- ') must have the same length',
62
- );
52
+ if (__DEV__) {
53
+ checkInfiniteRange('outputRange', outputRange);
54
+ checkInfiniteRange('inputRange', inputRange);
55
+ checkValidInputRange(inputRange);
56
+
57
+ invariant(
58
+ inputRange.length === outputRange.length,
59
+ 'inputRange (' +
60
+ inputRange.length +
61
+ ') and outputRange (' +
62
+ outputRange.length +
63
+ ') must have the same length',
64
+ );
65
+ }
63
66
 
64
67
  const easing = config.easing || linear;
65
68
 
@@ -276,16 +279,10 @@ function findRange(input: number, inputRange: $ReadOnlyArray<number>) {
276
279
 
277
280
  function checkValidInputRange(arr: $ReadOnlyArray<number>) {
278
281
  invariant(arr.length >= 2, 'inputRange must have at least 2 elements');
282
+ const message =
283
+ 'inputRange must be monotonically non-decreasing ' + String(arr);
279
284
  for (let i = 1; i < arr.length; ++i) {
280
- invariant(
281
- arr[i] >= arr[i - 1],
282
- /* $FlowFixMe[incompatible-type] (>=0.13.0) - In the addition expression
283
- * below this comment, one or both of the operands may be something that
284
- * doesn't cleanly convert to a string, like undefined, null, and object,
285
- * etc. If you really mean this implicit string conversion, you can do
286
- * something like String(myThing) */
287
- 'inputRange must be monotonically non-decreasing ' + arr,
288
- );
285
+ invariant(arr[i] >= arr[i - 1], message);
289
286
  }
290
287
  }
291
288
 
@@ -130,12 +130,12 @@ class AnimatedNode {
130
130
  if (data.tag !== this.__getNativeTag()) {
131
131
  return;
132
132
  }
133
- this._onAnimatedValueUpdateReceived(data.value);
133
+ this.__onAnimatedValueUpdateReceived(data.value);
134
134
  },
135
135
  );
136
136
  }
137
137
 
138
- _onAnimatedValueUpdateReceived(value: number) {
138
+ __onAnimatedValueUpdateReceived(value: number) {
139
139
  this.__callListeners(value);
140
140
  }
141
141
 
@@ -211,7 +211,7 @@ class AnimatedValue extends AnimatedWithChildren {
211
211
  }
212
212
  }
213
213
 
214
- _onAnimatedValueUpdateReceived(value: number): void {
214
+ __onAnimatedValueUpdateReceived(value: number): void {
215
215
  this._updateValue(value, false /*flush*/);
216
216
  }
217
217
 
@@ -154,7 +154,7 @@ class AppState {
154
154
  case 'focus':
155
155
  // $FlowIssue[invalid-tuple-arity] Flow cannot refine handler based on the event type
156
156
  // $FlowIssue[incompatible-call]
157
- emitter.addListener('appStateFocusChange', listener);
157
+ emitter.removeListener('appStateFocusChange', listener);
158
158
  return;
159
159
  }
160
160
  throw new Error('Trying to unsubscribe from unknown event: ' + type);
@@ -101,7 +101,13 @@ export class URLSearchParams {
101
101
  }
102
102
  const last = this._searchParams.length - 1;
103
103
  return this._searchParams.reduce((acc, curr, index) => {
104
- return acc + curr.join('=') + (index === last ? '' : '&');
104
+ return (
105
+ acc +
106
+ encodeURIComponent(curr[0]) +
107
+ '=' +
108
+ encodeURIComponent(curr[1]) +
109
+ (index === last ? '' : '&')
110
+ );
105
111
  }, '');
106
112
  }
107
113
  }
@@ -146,6 +146,7 @@ type ButtonProps = $ReadOnly<{|
146
146
  onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
147
147
  accessibilityState?: ?AccessibilityState,
148
148
  accessibilityHint?: ?string,
149
+ accessibilityLanguage?: ?Stringish,
149
150
  |}>;
150
151
 
151
152
  /**
@@ -277,6 +278,7 @@ class Button extends React.Component<ButtonProps> {
277
278
  accessible,
278
279
  accessibilityActions,
279
280
  accessibilityHint,
281
+ accessibilityLanguage,
280
282
  onAccessibilityAction,
281
283
  } = this.props;
282
284
  const buttonStyles = [styles.button];
@@ -320,6 +322,7 @@ class Button extends React.Component<ButtonProps> {
320
322
  onAccessibilityAction={onAccessibilityAction}
321
323
  accessibilityLabel={accessibilityLabel}
322
324
  accessibilityHint={accessibilityHint}
325
+ accessibilityLanguage={accessibilityLanguage}
323
326
  accessibilityRole="button"
324
327
  accessibilityState={accessibilityState}
325
328
  hasTVPreferredFocus={hasTVPreferredFocus}
@@ -11,6 +11,11 @@
11
11
  import type {TurboModule} from '../../TurboModule/RCTExport';
12
12
  import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';
13
13
 
14
+ /**
15
+ * This file backs native modules that are used internally at Meta
16
+ * and this JS spec was intentionally left here. In the meanwhile this
17
+ * file should not be deleted.
18
+ */
14
19
  export interface Spec extends TurboModule {
15
20
  +open: (options: Object) => Promise<Object>;
16
21
  }
@@ -22,7 +22,7 @@ import type {
22
22
  } from '../View/ViewAccessibility';
23
23
  import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
24
24
  import usePressability from '../../Pressability/usePressability';
25
- import {normalizeRect, type RectOrSize} from '../../StyleSheet/Rect';
25
+ import {type RectOrSize} from '../../StyleSheet/Rect';
26
26
  import type {
27
27
  LayoutEvent,
28
28
  MouseEvent,
@@ -43,6 +43,7 @@ type Props = $ReadOnly<{|
43
43
  accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
44
44
  accessibilityElementsHidden?: ?boolean,
45
45
  accessibilityHint?: ?Stringish,
46
+ accessibilityLanguage?: ?Stringish,
46
47
  accessibilityIgnoresInvertColors?: ?boolean,
47
48
  accessibilityLabel?: ?Stringish,
48
49
  accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
@@ -181,6 +182,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
181
182
  delayLongPress,
182
183
  disabled,
183
184
  focusable,
185
+ hitSlop,
184
186
  onHoverIn,
185
187
  onHoverOut,
186
188
  onLongPress,
@@ -201,8 +203,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
201
203
 
202
204
  const [pressed, setPressed] = usePressState(testOnly_pressed === true);
203
205
 
204
- const hitSlop = normalizeRect(props.hitSlop);
205
-
206
206
  const accessibilityState =
207
207
  disabled != null
208
208
  ? {...props.accessibilityState, disabled}