react-native-windows 0.83.0-preview.2 → 0.84.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 (221) hide show
  1. package/.flowconfig +2 -2
  2. package/Folly/Folly.vcxproj +2 -0
  3. package/Libraries/Animated/AnimatedEvent.js +2 -2
  4. package/Libraries/Animated/animations/Animation.js +1 -3
  5. package/Libraries/Animated/createAnimatedComponent.js +8 -5
  6. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  7. package/Libraries/Animated/nodes/AnimatedInterpolation.js +40 -4
  8. package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
  9. package/Libraries/Animated/nodes/AnimatedObject.js +16 -11
  10. package/Libraries/Animated/nodes/AnimatedProps.js +43 -12
  11. package/Libraries/Animated/nodes/AnimatedStyle.js +12 -12
  12. package/Libraries/Animated/nodes/AnimatedValue.js +6 -3
  13. package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
  14. package/Libraries/BatchedBridge/MessageQueue.js +24 -22
  15. package/Libraries/Blob/URL.js +34 -3
  16. package/Libraries/Blob/URLSearchParams.js +1 -0
  17. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +9 -1
  18. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +6 -1
  19. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +6 -1
  20. package/Libraries/Components/Button.js +2 -5
  21. package/Libraries/Components/Button.windows.js +2 -5
  22. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  23. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +4 -4
  24. package/Libraries/Components/Keyboard/Keyboard.js +2 -2
  25. package/Libraries/Components/Pressable/Pressable.js +8 -8
  26. package/Libraries/Components/Pressable/Pressable.windows.js +14 -13
  27. package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
  28. package/Libraries/Components/TextInput/TextInput.flow.windows.js +19 -18
  29. package/Libraries/Components/TextInput/TextInput.js +33 -34
  30. package/Libraries/Components/TextInput/TextInput.windows.js +40 -39
  31. package/Libraries/Components/Touchable/PooledClass.js +2 -2
  32. package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
  33. package/Libraries/Components/Touchable/TouchableBounce.windows.js +3 -3
  34. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  35. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +1 -1
  36. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
  37. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +9 -9
  38. package/Libraries/Components/View/ViewPropTypes.js +16 -6
  39. package/Libraries/Components/View/ViewPropTypes.windows.js +21 -11
  40. package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
  41. package/Libraries/Core/Devtools/loadBundleFromServer.windows.js +6 -3
  42. package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
  43. package/Libraries/Core/ExceptionsManager.js +3 -3
  44. package/Libraries/Core/RawEventEmitter.js +1 -1
  45. package/Libraries/Core/ReactFiberErrorDialog.js +1 -1
  46. package/Libraries/Core/ReactNativeVersion.js +3 -3
  47. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  48. package/Libraries/Core/setUpErrorHandling.js +1 -1
  49. package/Libraries/EventEmitter/NativeEventEmitter.js +2 -2
  50. package/Libraries/Image/Image.android.js +2 -2
  51. package/Libraries/Image/Image.ios.js +2 -2
  52. package/Libraries/Image/Image.windows.js +2 -2
  53. package/Libraries/Image/ImageProps.js +1 -1
  54. package/Libraries/Image/ImageTypes.flow.js +2 -2
  55. package/Libraries/Interaction/InteractionManager.js +3 -3
  56. package/Libraries/Interaction/PanResponder.js +1 -1
  57. package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
  58. package/Libraries/Linking/Linking.js +1 -1
  59. package/Libraries/Lists/FlatList.js +2 -2
  60. package/Libraries/LogBox/Data/LogBoxData.js +31 -4
  61. package/Libraries/LogBox/Data/LogBoxLog.js +2 -2
  62. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  63. package/Libraries/LogBox/Data/parseLogBoxLog.js +5 -5
  64. package/Libraries/LogBox/LogBox.js +7 -7
  65. package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
  66. package/Libraries/NativeComponent/StaticViewConfigValidator.js +4 -4
  67. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
  68. package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +1 -1
  69. package/Libraries/Network/RCTNetworking.android.js +3 -3
  70. package/Libraries/Network/RCTNetworking.ios.js +2 -2
  71. package/Libraries/Network/RCTNetworking.js.flow +2 -2
  72. package/Libraries/Network/RCTNetworking.windows.js +2 -2
  73. package/Libraries/Pressability/Pressability.js +9 -9
  74. package/Libraries/Pressability/Pressability.windows.js +17 -16
  75. package/Libraries/ReactNative/AppRegistry.flow.js +1 -1
  76. package/Libraries/ReactNative/BridgelessUIManager.js +1 -1
  77. package/Libraries/ReactNative/FabricUIManager.js +1 -1
  78. package/Libraries/ReactNative/PaperUIManager.js +1 -1
  79. package/Libraries/ReactNative/PaperUIManager.windows.js +1 -1
  80. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -1
  81. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +2 -2
  82. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +1 -1
  83. package/Libraries/ReactNative/RendererImplementation.js +1 -1
  84. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  85. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -2
  86. package/Libraries/Renderer/implementations/ReactFabric-dev.js +3 -3
  87. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
  88. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
  89. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +11 -4
  90. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +11 -4
  91. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11 -4
  92. package/Libraries/Renderer/shims/ReactFabric.js +3 -1
  93. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
  94. package/Libraries/Renderer/shims/ReactNative.js +2 -2
  95. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
  96. package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +3 -1
  97. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  98. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
  99. package/Libraries/Settings/Settings.ios.js +1 -1
  100. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  101. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  102. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +4 -2
  103. package/Libraries/StyleSheet/StyleSheetExports.js +1 -1
  104. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +99 -4
  105. package/Libraries/StyleSheet/StyleSheetTypes.js +6 -8
  106. package/Libraries/StyleSheet/processFilter.js +1 -1
  107. package/Libraries/Text/Text.js +46 -6
  108. package/Libraries/Text/Text.windows.js +46 -6
  109. package/Libraries/Text/TextNativeComponent.js +1 -1
  110. package/Libraries/Text/TextProps.js +7 -7
  111. package/Libraries/Text/TextProps.windows.js +7 -7
  112. package/Libraries/Types/CodegenTypes.js +1 -1
  113. package/Libraries/Types/CoreEventTypes.js +31 -0
  114. package/Libraries/Types/CoreEventTypes.windows.js +31 -13
  115. package/Libraries/Types/ReactDevToolsTypes.js +2 -2
  116. package/Libraries/Utilities/Appearance.js +2 -2
  117. package/Libraries/Utilities/DevLoadingView.js +8 -1
  118. package/Libraries/Utilities/DevSettings.js +3 -3
  119. package/Libraries/Utilities/HMRClient.js +4 -3
  120. package/Libraries/Utilities/RCTLog.js +3 -3
  121. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  122. package/Libraries/Utilities/SceneTracker.js +1 -1
  123. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  124. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +3 -3
  125. package/Libraries/Utilities/logError.js +1 -1
  126. package/Libraries/Utilities/stringifySafe.js +7 -7
  127. package/Libraries/Utilities/useRefEffect.js +1 -1
  128. package/Libraries/WebSocket/WebSocketInterceptor.js +3 -3
  129. package/Libraries/promiseRejectionTrackingOptions.js +8 -8
  130. package/Libraries/vendor/core/ErrorUtils.js +10 -10
  131. package/Libraries/vendor/emitter/EventEmitter.js +6 -6
  132. package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +5 -0
  133. package/Microsoft.ReactNative/Fabric/AbiViewProps.h +1 -0
  134. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +25 -5
  135. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +2 -1
  136. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +9 -3
  137. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +2 -3
  138. package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +2 -2
  139. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +2 -0
  140. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +6 -0
  141. package/Microsoft.ReactNative/ViewProps.idl +9 -0
  142. package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +12 -2
  143. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  144. package/ReactCommon/ReactCommon.vcxproj +7 -1
  145. package/ReactCommon/ReactCommon.vcxproj.filters +0 -3
  146. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +5 -5
  147. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +0 -1
  148. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +2 -43
  149. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +12 -2
  150. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/attributedstring/TextAttributes.cpp +291 -0
  151. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +0 -1
  152. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +1 -3
  153. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/propsConversions.h +199 -0
  154. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +6 -0
  155. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +17 -10
  156. package/Scripts/creaternwapp.cmd +8 -1
  157. package/Scripts/creaternwlib.cmd +21 -2
  158. package/Shared/DevSettings.h +0 -3
  159. package/Shared/Modules/WebSocketModule.cpp +0 -1
  160. package/Shared/Modules/WebSocketModule.h +62 -3
  161. package/Shared/OInstance.cpp +5 -0
  162. package/Shared/Shared.vcxitems +4 -6
  163. package/Shared/Shared.vcxitems.filters +218 -709
  164. package/codegen/NativeAccessibilityManagerSpec.g.h +2 -0
  165. package/codegen/NativeAnimatedModuleSpec.g.h +21 -15
  166. package/codegen/NativeDevLoadingViewSpec.g.h +3 -3
  167. package/codegen/NativeIntentAndroidSpec.g.h +16 -3
  168. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +209 -191
  169. package/codegen/react/components/rnwcore/EventEmitters.h +1 -0
  170. package/codegen/react/components/rnwcore/Props.h +14 -0
  171. package/codegen/rnwcoreJSI.h +246 -211
  172. package/index.js +3 -0
  173. package/index.windows.js +3 -0
  174. package/jest/mock.js +2 -2
  175. package/jest/mockComponent.js +1 -1
  176. package/jest/setup.js +1 -1
  177. package/package.json +22 -21
  178. package/src/private/animated/NativeAnimatedHelper.js +130 -125
  179. package/src/private/animated/NativeAnimatedValidation.js +7 -4
  180. package/src/private/animated/createAnimatedPropsHook.js +13 -5
  181. package/src/private/animated/createAnimatedPropsMemoHook.js +10 -10
  182. package/src/private/components/virtualview/VirtualView.js +16 -9
  183. package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
  184. package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
  185. package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
  186. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +6 -25
  187. package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +1 -27
  188. package/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +3 -2
  189. package/src/private/featureflags/ReactNativeFeatureFlags.js +63 -42
  190. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +3 -3
  191. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +12 -9
  192. package/src/private/renderer/errorhandling/ErrorHandlers.js +7 -4
  193. package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +1 -1
  194. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +4 -0
  195. package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +1 -0
  196. package/src/private/webapis/dom/events/CustomEvent.js +3 -3
  197. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentElementInstanceHandle.js +1 -1
  198. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  199. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +29 -29
  200. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +1 -1
  201. package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
  202. package/src/private/webapis/geometry/DOMRectReadOnly.js +1 -1
  203. package/src/private/webapis/html/events/MessageEvent.js +3 -3
  204. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +3 -3
  205. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +53 -5
  206. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +2 -2
  207. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +4 -4
  208. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
  209. package/src/private/webapis/mutationobserver/MutationObserver.js +1 -1
  210. package/src/private/webapis/mutationobserver/MutationRecord.js +1 -1
  211. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -4
  212. package/src/private/webapis/performance/Performance.js +1 -1
  213. package/src/private/webapis/performance/UserTiming.js +1 -1
  214. package/src/private/webapis/performance/specs/NativePerformance.js +3 -3
  215. package/src/private/webapis/structuredClone/structuredClone.js +3 -3
  216. package/src/types/globals.d.ts +30 -1
  217. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +0 -178
  218. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +0 -183
  219. package/Shared/Modules/WebSocketTurboModule.h +0 -71
  220. package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
  221. package/src/private/devsupport/devmenu/perfmonitor/PerformanceOverlay.js +0 -66
package/.flowconfig CHANGED
@@ -143,7 +143,7 @@ module.name_mapper='^react-native-windows$' -> '<PROJECT_ROOT>/index.windows.js'
143
143
  module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/\1'
144
144
  module.name_mapper='^react-native-windows/\(.*\)$' -> '<PROJECT_ROOT>/\1'
145
145
  module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/\1'
146
- module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\|ktx\)$' -> '<PROJECT_ROOT>/Libraries/Image/RelativeImageStub'
146
+ module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\|ktx\|heic\|heif\)$' -> '<PROJECT_ROOT>/Libraries/Image/RelativeImageStub'
147
147
 
148
148
  module.system.haste.module_ref_prefix=m#
149
149
 
@@ -173,4 +173,4 @@ untyped-import
173
173
  untyped-type-import
174
174
 
175
175
  [version]
176
- ^0.289.0
176
+ ^0.295.0
@@ -77,6 +77,8 @@
77
77
  <ClCompile Include="$(FollyDir)\folly\ScopeGuard.cpp" />
78
78
  <ClCompile Include="$(FollyDir)\folly\Unicode.cpp" />
79
79
  <ClCompile Include="$(FollyDir)\folly\memory\detail\MallocImpl.cpp" />
80
+ <ClCompile Include="$(FollyDir)\folly\memory\SanitizeLeak.cpp" />
81
+ <ClCompile Include="$(FollyDir)\folly\lang\Exception.cpp" />
80
82
  <ClCompile Include="pch.cpp">
81
83
  <PrecompiledHeader>Create</PrecompiledHeader>
82
84
  </ClCompile>
@@ -25,7 +25,7 @@ export type Mapping =
25
25
  | AnimatedValue
26
26
  | AnimatedValueXY;
27
27
  export type EventConfig<T> = {
28
- listener?: ?(NativeSyntheticEvent<T>) => mixed,
28
+ listener?: ?(NativeSyntheticEvent<T>) => unknown,
29
29
  useNativeDriver: boolean,
30
30
  platformConfig?: PlatformConfig,
31
31
  };
@@ -40,7 +40,7 @@ export function attachNativeEventImpl(
40
40
  // key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x'].
41
41
  const eventMappings: Array<EventMapping> = [];
42
42
 
43
- const traverse = (value: mixed, path: Array<string>) => {
43
+ const traverse = (value: unknown, path: Array<string>) => {
44
44
  if (value instanceof AnimatedValue) {
45
45
  value.__makeNative(platformConfig);
46
46
 
@@ -151,9 +151,7 @@ export default class Animation {
151
151
  animatedValue.__onAnimatedValueUpdateReceived(value, offset);
152
152
 
153
153
  const isJsSyncRemoved =
154
- ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() &&
155
- !ReactNativeFeatureFlags.disableFabricCommitInCXXAnimated() &&
156
- ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync();
154
+ ReactNativeFeatureFlags.cxxNativeAnimatedEnabled();
157
155
  if (!isJsSyncRemoved) {
158
156
  if (this.__isLooping === true) {
159
157
  return;
@@ -8,6 +8,7 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {NativeColorValue} from '../StyleSheet/StyleSheetTypes';
11
12
  import type AnimatedAddition from './nodes/AnimatedAddition';
12
13
  import type AnimatedDiffClamp from './nodes/AnimatedDiffClamp';
13
14
  import type AnimatedDivision from './nodes/AnimatedDivision';
@@ -28,7 +29,7 @@ import {useMemo} from 'react';
28
29
 
29
30
  type Nullable = void | null;
30
31
  type Primitive = string | number | boolean | symbol | void;
31
- type Builtin = (...$ReadOnlyArray<empty>) => mixed | Date | Error | RegExp;
32
+ type Builtin = (...$ReadOnlyArray<empty>) => unknown | Date | Error | RegExp;
32
33
 
33
34
  export type WithAnimatedValue<+T> = T extends Builtin | Nullable
34
35
  ? T
@@ -46,6 +47,7 @@ export type WithAnimatedValue<+T> = T extends Builtin | Nullable
46
47
  | AnimatedInterpolation<number | string>
47
48
  | AnimatedInterpolation<number>
48
49
  | AnimatedInterpolation<string>
50
+ | AnimatedInterpolation<NativeColorValue>
49
51
  : T extends $ReadOnlyArray<infer P>
50
52
  ? $ReadOnlyArray<WithAnimatedValue<P>>
51
53
  : T extends {...}
@@ -87,10 +89,10 @@ export type AnimatedBaseProps<Props: {...}> = LooseOmit<
87
89
  'ref',
88
90
  >;
89
91
 
90
- export type AnimatedComponentType<Props: {...}, +Instance = mixed> = component(
91
- ref?: React.RefSetter<Instance>,
92
- ...AnimatedProps<Props>
93
- );
92
+ export type AnimatedComponentType<
93
+ Props: {...},
94
+ +Instance = unknown,
95
+ > = component(ref?: React.RefSetter<Instance>, ...AnimatedProps<Props>);
94
96
 
95
97
  export default function createAnimatedComponent<
96
98
  TInstance: React.ComponentType<any>,
@@ -125,6 +127,7 @@ export function unstable_createAnimatedComponentWithAllowlist<
125
127
  const [reducedProps, callbackRef] = useAnimatedProps<
126
128
  TProps,
127
129
  React.ElementRef<TInstance>,
130
+ // $FlowFixMe[incompatible-type]
128
131
  >(props);
129
132
  const ref = useMergeRefs<React.ElementRef<TInstance>>(
130
133
  callbackRef,
@@ -27,7 +27,7 @@ export type AnimatedColorConfig = $ReadOnly<{
27
27
  useNativeDriver: boolean,
28
28
  }>;
29
29
 
30
- type ColorListenerCallback = (value: ColorValue) => mixed;
30
+ type ColorListenerCallback = (value: ColorValue) => unknown;
31
31
 
32
32
  export type RgbaValue = {
33
33
  +r: number,
@@ -12,6 +12,7 @@
12
12
 
13
13
  'use strict';
14
14
 
15
+ import type {NativeColorValue} from '../../StyleSheet/StyleSheetTypes';
15
16
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
16
17
  import type AnimatedNode from './AnimatedNode';
17
18
  import type {AnimatedNodeConfig} from './AnimatedNode';
@@ -26,7 +27,14 @@ import invariant from 'invariant';
26
27
 
27
28
  type ExtrapolateType = 'extend' | 'identity' | 'clamp';
28
29
 
29
- export type InterpolationConfigType<OutputT: number | string> = $ReadOnly<{
30
+ export type InterpolationConfigSupportedOutputType =
31
+ | number
32
+ | string
33
+ | NativeColorValue;
34
+
35
+ export type InterpolationConfigType<
36
+ OutputT: InterpolationConfigSupportedOutputType,
37
+ > = $ReadOnly<{
30
38
  ...AnimatedNodeConfig,
31
39
  inputRange: $ReadOnlyArray<number>,
32
40
  outputRange: $ReadOnlyArray<OutputT>,
@@ -82,6 +90,28 @@ function createNumericInterpolation(
82
90
  };
83
91
  }
84
92
 
93
+ function createPlatformColorInterpolation(
94
+ config: InterpolationConfigType<NativeColorValue>,
95
+ ): (input: number) => NativeColorValue {
96
+ const outputRange = config.outputRange;
97
+ const outputRangeIndices = Array.from(Array(outputRange.length).keys());
98
+ const interpolateIndex = createNumericInterpolation({
99
+ ...config,
100
+ inputRange: config.inputRange,
101
+ outputRange: outputRangeIndices,
102
+ });
103
+
104
+ return input => {
105
+ const interpolateResult = interpolateIndex(input);
106
+ if (!Number.isInteger(interpolateResult)) {
107
+ console.warn(
108
+ 'PlatformColor interpolation should happen natively, here we fallback to the closest color',
109
+ );
110
+ }
111
+ return outputRange[Math.floor(interpolateResult)];
112
+ };
113
+ }
114
+
85
115
  function interpolate(
86
116
  input: number,
87
117
  inputMin: number,
@@ -277,7 +307,7 @@ function findRange(input: number, inputRange: $ReadOnlyArray<number>) {
277
307
  return i - 1;
278
308
  }
279
309
 
280
- function checkValidRanges<OutputT: number | string>(
310
+ function checkValidRanges<OutputT: InterpolationConfigSupportedOutputType>(
281
311
  inputRange: $ReadOnlyArray<number>,
282
312
  outputRange: $ReadOnlyArray<OutputT>,
283
313
  ) {
@@ -304,7 +334,7 @@ function checkValidInputRange(arr: $ReadOnlyArray<number>) {
304
334
  }
305
335
  }
306
336
 
307
- function checkInfiniteRange<OutputT: number | string>(
337
+ function checkInfiniteRange<OutputT: InterpolationConfigSupportedOutputType>(
308
338
  name: string,
309
339
  arr: $ReadOnlyArray<OutputT>,
310
340
  ) {
@@ -322,7 +352,7 @@ function checkInfiniteRange<OutputT: number | string>(
322
352
  }
323
353
 
324
354
  export default class AnimatedInterpolation<
325
- OutputT: number | string,
355
+ OutputT: InterpolationConfigSupportedOutputType,
326
356
  > extends AnimatedWithChildren {
327
357
  _parent: AnimatedNode;
328
358
  _config: InterpolationConfigType<OutputT>;
@@ -347,6 +377,10 @@ export default class AnimatedInterpolation<
347
377
  const config = this._config;
348
378
  if (config.outputRange && typeof config.outputRange[0] === 'string') {
349
379
  this._interpolation = (createStringInterpolation((config: any)): any);
380
+ } else if (typeof config.outputRange[0] === 'object') {
381
+ this._interpolation = (createPlatformColorInterpolation(
382
+ (config: any),
383
+ ): any);
350
384
  } else {
351
385
  this._interpolation = (createNumericInterpolation((config: any)): any);
352
386
  }
@@ -403,6 +437,8 @@ export default class AnimatedInterpolation<
403
437
  return NativeAnimatedHelper.transformDataType(value);
404
438
  }
405
439
  }): any);
440
+ } else if (typeof outputRange[0] === 'object') {
441
+ outputType = 'platform_color';
406
442
  }
407
443
 
408
444
  return {
@@ -13,7 +13,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
13
13
  import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
14
14
  import invariant from 'invariant';
15
15
 
16
- type ValueListenerCallback = (state: {value: number, ...}) => mixed;
16
+ type ValueListenerCallback = (state: {value: number, ...}) => unknown;
17
17
 
18
18
  export type AnimatedNodeConfig = $ReadOnly<{
19
19
  debugID?: string,
@@ -87,7 +87,7 @@ export default class AnimatedNode {
87
87
  *
88
88
  * See https://reactnative.dev/docs/animatedvalue#addlistener
89
89
  */
90
- addListener(callback: (value: any) => mixed): string {
90
+ addListener(callback: (value: any) => unknown): string {
91
91
  const id = String(_uniqueId++);
92
92
  this._listeners.set(id, callback);
93
93
  return id;
@@ -172,7 +172,7 @@ export default class AnimatedNode {
172
172
  * NOTE: This is intended to prevent `JSON.stringify` from throwing "cyclic
173
173
  * structure" errors in React DevTools. Avoid depending on this!
174
174
  */
175
- toJSON(): mixed {
175
+ toJSON(): unknown {
176
176
  return this.__getValue();
177
177
  }
178
178
 
@@ -20,21 +20,26 @@ import {isValidElement} from 'react';
20
20
  const MAX_DEPTH = 5;
21
21
 
22
22
  export function isPlainObject(
23
- value: mixed,
23
+ value: unknown,
24
24
  /* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype
25
25
  and ReactElement checks preserve the type refinement of `value`. */
26
- ): value is $ReadOnly<{[string]: mixed}> {
26
+ ): value is $ReadOnly<{[string]: unknown}> {
27
+ const proto =
28
+ value !== null && typeof value === 'object'
29
+ ? Object.getPrototypeOf(value)
30
+ : undefined;
31
+ if (proto === undefined) {
32
+ // $FlowFixMe[incompatible-type-guard]
33
+ return false;
34
+ }
27
35
  return (
28
36
  // $FlowFixMe[incompatible-type-guard]
29
- value !== null &&
30
- typeof value === 'object' &&
31
- Object.getPrototypeOf(value).isPrototypeOf(Object) &&
32
- !isValidElement(value)
37
+ (proto == null || proto.isPrototypeOf(Object)) && !isValidElement(value)
33
38
  );
34
39
  }
35
40
 
36
41
  function flatAnimatedNodes(
37
- value: mixed,
42
+ value: unknown,
38
43
  nodes: Array<AnimatedNode> = [],
39
44
  depth: number = 0,
40
45
  ): Array<AnimatedNode> {
@@ -83,13 +88,13 @@ function mapAnimatedNodes(value: any, fn: any => any, depth: number = 0): any {
83
88
 
84
89
  export default class AnimatedObject extends AnimatedWithChildren {
85
90
  _nodes: $ReadOnlyArray<AnimatedNode>;
86
- _value: mixed;
91
+ _value: unknown;
87
92
 
88
93
  /**
89
94
  * Creates an `AnimatedObject` if `value` contains `AnimatedNode` instances.
90
95
  * Otherwise, returns `null`.
91
96
  */
92
- static from(value: mixed): ?AnimatedObject {
97
+ static from(value: unknown): ?AnimatedObject {
93
98
  const nodes = flatAnimatedNodes(value);
94
99
  if (nodes.length === 0) {
95
100
  return null;
@@ -102,7 +107,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
102
107
  */
103
108
  constructor(
104
109
  nodes: $ReadOnlyArray<AnimatedNode>,
105
- value: mixed,
110
+ value: unknown,
106
111
  config?: ?AnimatedNodeConfig,
107
112
  ) {
108
113
  super(config);
@@ -116,7 +121,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
116
121
  });
117
122
  }
118
123
 
119
- __getValueWithStaticObject(staticObject: mixed): any {
124
+ __getValueWithStaticObject(staticObject: unknown): any {
120
125
  const nodes = this._nodes;
121
126
  let index = 0;
122
127
  // NOTE: We can depend on `this._value` and `staticObject` sharing a
@@ -8,12 +8,15 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {RootTag} from '../../Types/RootTagTypes';
11
12
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
12
13
  import type {AnimatedNodeConfig} from './AnimatedNode';
13
14
  import type {AnimatedStyleAllowlist} from './AnimatedStyle';
14
15
 
15
16
  import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
17
+ import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
16
18
  import {findNodeHandle} from '../../ReactNative/RendererProxy';
19
+ import {getNodeFromPublicInstance} from '../../ReactPrivate/ReactNativePrivateInterface';
17
20
  import flattenStyle from '../../StyleSheet/flattenStyle';
18
21
  import {AnimatedEvent} from '../AnimatedEvent';
19
22
  import AnimatedNode from './AnimatedNode';
@@ -33,12 +36,12 @@ type TargetView = {
33
36
  type TargetViewInstance = React.ElementRef<React.ElementType>;
34
37
 
35
38
  function createAnimatedProps(
36
- inputProps: {[string]: mixed},
39
+ inputProps: {[string]: unknown},
37
40
  allowlist: ?AnimatedPropsAllowlist,
38
- ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: mixed}] {
41
+ ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: unknown}] {
39
42
  const nodeKeys: Array<string> = [];
40
43
  const nodes: Array<AnimatedNode> = [];
41
- const props: {[string]: mixed} = {};
44
+ const props: {[string]: unknown} = {};
42
45
 
43
46
  const keys = Object.keys(inputProps);
44
47
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -95,13 +98,15 @@ export default class AnimatedProps extends AnimatedNode {
95
98
  _callback: () => void;
96
99
  _nodeKeys: $ReadOnlyArray<string>;
97
100
  _nodes: $ReadOnlyArray<AnimatedNode>;
98
- _props: {[string]: mixed};
101
+ _props: {[string]: unknown};
99
102
  _target: ?TargetView = null;
103
+ _rootTag: ?RootTag = undefined;
100
104
 
101
105
  constructor(
102
- inputProps: {[string]: mixed},
106
+ inputProps: {[string]: unknown},
103
107
  callback: () => void,
104
108
  allowlist?: ?AnimatedPropsAllowlist,
109
+ rootTag?: RootTag,
105
110
  config?: ?AnimatedNodeConfig,
106
111
  ) {
107
112
  super(config);
@@ -110,10 +115,11 @@ export default class AnimatedProps extends AnimatedNode {
110
115
  this._nodes = nodes;
111
116
  this._props = props;
112
117
  this._callback = callback;
118
+ this._rootTag = rootTag;
113
119
  }
114
120
 
115
121
  __getValue(): Object {
116
- const props: {[string]: mixed} = {};
122
+ const props: {[string]: unknown} = {};
117
123
 
118
124
  const keys = Object.keys(this._props);
119
125
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -138,7 +144,7 @@ export default class AnimatedProps extends AnimatedNode {
138
144
  * created by this `AnimatedProps` instance.
139
145
  */
140
146
  __getValueWithStaticProps(staticProps: Object): Object {
141
- const props: {[string]: mixed} = {...staticProps};
147
+ const props: {[string]: unknown} = {...staticProps};
142
148
 
143
149
  const keys = Object.keys(staticProps);
144
150
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -149,7 +155,7 @@ export default class AnimatedProps extends AnimatedNode {
149
155
  const staticStyle = staticProps.style;
150
156
  const flatStaticStyle = flattenStyle(staticStyle);
151
157
  if (maybeNode instanceof AnimatedStyle) {
152
- const mutableStyle: {[string]: mixed} =
158
+ const mutableStyle: {[string]: unknown} =
153
159
  flatStaticStyle == null
154
160
  ? {}
155
161
  : flatStaticStyle === staticStyle
@@ -190,7 +196,7 @@ export default class AnimatedProps extends AnimatedNode {
190
196
  }
191
197
 
192
198
  __getAnimatedValue(): Object {
193
- const props: {[string]: mixed} = {};
199
+ const props: {[string]: unknown} = {};
194
200
 
195
201
  const nodeKeys = this._nodeKeys;
196
202
  const nodes = this._nodes;
@@ -247,7 +253,9 @@ export default class AnimatedProps extends AnimatedNode {
247
253
  super.__setPlatformConfig(platformConfig);
248
254
 
249
255
  if (this._target != null) {
250
- this.#connectAnimatedView(this._target);
256
+ const target = this._target;
257
+ this.#connectAnimatedView(target);
258
+ this.#connectShadowNode(target);
251
259
  }
252
260
  }
253
261
  }
@@ -256,9 +264,10 @@ export default class AnimatedProps extends AnimatedNode {
256
264
  if (this._target?.instance === instance) {
257
265
  return;
258
266
  }
259
- this._target = {instance, connectedViewTag: null};
267
+ const target = (this._target = {instance, connectedViewTag: null});
260
268
  if (this.__isNative) {
261
- this.#connectAnimatedView(this._target);
269
+ this.#connectAnimatedView(target);
270
+ this.#connectShadowNode(target);
262
271
  }
263
272
  }
264
273
 
@@ -279,6 +288,27 @@ export default class AnimatedProps extends AnimatedNode {
279
288
  target.connectedViewTag = viewTag;
280
289
  }
281
290
 
291
+ #connectShadowNode(target: TargetView): void {
292
+ if (
293
+ !ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() ||
294
+ //eslint-disable-next-line
295
+ !ReactNativeFeatureFlags.useSharedAnimatedBackend()
296
+ ) {
297
+ return;
298
+ }
299
+
300
+ invariant(this.__isNative, 'Expected node to be marked as "native"');
301
+ // $FlowExpectedError[incompatible-type] - target.instance may be an HTMLElement but we need ReactNativeElement for Fabric
302
+ const shadowNode = getNodeFromPublicInstance(target.instance);
303
+ if (shadowNode == null) {
304
+ return;
305
+ }
306
+ NativeAnimatedHelper.API.connectAnimatedNodeToShadowNodeFamily(
307
+ this.__getNativeTag(),
308
+ shadowNode,
309
+ );
310
+ }
311
+
282
312
  #disconnectAnimatedView(target: TargetView): void {
283
313
  invariant(this.__isNative, 'Expected node to be marked as "native"');
284
314
  const viewTag = target.connectedViewTag;
@@ -318,6 +348,7 @@ export default class AnimatedProps extends AnimatedNode {
318
348
  return {
319
349
  type: 'props',
320
350
  props: propsConfig,
351
+ rootTag: this._rootTag ?? undefined,
321
352
  debugID: this.__getDebugID(),
322
353
  };
323
354
  }
@@ -21,17 +21,17 @@ import AnimatedWithChildren from './AnimatedWithChildren';
21
21
 
22
22
  export type AnimatedStyleAllowlist = $ReadOnly<{[string]: true}>;
23
23
 
24
- type FlatStyle = {[string]: mixed};
25
- type FlatStyleForWeb<TStyle: FlatStyle> = [mixed, TStyle];
24
+ type FlatStyle = {[string]: unknown};
25
+ type FlatStyleForWeb<TStyle: FlatStyle> = [unknown, TStyle];
26
26
 
27
27
  function createAnimatedStyle(
28
28
  flatStyle: FlatStyle,
29
29
  allowlist: ?AnimatedStyleAllowlist,
30
30
  keepUnanimatedValues: boolean,
31
- ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: mixed}] {
31
+ ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: unknown}] {
32
32
  const nodeKeys: Array<string> = [];
33
33
  const nodes: Array<AnimatedNode> = [];
34
- const style: {[string]: mixed} = {};
34
+ const style: {[string]: unknown} = {};
35
35
 
36
36
  const keys = Object.keys(flatStyle);
37
37
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -82,10 +82,10 @@ function createAnimatedStyle(
82
82
  }
83
83
 
84
84
  export default class AnimatedStyle extends AnimatedWithChildren {
85
- _originalStyleForWeb: ?mixed;
85
+ _originalStyleForWeb: ?unknown;
86
86
  _nodeKeys: $ReadOnlyArray<string>;
87
87
  _nodes: $ReadOnlyArray<AnimatedNode>;
88
- _style: {[string]: mixed};
88
+ _style: {[string]: unknown};
89
89
 
90
90
  /**
91
91
  * Creates an `AnimatedStyle` if `value` contains `AnimatedNode` instances.
@@ -94,7 +94,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
94
94
  static from(
95
95
  flatStyle: ?FlatStyle,
96
96
  allowlist: ?AnimatedStyleAllowlist,
97
- originalStyleForWeb: ?mixed,
97
+ originalStyleForWeb: ?unknown,
98
98
  ): ?AnimatedStyle {
99
99
  if (flatStyle == null) {
100
100
  return null;
@@ -115,8 +115,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
115
115
  constructor(
116
116
  nodeKeys: $ReadOnlyArray<string>,
117
117
  nodes: $ReadOnlyArray<AnimatedNode>,
118
- style: {[string]: mixed},
119
- originalStyleForWeb: ?mixed,
118
+ style: {[string]: unknown},
119
+ originalStyleForWeb: ?unknown,
120
120
  config?: ?AnimatedNodeConfig,
121
121
  ) {
122
122
  super(config);
@@ -134,7 +134,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
134
134
  }
135
135
 
136
136
  __getValue(): FlatStyleForWeb<FlatStyle> | FlatStyle {
137
- const style: {[string]: mixed} = {};
137
+ const style: {[string]: unknown} = {};
138
138
 
139
139
  const keys = Object.keys(this._style);
140
140
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -164,7 +164,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
164
164
  * Mutates the supplied `style` object such that animated nodes are replaced
165
165
  * with rasterized values.
166
166
  */
167
- __replaceAnimatedNodeWithValues(style: {[string]: mixed}): void {
167
+ __replaceAnimatedNodeWithValues(style: {[string]: unknown}): void {
168
168
  const keys = Object.keys(style);
169
169
  for (let ii = 0, length = keys.length; ii < length; ii++) {
170
170
  const key = keys[ii];
@@ -185,7 +185,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
185
185
  }
186
186
 
187
187
  __getAnimatedValue(): Object {
188
- const style: {[string]: mixed} = {};
188
+ const style: {[string]: unknown} = {};
189
189
 
190
190
  const nodeKeys = this._nodeKeys;
191
191
  const nodes = this._nodes;
@@ -12,7 +12,10 @@ import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
12
12
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
13
13
  import type Animation from '../animations/Animation';
14
14
  import type {EndCallback} from '../animations/Animation';
15
- import type {InterpolationConfigType} from './AnimatedInterpolation';
15
+ import type {
16
+ InterpolationConfigSupportedOutputType,
17
+ InterpolationConfigType,
18
+ } from './AnimatedInterpolation';
16
19
  import type AnimatedNode from './AnimatedNode';
17
20
  import type {AnimatedNodeConfig} from './AnimatedNode';
18
21
  import type AnimatedTracking from './AnimatedTracking';
@@ -131,7 +134,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
131
134
  }
132
135
  }
133
136
 
134
- addListener(callback: (value: any) => mixed): string {
137
+ addListener(callback: (value: any) => unknown): string {
135
138
  const id = super.addListener(callback);
136
139
  this._listenerCount++;
137
140
  if (this.__isNative) {
@@ -298,7 +301,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
298
301
  * Interpolates the value before updating the property, e.g. mapping 0-1 to
299
302
  * 0-10.
300
303
  */
301
- interpolate<OutputT: number | string>(
304
+ interpolate<OutputT: InterpolationConfigSupportedOutputType>(
302
305
  config: InterpolationConfigType<OutputT>,
303
306
  ): AnimatedInterpolation<OutputT> {
304
307
  return new AnimatedInterpolation(this, config);
@@ -21,7 +21,7 @@ export type AnimatedValueXYConfig = $ReadOnly<{
21
21
  ...AnimatedNodeConfig,
22
22
  useNativeDriver: boolean,
23
23
  }>;
24
- type ValueXYListenerCallback = (value: {x: number, y: number, ...}) => mixed;
24
+ type ValueXYListenerCallback = (value: {x: number, y: number, ...}) => unknown;
25
25
 
26
26
  let _uniqueId = 1;
27
27