@office-iss/react-native-win32 0.79.0 → 0.80.0-preview.1

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 (294) hide show
  1. package/.flowconfig +10 -3
  2. package/CHANGELOG.json +112 -19
  3. package/CHANGELOG.md +46 -11
  4. package/IntegrationTests/ImageCachePolicyTest.js +1 -1
  5. package/IntegrationTests/LayoutEventsTest.js +1 -4
  6. package/Libraries/Alert/Alert.d.ts +4 -1
  7. package/Libraries/Alert/Alert.js +3 -0
  8. package/Libraries/Alert/RCTAlertManager.js +17 -0
  9. package/Libraries/Animated/Animated.js.flow +1 -3
  10. package/Libraries/Animated/AnimatedEvent.js +4 -3
  11. package/Libraries/Animated/AnimatedExports.js +2 -2
  12. package/Libraries/Animated/AnimatedExports.js.flow +140 -0
  13. package/Libraries/Animated/AnimatedImplementation.js +2 -123
  14. package/Libraries/Animated/Easing.js +13 -15
  15. package/Libraries/Animated/animations/Animation.js +8 -4
  16. package/Libraries/Animated/components/AnimatedFlatList.js +7 -6
  17. package/Libraries/Animated/components/AnimatedScrollView.js +48 -42
  18. package/Libraries/Animated/components/AnimatedSectionList.js +11 -7
  19. package/Libraries/Animated/createAnimatedComponent.js +105 -57
  20. package/Libraries/Animated/nodes/AnimatedNode.js +4 -3
  21. package/Libraries/Animated/nodes/AnimatedProps.js +46 -26
  22. package/Libraries/Animated/nodes/AnimatedValue.js +16 -7
  23. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  24. package/Libraries/AppState/AppState.js +7 -2
  25. package/Libraries/BatchedBridge/MessageQueue.js +2 -2
  26. package/Libraries/BatchedBridge/NativeModules.js +2 -0
  27. package/Libraries/Blob/BlobManager.js +1 -0
  28. package/Libraries/Blob/FileReader.js +219 -8
  29. package/Libraries/Blob/URL.js +37 -12
  30. package/Libraries/Blob/URLSearchParams.js +106 -31
  31. package/Libraries/Blob/URLSearchParams.js.flow +12 -7
  32. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  34. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
  35. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -0
  36. package/Libraries/Components/Button.js +1 -1
  37. package/Libraries/Components/Button.win32.js +1 -1
  38. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
  39. package/Libraries/{NewAppScreen/components/Colors.js → Components/DrawerAndroid/DrawerLayoutAndroid.ios.js} +6 -10
  40. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
  41. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
  42. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
  43. package/Libraries/Components/Keyboard/Keyboard.js +5 -3
  44. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
  45. package/Libraries/Components/Pressable/Pressable.js +20 -4
  46. package/Libraries/Components/Pressable/Pressable.win32.js +20 -4
  47. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +25 -3
  48. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
  49. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
  50. package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
  51. package/Libraries/Components/ScrollView/ScrollView.js +132 -122
  52. package/Libraries/Components/StaticRenderer.js +1 -1
  53. package/Libraries/Components/Switch/Switch.d.ts +3 -0
  54. package/Libraries/Components/Switch/Switch.js +8 -4
  55. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -1
  56. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -4
  57. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
  58. package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
  59. package/Libraries/Components/TextInput/TextInput.d.ts +70 -33
  60. package/Libraries/Components/TextInput/TextInput.flow.js +100 -51
  61. package/Libraries/Components/TextInput/TextInput.flow.win32.js +1208 -0
  62. package/Libraries/Components/TextInput/TextInput.js +88 -1027
  63. package/Libraries/Components/TextInput/TextInput.win32.js +89 -1059
  64. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  65. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  66. package/Libraries/{Modal/ModalInjection.js → Components/ToastAndroid/ToastAndroid.ios.js} +3 -5
  67. package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
  68. package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
  69. package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +4 -32
  70. package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
  71. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
  72. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  73. package/Libraries/Components/Touchable/Touchable.js +5 -5
  74. package/Libraries/Components/Touchable/Touchable.win32.js +5 -5
  75. package/Libraries/Components/Touchable/TouchableBounce.js +14 -7
  76. package/Libraries/Components/Touchable/TouchableHighlight.js +10 -7
  77. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -6
  78. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +6 -6
  79. package/Libraries/Components/Touchable/TouchableOpacity.js +13 -6
  80. package/Libraries/Components/View/View.js +18 -21
  81. package/Libraries/Components/View/View.win32.js +21 -24
  82. package/Libraries/Components/View/ViewAccessibility.js +25 -1
  83. package/Libraries/Components/View/ViewAccessibility.win32.js +9 -1
  84. package/Libraries/Components/View/ViewPropTypes.js +49 -3
  85. package/Libraries/Components/View/ViewPropTypes.win32.js +49 -3
  86. package/Libraries/Core/ReactNativeVersion.js +1 -1
  87. package/Libraries/Core/setUpReactDevTools.js +5 -5
  88. package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
  89. package/Libraries/EventEmitter/NativeEventEmitter.js +9 -4
  90. package/Libraries/Image/AssetSourceResolver.js +17 -4
  91. package/Libraries/Image/Image.d.ts +26 -10
  92. package/Libraries/Image/Image.js +17 -0
  93. package/Libraries/Image/Image.js.flow +5 -5
  94. package/Libraries/Image/ImageBackground.js +2 -0
  95. package/Libraries/Image/ImageInjection.js +1 -1
  96. package/Libraries/Image/ImageProps.js +22 -17
  97. package/Libraries/Image/ImageSource.js +3 -1
  98. package/Libraries/Image/ImageSourceUtils.js +4 -2
  99. package/Libraries/Image/ImageTypes.flow.js +1 -1
  100. package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
  101. package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
  102. package/Libraries/Interaction/InteractionManager.d.ts +13 -0
  103. package/Libraries/Interaction/InteractionManager.js +1 -1
  104. package/Libraries/Interaction/PanResponder.js +3 -3
  105. package/Libraries/Interaction/TaskQueue.js +1 -0
  106. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  107. package/Libraries/Linking/Linking.js +1 -1
  108. package/Libraries/Lists/FlatList.d.ts +2 -2
  109. package/Libraries/Lists/FlatList.js +8 -11
  110. package/Libraries/Lists/SectionList.js +39 -42
  111. package/Libraries/Lists/SectionListModern.js +25 -34
  112. package/Libraries/Lists/VirtualizedList.js +1 -0
  113. package/Libraries/Lists/VirtualizedSectionList.js +1 -0
  114. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  115. package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
  116. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +140 -0
  117. package/Libraries/Modal/Modal.js +33 -7
  118. package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
  119. package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
  120. package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
  121. package/Libraries/NativeComponent/BaseViewConfig.win32.js +1 -0
  122. package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
  123. package/Libraries/NativeModules/specs/NativeDevMenu.js +2 -2
  124. package/Libraries/Network/RCTNetworking.android.js +1 -1
  125. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  126. package/Libraries/Network/RCTNetworking.js +17 -0
  127. package/Libraries/Network/RCTNetworking.js.flow +1 -1
  128. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  129. package/Libraries/Network/XMLHttpRequest.js +781 -10
  130. package/Libraries/Performance/Systrace.js +7 -7
  131. package/Libraries/Pressability/Pressability.js +1 -1
  132. package/Libraries/Pressability/Pressability.win32.js +1 -1
  133. package/Libraries/ReactNative/AppContainer-dev.js +5 -4
  134. package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
  135. package/Libraries/ReactNative/AppRegistry.js +2 -322
  136. package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
  137. package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
  138. package/Libraries/ReactNative/FabricUIManager.js +10 -0
  139. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
  140. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
  141. package/Libraries/ReactNative/RendererImplementation.js +10 -5
  142. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -0
  143. package/Libraries/ReactNative/renderApplication.js +9 -0
  144. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +3 -3
  145. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +51 -0
  146. package/Libraries/Renderer/implementations/ReactFabric-dev.js +4840 -4748
  147. package/Libraries/Renderer/implementations/ReactFabric-prod.js +4947 -4829
  148. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3998 -3888
  149. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5005 -4948
  150. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2744 -2652
  151. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5020 -4933
  152. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
  153. package/Libraries/Settings/Settings.ios.js +1 -0
  154. package/Libraries/Settings/Settings.js +13 -19
  155. package/Libraries/Settings/Settings.win32.js +19 -20
  156. package/Libraries/Settings/SettingsFallback.js +33 -0
  157. package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
  158. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
  159. package/Libraries/StyleSheet/Rect.js +1 -0
  160. package/Libraries/StyleSheet/StyleSheet.js +31 -200
  161. package/Libraries/StyleSheet/StyleSheet.js.flow +188 -0
  162. package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
  163. package/Libraries/StyleSheet/StyleSheetExports.js.flow +112 -0
  164. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
  165. package/Libraries/StyleSheet/StyleSheetTypes.js +130 -52
  166. package/Libraries/StyleSheet/flattenStyle.js +14 -4
  167. package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
  168. package/Libraries/StyleSheet/processBackgroundImage.js +670 -214
  169. package/Libraries/Text/Text.d.ts +2 -5
  170. package/Libraries/Text/Text.js +3 -3
  171. package/Libraries/Text/Text.win32.js +3 -3
  172. package/Libraries/Text/TextNativeComponent.js +0 -4
  173. package/Libraries/Text/TextNativeComponent.win32.js +0 -4
  174. package/Libraries/Text/TextProps.js +5 -33
  175. package/Libraries/Text/TextProps.win32.js +5 -30
  176. package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
  177. package/Libraries/{Blob/__mocks__/BlobModule.js → Types/CodegenTypesNamespace.js} +4 -6
  178. package/Libraries/Types/CoreEventTypes.d.ts +6 -1
  179. package/Libraries/Types/CoreEventTypes.js +1 -1
  180. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  181. package/Libraries/Utilities/Appearance.js +2 -0
  182. package/Libraries/Utilities/BackHandler.js +17 -0
  183. package/Libraries/Utilities/DeviceInfo.js +2 -0
  184. package/Libraries/Utilities/Dimensions.js +1 -1
  185. package/Libraries/Utilities/Dimensions.win32.js +1 -1
  186. package/Libraries/Utilities/Platform.js +17 -0
  187. package/Libraries/Utilities/PlatformTypes.js +11 -3
  188. package/Libraries/Utilities/ReactNativeTestTools.js +2 -2
  189. package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
  190. package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
  191. package/Libraries/WebSocket/WebSocket.js +313 -8
  192. package/Libraries/vendor/core/ErrorUtils.js +28 -2
  193. package/Libraries/vendor/emitter/EventEmitter.js +6 -2
  194. package/flow/global.js +1 -0
  195. package/index.js +51 -331
  196. package/index.win32.js +71 -352
  197. package/interface.js +0 -4
  198. package/jest/resolver.js +31 -0
  199. package/overrides.json +45 -47
  200. package/package.json +26 -26
  201. package/src/private/animated/NativeAnimatedHelper.js +21 -8
  202. package/src/private/animated/NativeAnimatedHelper.win32.js +21 -8
  203. package/src/private/animated/createAnimatedPropsHook.js +11 -16
  204. package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
  205. package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
  206. package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
  207. package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
  208. package/src/private/{devmenu → devsupport/devmenu}/DevMenu.js +1 -1
  209. package/src/private/{inspector → devsupport/devmenu/elementinspector}/BorderBox.js +3 -3
  210. package/src/private/{inspector → devsupport/devmenu/elementinspector}/BoxInspector.js +6 -5
  211. package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementBox.js +8 -6
  212. package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementProperties.js +11 -10
  213. package/src/private/{inspector → devsupport/devmenu/elementinspector}/Inspector.js +14 -12
  214. package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorOverlay.js +5 -4
  215. package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorPanel.js +9 -8
  216. package/src/private/{inspector → devsupport/devmenu/elementinspector}/NetworkOverlay.js +10 -9
  217. package/src/private/{inspector → devsupport/devmenu/elementinspector}/ReactDevToolsOverlay.js +7 -7
  218. package/src/private/{inspector → devsupport/devmenu/elementinspector}/StyleInspector.js +7 -6
  219. package/src/private/{inspector → devsupport/devmenu/elementinspector}/XHRInterceptor.js +2 -2
  220. package/src/private/{inspector → devsupport/devmenu/elementinspector}/getInspectorDataForViewAtPoint.js +4 -4
  221. package/src/private/{inspector → devsupport/devmenu/elementinspector}/resolveBoxStyle.js +1 -1
  222. package/src/private/{inspector → devsupport/devmenu/perfmonitor}/PerformanceOverlay.js +6 -5
  223. package/src/private/{specs_DEPRECATED/modules → devsupport/devmenu/specs}/NativeDevMenu.js +2 -2
  224. package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.android.js +1 -1
  225. package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.ios.js +1 -1
  226. package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.win32.js +1 -1
  227. package/src/private/{debugging → devsupport/rndevtools}/setUpFuseboxReactDevToolsDispatcher.js +1 -1
  228. package/src/private/{fusebox → devsupport/rndevtools}/specs/NativeReactDevToolsRuntimeSettingsModule.js +2 -2
  229. package/src/private/{specs_DEPRECATED/modules → devsupport/rndevtools/specs}/NativeReactDevToolsSettingsManager.js +2 -2
  230. package/src/private/featureflags/ReactNativeFeatureFlags.js +82 -80
  231. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
  232. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -13
  233. package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
  234. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +1 -1
  235. package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +1 -1
  236. package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +3 -0
  237. package/src/private/styles/composeStyles.js +12 -5
  238. package/src/private/types/HostComponent.js +1 -1
  239. package/src/private/types/HostInstance.js +67 -1
  240. package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
  241. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
  242. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
  243. package/src/private/webapis/performance/Performance.js +1 -3
  244. package/src/private/webapis/performance/PerformanceEntry.js +6 -1
  245. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -0
  246. package/src/private/webapis/performance/specs/NativePerformance.js +10 -1
  247. package/src/types/globals.d.ts +42 -0
  248. package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
  249. package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
  250. package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
  251. package/src-win/Libraries/Text/Text.d.ts +2 -5
  252. package/types/index.d.ts +6 -3
  253. package/types/public/ReactNativeTypes.d.ts +2 -2
  254. package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +0 -38
  255. package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +0 -22
  256. package/Libraries/Blob/FileReader_new.js +0 -231
  257. package/Libraries/Blob/FileReader_old.js +0 -186
  258. package/Libraries/Blob/__mocks__/FileReaderModule.js +0 -20
  259. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +0 -32
  260. package/Libraries/Core/__mocks__/ErrorUtils.js +0 -33
  261. package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -19
  262. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +0 -49
  263. package/Libraries/Events/CustomEvent.js +0 -32
  264. package/Libraries/Events/EventPolyfill.js +0 -239
  265. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +0 -118
  266. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +0 -134
  267. package/Libraries/Network/XMLHttpRequest_new.js +0 -794
  268. package/Libraries/Network/XMLHttpRequest_old.js +0 -701
  269. package/Libraries/NewAppScreen/components/DebugInstructions.js +0 -41
  270. package/Libraries/NewAppScreen/components/Header.js +0 -77
  271. package/Libraries/NewAppScreen/components/HermesBadge.js +0 -53
  272. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +0 -148
  273. package/Libraries/NewAppScreen/components/ReloadInstructions.js +0 -39
  274. package/Libraries/NewAppScreen/components/logo.png +0 -0
  275. package/Libraries/NewAppScreen/index.js +0 -25
  276. package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +0 -58
  277. package/Libraries/Utilities/DeviceInfo.win32.js +0 -19
  278. package/Libraries/Utilities/__mocks__/BackHandler.js +0 -45
  279. package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +0 -16
  280. package/Libraries/Utilities/__mocks__/PixelRatio.js +0 -25
  281. package/Libraries/WebSocket/WebSocketEvent.js +0 -30
  282. package/Libraries/WebSocket/WebSocket_new.js +0 -325
  283. package/Libraries/WebSocket/WebSocket_old.js +0 -297
  284. package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
  285. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +0 -30
  286. package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +0 -81
  287. package/flow/jest.js +0 -1287
  288. package/jest/__tests__/setup-test.js +0 -18
  289. package/src/private/components/VScrollViewNativeComponents.js +0 -25
  290. package/src/private/utilities/ensureInstance.js +0 -21
  291. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +0 -267
  292. package/types/modules/LaunchScreen.d.ts +0 -18
  293. /package/src/private/{devmenu → devsupport/devmenu}/DevMenu.d.ts +0 -0
  294. /package/src/private/{debugging → devsupport/rndevtools}/FuseboxSessionObserver.js +0 -0
@@ -10,18 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {
14
- ____ColorValue_Internal,
15
- ____DangerouslyImpreciseStyle_Internal,
16
- ____DangerouslyImpreciseStyleProp_Internal,
17
- ____ImageStyle_Internal,
18
- ____ImageStyleProp_Internal,
19
- ____Styles_Internal,
20
- ____TextStyle_Internal,
21
- ____TextStyleProp_Internal,
22
- ____ViewStyle_Internal,
23
- ____ViewStyleProp_Internal,
24
- } from './StyleSheetTypes';
13
+ import type {____Styles_Internal} from './StyleSheetTypes';
25
14
 
26
15
  import composeStyles from '../../src/private/styles/composeStyles';
27
16
  import flatten from './flattenStyle';
@@ -29,146 +18,8 @@ import flatten from './flattenStyle';
29
18
  const ReactNativeStyleAttributes =
30
19
  require('../Components/View/ReactNativeStyleAttributes').default;
31
20
  const PixelRatio = require('../Utilities/PixelRatio').default;
32
- const Platform = require('../Utilities/Platform').default; // [Win32]
33
21
 
34
- export type {NativeColorValue} from './StyleSheetTypes';
35
-
36
- /**
37
- * This type should be used as the type for anything that is a color. It is
38
- * most useful when using DynamicColorIOS which can be a string or a dynamic
39
- * color object.
40
- *
41
- * type props = {backgroundColor: ColorValue};
42
- */
43
- export type ColorValue = ____ColorValue_Internal;
44
-
45
- /**
46
- * This type should be used as the type for a prop that is passed through
47
- * to a <View>'s `style` prop. This ensures call sites of the component
48
- * can't pass styles that View doesn't support such as `fontSize`.`
49
- *
50
- * type Props = {style: ViewStyleProp}
51
- * const MyComponent = (props: Props) => <View style={props.style} />
52
- */
53
- export type ViewStyleProp = ____ViewStyleProp_Internal;
54
-
55
- /**
56
- * This type should be used as the type for a prop that is passed through
57
- * to a <Text>'s `style` prop. This ensures call sites of the component
58
- * can't pass styles that Text doesn't support such as `resizeMode`.`
59
- *
60
- * type Props = {style: TextStyleProp}
61
- * const MyComponent = (props: Props) => <Text style={props.style} />
62
- */
63
- export type TextStyleProp = ____TextStyleProp_Internal;
64
-
65
- /**
66
- * This type should be used as the type for a prop that is passed through
67
- * to an <Image>'s `style` prop. This ensures call sites of the component
68
- * can't pass styles that Image doesn't support such as `fontSize`.`
69
- *
70
- * type Props = {style: ImageStyleProp}
71
- * const MyComponent = (props: Props) => <Image style={props.style} />
72
- */
73
- export type ImageStyleProp = ____ImageStyleProp_Internal;
74
-
75
- /**
76
- * WARNING: You probably shouldn't be using this type. This type
77
- * is similar to the ones above except it allows styles that are accepted
78
- * by all of View, Text, or Image. It is therefore very unsafe to pass this
79
- * through to an underlying component. Using this is almost always a mistake
80
- * and using one of the other more restrictive types is likely the right choice.
81
- */
82
- export type DangerouslyImpreciseStyleProp =
83
- ____DangerouslyImpreciseStyleProp_Internal;
84
-
85
- /**
86
- * Utility type for getting the values for specific style keys.
87
- *
88
- * The following is bad because position is more restrictive than 'string':
89
- * ```
90
- * type Props = {position: string};
91
- * ```
92
- *
93
- * You should use the following instead:
94
- *
95
- * ```
96
- * type Props = {position: TypeForStyleKey<'position'>};
97
- * ```
98
- *
99
- * This will correctly give you the type 'absolute' | 'relative'
100
- */
101
- export type TypeForStyleKey<
102
- +key: $Keys<____DangerouslyImpreciseStyle_Internal>,
103
- > = $ElementType<____DangerouslyImpreciseStyle_Internal, key>;
104
-
105
- /**
106
- * This type is an object of the different possible style
107
- * properties that can be specified for View.
108
- *
109
- * Note that this isn't a safe way to type a style prop for a component as
110
- * results from StyleSheet.create return an internal identifier, not
111
- * an object of styles.
112
- *
113
- * If you want to type the style prop of a function,
114
- * consider using ViewStyleProp.
115
- *
116
- * A reasonable usage of this type is for helper functions that return an
117
- * object of styles to pass to a View that can't be precomputed with
118
- * StyleSheet.create.
119
- */
120
- export type ViewStyle = ____ViewStyle_Internal;
121
-
122
- /**
123
- * This type is an object of the different possible style
124
- * properties that can be specified for Text.
125
- *
126
- * Note that this isn't a safe way to type a style prop for a component as
127
- * results from StyleSheet.create return an internal identifier, not
128
- * an object of styles.
129
- *
130
- * If you want to type the style prop of a function,
131
- * consider using TextStyleProp.
132
- *
133
- * A reasonable usage of this type is for helper functions that return an
134
- * object of styles to pass to a Text that can't be precomputed with
135
- * StyleSheet.create.
136
- */
137
- export type TextStyle = ____TextStyle_Internal;
138
-
139
- /**
140
- * This type is an object of the different possible style
141
- * properties that can be specified for Image.
142
- *
143
- * Note that this isn't a safe way to type a style prop for a component as
144
- * results from StyleSheet.create return an internal identifier, not
145
- * an object of styles.
146
- *
147
- * If you want to type the style prop of a function,
148
- * consider using ImageStyleProp.
149
- *
150
- * A reasonable usage of this type is for helper functions that return an
151
- * object of styles to pass to an Image that can't be precomputed with
152
- * StyleSheet.create.
153
- */
154
- export type ImageStyle = ____ImageStyle_Internal;
155
-
156
- /**
157
- * WARNING: You probably shouldn't be using this type. This type is an object
158
- * with all possible style keys and their values. Note that this isn't
159
- * a safe way to type a style prop for a component as results from
160
- * StyleSheet.create return an internal identifier, not an object of styles.
161
- *
162
- * If you want to type the style prop of a function, consider using
163
- * ViewStyleProp, TextStyleProp, or ImageStyleProp.
164
- *
165
- * This should only be used by very core utilities that operate on an object
166
- * containing any possible style value.
167
- */
168
- export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal;
169
-
170
- let hairlineWidth: number =
171
- Platform.OS === 'win32' ? 0.5 : PixelRatio.roundToNearestPixel(0.4); // TODO(windows ISS) - Avoid calls to PixelRatio - needs multi window support
22
+ let hairlineWidth: number = PixelRatio.roundToNearestPixel(0.4);
172
23
  if (hairlineWidth === 0) {
173
24
  hairlineWidth = 1 / PixelRatio.get();
174
25
  }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ * @format
9
+ */
10
+
11
+ import type {____Styles_Internal} from './StyleSheetTypes';
12
+
13
+ import composeStyles from '../../src/private/styles/composeStyles';
14
+ import flattenStyle from './flattenStyle';
15
+
16
+ /**
17
+ * This is defined as the width of a thin line on the platform. It can be
18
+ * used as the thickness of a border or division between two elements.
19
+ * Example:
20
+ * ```
21
+ * {
22
+ * borderBottomColor: '#bbb',
23
+ * borderBottomWidth: StyleSheet.hairlineWidth
24
+ * }
25
+ * ```
26
+ *
27
+ * This constant will always be a round number of pixels (so a line defined
28
+ * by it look crisp) and will try to match the standard width of a thin line
29
+ * on the underlying platform. However, you should not rely on it being a
30
+ * constant size, because on different platforms and screen densities its
31
+ * value may be calculated differently.
32
+ */
33
+ declare export const hairlineWidth: number;
34
+
35
+ /**
36
+ * A very common pattern is to create overlays with position absolute and zero positioning,
37
+ * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
38
+ * styles.
39
+ */
40
+ declare export const absoluteFill: any;
41
+
42
+ /**
43
+ * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
44
+ * used to create a customized entry in a `StyleSheet`, e.g.:
45
+ *
46
+ * const styles = StyleSheet.create({
47
+ * wrapper: {
48
+ * ...StyleSheet.absoluteFillObject,
49
+ * top: 10,
50
+ * backgroundColor: 'transparent',
51
+ * },
52
+ * });
53
+ */
54
+ declare export const absoluteFillObject: {
55
+ +bottom: 0,
56
+ +left: 0,
57
+ +position: 'absolute',
58
+ +right: 0,
59
+ +top: 0,
60
+ };
61
+
62
+ /**
63
+ * Combines two styles such that style2 will override any styles in style1.
64
+ * If either style is falsy, the other one is returned without allocating
65
+ * an array, saving allocations and maintaining reference equality for
66
+ * PureComponent checks.
67
+ */
68
+ declare export const compose: typeof composeStyles;
69
+
70
+ /**
71
+ * Flattens an array of style objects, into one aggregated style object.
72
+ *
73
+ * Example:
74
+ * ```
75
+ * const styles = StyleSheet.create({
76
+ * listItem: {
77
+ * flex: 1,
78
+ * fontSize: 16,
79
+ * color: 'white'
80
+ * },
81
+ * selectedListItem: {
82
+ * color: 'green'
83
+ * }
84
+ * });
85
+ *
86
+ * StyleSheet.flatten([styles.listItem, styles.selectedListItem])
87
+ * // returns { flex: 1, fontSize: 16, color: 'green' }
88
+ * ```
89
+ */
90
+ declare export const flatten: typeof flattenStyle;
91
+
92
+ /**
93
+ * WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will
94
+ * not be reliably announced. The whole thing might be deleted, who knows? Use
95
+ * at your own risk.
96
+ *
97
+ * Sets a function to use to pre-process a style property value. This is used
98
+ * internally to process color and transform values. You should not use this
99
+ * unless you really know what you are doing and have exhausted other options.
100
+ */
101
+ declare export const setStyleAttributePreprocessor: (
102
+ property: string,
103
+ process: (nextProp: any) => any,
104
+ ) => void;
105
+
106
+ /**
107
+ * An identity function for creating style sheets.
108
+ */
109
+ // $FlowFixMe[unsupported-variance-annotation]
110
+ declare export const create: <+S: ____Styles_Internal>(
111
+ obj: S & ____Styles_Internal,
112
+ ) => $ReadOnly<S>;
@@ -368,7 +368,7 @@ export type BlendMode =
368
368
  | 'luminosity';
369
369
 
370
370
  export type GradientValue = {
371
- type: 'linearGradient';
371
+ type: 'linear-gradient';
372
372
  // Angle or direction enums
373
373
  direction?: string | undefined;
374
374
  colorStops: ReadonlyArray<{
@@ -10,6 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import type {WithAnimatedValue} from '../Animated/createAnimatedComponent';
13
14
  import type AnimatedNode from '../Animated/nodes/AnimatedNode';
14
15
  import type {ImageResizeMode} from './../Image/ImageResizeMode';
15
16
  import type {
@@ -20,6 +21,9 @@ import type {
20
21
  ____ViewStyle_InternalOverrides,
21
22
  } from './private/_StyleSheetTypesOverrides';
22
23
  import type {____TransformStyle_Internal} from './private/_TransformStyle';
24
+ import type {ColorValue} from './StyleSheet';
25
+
26
+ export type {____TransformStyle_Internal};
23
27
 
24
28
  declare export opaque type NativeColorValue;
25
29
  export type ____ColorValue_Internal = null | string | number | NativeColorValue;
@@ -35,8 +39,7 @@ export type EdgeInsetsValue = {
35
39
  bottom: number,
36
40
  };
37
41
 
38
- export type DimensionValue = number | string | 'auto' | AnimatedNode | null;
39
- export type AnimatableNumericValue = number | AnimatedNode;
42
+ export type DimensionValue = number | string | 'auto' | null;
40
43
 
41
44
  export type CursorValue = 'auto' | 'pointer';
42
45
 
@@ -691,7 +694,7 @@ export type ____ShadowStyle_InternalCore = $ReadOnly<{
691
694
  * Sets the drop shadow opacity (multiplied by the color's alpha component)
692
695
  * @platform ios
693
696
  */
694
- shadowOpacity?: AnimatableNumericValue,
697
+ shadowOpacity?: number,
695
698
  /**
696
699
  * Sets the drop shadow blur radius
697
700
  * @platform ios
@@ -723,8 +726,8 @@ export type DropShadowValue = {
723
726
  color?: ____ColorValue_Internal,
724
727
  };
725
728
 
726
- export type GradientValue = {
727
- type: 'linearGradient',
729
+ type LinearGradientValue = {
730
+ type: 'linear-gradient',
728
731
  // Angle or direction enums
729
732
  direction?: string,
730
733
  colorStops: $ReadOnlyArray<{
@@ -733,6 +736,50 @@ export type GradientValue = {
733
736
  }>,
734
737
  };
735
738
 
739
+ type RadialExtent =
740
+ | 'closest-corner'
741
+ | 'closest-side'
742
+ | 'farthest-corner'
743
+ | 'farthest-side';
744
+ export type RadialGradientPosition =
745
+ | {
746
+ top: number | string,
747
+ left: number | string,
748
+ }
749
+ | {
750
+ top: number | string,
751
+ right: number | string,
752
+ }
753
+ | {
754
+ bottom: number | string,
755
+ left: number | string,
756
+ }
757
+ | {
758
+ bottom: number | string,
759
+ right: number | string,
760
+ };
761
+
762
+ export type RadialGradientShape = 'circle' | 'ellipse';
763
+ export type RadialGradientSize =
764
+ | RadialExtent
765
+ | {
766
+ x: string | number,
767
+ y: string | number,
768
+ };
769
+
770
+ type RadialGradientValue = {
771
+ type: 'radial-gradient',
772
+ shape: RadialGradientShape,
773
+ size: RadialGradientSize,
774
+ position: RadialGradientPosition,
775
+ colorStops: $ReadOnlyArray<{
776
+ color: ____ColorValue_Internal,
777
+ positions?: $ReadOnlyArray<string>,
778
+ }>,
779
+ };
780
+
781
+ export type BackgroundImageValue = LinearGradientValue | RadialGradientValue;
782
+
736
783
  export type BoxShadowValue = {
737
784
  offsetX: number | string,
738
785
  offsetY: number | string,
@@ -760,10 +807,7 @@ type ____BlendMode_Internal =
760
807
  | 'color'
761
808
  | 'luminosity';
762
809
 
763
- export type ____ViewStyle_InternalCore = $ReadOnly<{
764
- ...$Exact<____LayoutStyle_Internal>,
765
- ...$Exact<____ShadowStyle_Internal>,
766
- ...$Exact<____TransformStyle_Internal>,
810
+ export type ____ViewStyle_InternalBase = $ReadOnly<{
767
811
  backfaceVisibility?: 'visible' | 'hidden',
768
812
  backgroundColor?: ____ColorValue_Internal,
769
813
  borderColor?: ____ColorValue_Internal,
@@ -777,42 +821,49 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
777
821
  borderBlockColor?: ____ColorValue_Internal,
778
822
  borderBlockEndColor?: ____ColorValue_Internal,
779
823
  borderBlockStartColor?: ____ColorValue_Internal,
780
- borderRadius?: AnimatableNumericValue | string,
781
- borderBottomEndRadius?: AnimatableNumericValue | string,
782
- borderBottomLeftRadius?: AnimatableNumericValue | string,
783
- borderBottomRightRadius?: AnimatableNumericValue | string,
784
- borderBottomStartRadius?: AnimatableNumericValue | string,
785
- borderEndEndRadius?: AnimatableNumericValue | string,
786
- borderEndStartRadius?: AnimatableNumericValue | string,
787
- borderStartEndRadius?: AnimatableNumericValue | string,
788
- borderStartStartRadius?: AnimatableNumericValue | string,
789
- borderTopEndRadius?: AnimatableNumericValue | string,
790
- borderTopLeftRadius?: AnimatableNumericValue | string,
791
- borderTopRightRadius?: AnimatableNumericValue | string,
792
- borderTopStartRadius?: AnimatableNumericValue | string,
824
+ borderRadius?: number | string,
825
+ borderBottomEndRadius?: number | string,
826
+ borderBottomLeftRadius?: number | string,
827
+ borderBottomRightRadius?: number | string,
828
+ borderBottomStartRadius?: number | string,
829
+ borderEndEndRadius?: number | string,
830
+ borderEndStartRadius?: number | string,
831
+ borderStartEndRadius?: number | string,
832
+ borderStartStartRadius?: number | string,
833
+ borderTopEndRadius?: number | string,
834
+ borderTopLeftRadius?: number | string,
835
+ borderTopRightRadius?: number | string,
836
+ borderTopStartRadius?: number | string,
793
837
  borderStyle?: 'solid' | 'dotted' | 'dashed',
794
- borderWidth?: AnimatableNumericValue,
795
- borderBottomWidth?: AnimatableNumericValue,
796
- borderEndWidth?: AnimatableNumericValue,
797
- borderLeftWidth?: AnimatableNumericValue,
798
- borderRightWidth?: AnimatableNumericValue,
799
- borderStartWidth?: AnimatableNumericValue,
800
- borderTopWidth?: AnimatableNumericValue,
801
- opacity?: AnimatableNumericValue,
838
+ borderWidth?: number,
839
+ borderBottomWidth?: number,
840
+ borderEndWidth?: number,
841
+ borderLeftWidth?: number,
842
+ borderRightWidth?: number,
843
+ borderStartWidth?: number,
844
+ borderTopWidth?: number,
845
+ opacity?: number,
802
846
  outlineColor?: ____ColorValue_Internal,
803
- outlineOffset?: AnimatableNumericValue,
847
+ outlineOffset?: number,
804
848
  outlineStyle?: 'solid' | 'dotted' | 'dashed',
805
- outlineWidth?: AnimatableNumericValue,
849
+ outlineWidth?: number,
806
850
  elevation?: number,
807
851
  pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only',
808
852
  cursor?: CursorValue,
809
853
  boxShadow?: $ReadOnlyArray<BoxShadowValue> | string,
810
854
  filter?: $ReadOnlyArray<FilterFunction> | string,
811
855
  mixBlendMode?: ____BlendMode_Internal,
812
- experimental_backgroundImage?: $ReadOnlyArray<GradientValue> | string,
856
+ experimental_backgroundImage?: $ReadOnlyArray<BackgroundImageValue> | string,
813
857
  isolation?: 'auto' | 'isolate',
814
858
  }>;
815
859
 
860
+ export type ____ViewStyle_InternalCore = $ReadOnly<{
861
+ ...$Exact<____LayoutStyle_Internal>,
862
+ ...$Exact<____ShadowStyle_Internal>,
863
+ ...$Exact<____TransformStyle_Internal>,
864
+ ...____ViewStyle_InternalBase,
865
+ }>;
866
+
816
867
  export type ____ViewStyle_Internal = $ReadOnly<{
817
868
  ...____ViewStyle_InternalCore,
818
869
  ...____ViewStyle_InternalOverrides,
@@ -867,7 +918,7 @@ export type ____FontWeight_Internal =
867
918
  | 'heavy'
868
919
  | 'black';
869
920
 
870
- export type ____FontVariantArray_Internal = $ReadOnlyArray<
921
+ export type ____FontVariant_Internal =
871
922
  | 'small-caps'
872
923
  | 'oldstyle-nums'
873
924
  | 'lining-nums'
@@ -900,11 +951,12 @@ export type ____FontVariantArray_Internal = $ReadOnlyArray<
900
951
  | 'stylistic-seventeen'
901
952
  | 'stylistic-eighteen'
902
953
  | 'stylistic-nineteen'
903
- | 'stylistic-twenty',
904
- >;
954
+ | 'stylistic-twenty';
905
955
 
906
- export type ____TextStyle_InternalCore = $ReadOnly<{
907
- ...$Exact<____ViewStyle_Internal>,
956
+ export type ____FontVariantArray_Internal =
957
+ $ReadOnlyArray<____FontVariant_Internal>;
958
+
959
+ type ____TextStyle_InternalBase = $ReadOnly<{
908
960
  color?: ____ColorValue_Internal,
909
961
  fontFamily?: string,
910
962
  fontSize?: number,
@@ -935,6 +987,11 @@ export type ____TextStyle_InternalCore = $ReadOnly<{
935
987
  writingDirection?: 'auto' | 'ltr' | 'rtl',
936
988
  }>;
937
989
 
990
+ export type ____TextStyle_InternalCore = $ReadOnly<{
991
+ ...$Exact<____ViewStyle_Internal>,
992
+ ...____TextStyle_InternalBase,
993
+ }>;
994
+
938
995
  export type ____TextStyle_Internal = $ReadOnly<{
939
996
  ...____TextStyle_InternalCore,
940
997
  ...____TextStyle_InternalOverrides,
@@ -945,7 +1002,8 @@ export type ____ImageStyle_InternalCore = $ReadOnly<{
945
1002
  resizeMode?: ImageResizeMode,
946
1003
  objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
947
1004
  tintColor?: ____ColorValue_Internal,
948
- overlayColor?: string,
1005
+ overlayColor?: ColorValue,
1006
+ overflow?: 'visible' | 'hidden',
949
1007
  }>;
950
1008
 
951
1009
  export type ____ImageStyle_Internal = $ReadOnly<{
@@ -958,7 +1016,7 @@ export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{
958
1016
  resizeMode?: ImageResizeMode,
959
1017
  objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
960
1018
  tintColor?: ____ColorValue_Internal,
961
- overlayColor?: string,
1019
+ overlayColor?: ColorValue,
962
1020
  }>;
963
1021
 
964
1022
  export type ____DangerouslyImpreciseStyle_Internal = $ReadOnly<{
@@ -967,24 +1025,28 @@ export type ____DangerouslyImpreciseStyle_Internal = $ReadOnly<{
967
1025
  ...
968
1026
  }>;
969
1027
 
970
- type GenericStyleProp<+T> =
1028
+ export type StyleProp<+T> =
971
1029
  | null
972
1030
  | void
973
1031
  | T
974
1032
  | false
975
1033
  | ''
976
- | $ReadOnlyArray<GenericStyleProp<T>>;
1034
+ | $ReadOnlyArray<StyleProp<T>>;
977
1035
 
978
- export type ____DangerouslyImpreciseStyleProp_Internal = GenericStyleProp<
1036
+ export type ____DangerouslyImpreciseStyleProp_Internal = StyleProp<
979
1037
  Partial<____DangerouslyImpreciseStyle_Internal>,
980
1038
  >;
981
- export type ____ViewStyleProp_Internal = GenericStyleProp<
1039
+
1040
+ export type ____DangerouslyImpreciseAnimatedStyleProp_Internal =
1041
+ WithAnimatedValue<StyleProp<Partial<____DangerouslyImpreciseStyle_Internal>>>;
1042
+
1043
+ export type ____ViewStyleProp_Internal = StyleProp<
982
1044
  $ReadOnly<Partial<____ViewStyle_Internal>>,
983
1045
  >;
984
- export type ____TextStyleProp_Internal = GenericStyleProp<
1046
+ export type ____TextStyleProp_Internal = StyleProp<
985
1047
  $ReadOnly<Partial<____TextStyle_Internal>>,
986
1048
  >;
987
- export type ____ImageStyleProp_Internal = GenericStyleProp<
1049
+ export type ____ImageStyleProp_Internal = StyleProp<
988
1050
  $ReadOnly<Partial<____ImageStyle_Internal>>,
989
1051
  >;
990
1052
 
@@ -995,10 +1057,26 @@ export type ____Styles_Internal = {
995
1057
  ...
996
1058
  };
997
1059
 
998
- export type ____FlattenStyleProp_Internal<
999
- +TStyleProp: GenericStyleProp<mixed>,
1000
- > = TStyleProp extends null | void | false | ''
1060
+ // A depth limiter, to avoid TS2589 in TypeScript. This and
1061
+ // ____FlattenStyleProp_Helper should be considered internal.
1062
+ type FlattenDepthLimiter = [void, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
1063
+ type ____FlattenStyleProp_Helper<
1064
+ +TStyleProp: StyleProp<mixed>,
1065
+ Depth: $Values<FlattenDepthLimiter> = 9,
1066
+ > = Depth extends 0
1001
1067
  ? empty
1002
- : TStyleProp extends $ReadOnlyArray<infer V>
1003
- ? ____FlattenStyleProp_Internal<V>
1004
- : TStyleProp;
1068
+ : TStyleProp extends null | void | false | ''
1069
+ ? empty
1070
+ : // When TStyleProp is an array, recurse with decremented Depth
1071
+ TStyleProp extends $ReadOnlyArray<infer V>
1072
+ ? ____FlattenStyleProp_Helper<
1073
+ V,
1074
+ Depth extends number ? FlattenDepthLimiter[Depth] : 0,
1075
+ >
1076
+ : TStyleProp;
1077
+
1078
+ export type ____FlattenStyleProp_Internal<+TStyleProp: StyleProp<mixed>> =
1079
+ ____FlattenStyleProp_Helper<TStyleProp> extends empty
1080
+ ? // $FlowFixMe[unclear-type]
1081
+ any
1082
+ : ____FlattenStyleProp_Helper<TStyleProp>;
@@ -10,13 +10,22 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {DangerouslyImpreciseStyleProp} from './StyleSheet';
14
- import type {____FlattenStyleProp_Internal} from './StyleSheetTypes';
13
+ import type AnimatedNode from '../Animated/nodes/AnimatedNode';
14
+ import type {
15
+ ____DangerouslyImpreciseAnimatedStyleProp_Internal,
16
+ ____FlattenStyleProp_Internal,
17
+ } from './StyleSheetTypes';
15
18
 
16
- function flattenStyle<TStyleProp: DangerouslyImpreciseStyleProp>(
19
+ type NonAnimatedNodeObject<TStyleProp> = TStyleProp extends AnimatedNode
20
+ ? empty
21
+ : TStyleProp;
22
+
23
+ function flattenStyle<
24
+ TStyleProp: ____DangerouslyImpreciseAnimatedStyleProp_Internal,
25
+ >(
17
26
  style: ?TStyleProp,
18
27
  // $FlowFixMe[underconstrained-implicit-instantiation]
19
- ): ?____FlattenStyleProp_Internal<TStyleProp> {
28
+ ): ?NonAnimatedNodeObject<____FlattenStyleProp_Internal<TStyleProp>> {
20
29
  if (style === null || typeof style !== 'object') {
21
30
  return undefined;
22
31
  }
@@ -35,6 +44,7 @@ function flattenStyle<TStyleProp: DangerouslyImpreciseStyleProp>(
35
44
  for (const key in computedStyle) {
36
45
  // $FlowFixMe[incompatible-use]
37
46
  // $FlowFixMe[invalid-computed-prop]
47
+ // $FlowFixMe[prop-missing]
38
48
  result[key] = computedStyle[key];
39
49
  }
40
50
  }