react-native-windows 0.82.3 → 0.83.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 (223) hide show
  1. package/.flowconfig +2 -7
  2. package/Libraries/Animated/components/AnimatedFlatList.js +5 -3
  3. package/Libraries/Animated/components/AnimatedImage.js +4 -3
  4. package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
  5. package/Libraries/Animated/components/AnimatedText.js +7 -3
  6. package/Libraries/Animated/components/AnimatedView.js +3 -2
  7. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  8. package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
  9. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +43 -15
  10. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +43 -15
  11. package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +2 -2
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +2 -2
  13. package/Libraries/Components/Glyph/Glyph.js +4 -1
  14. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +2 -2
  15. package/Libraries/Components/RefreshControl/RefreshControl.d.ts +3 -3
  16. package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +2 -2
  17. package/Libraries/Components/ScrollView/ScrollView.js +1 -0
  18. package/Libraries/Components/ScrollView/ScrollView.windows.js +1 -0
  19. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -6
  20. package/Libraries/Components/Switch/Switch.d.ts +2 -2
  21. package/Libraries/Components/Switch/Switch.windows.js +1 -1
  22. package/Libraries/Components/TextInput/TextInput.d.ts +2 -5
  23. package/Libraries/Components/TextInput/TextInput.js +6 -0
  24. package/Libraries/Components/TextInput/TextInput.windows.js +6 -0
  25. package/Libraries/Components/Touchable/TouchableBounce.js +7 -7
  26. package/Libraries/Components/Touchable/TouchableBounce.windows.js +7 -7
  27. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -1
  28. package/Libraries/Components/View/ReactNativeStyleAttributes.js +19 -1
  29. package/Libraries/Components/View/View.d.ts +2 -2
  30. package/Libraries/Components/View/View.windows.js +0 -1
  31. package/Libraries/Components/View/ViewNativeComponent.js +13 -1
  32. package/Libraries/Core/ReactNativeVersion.js +3 -3
  33. package/Libraries/Core/setUpPerformance.js +2 -0
  34. package/Libraries/Debugging/DebuggingOverlay.js +14 -14
  35. package/Libraries/Debugging/DebuggingOverlayRegistry.js +8 -2
  36. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -2
  37. package/Libraries/Image/Image.d.ts +3 -3
  38. package/Libraries/Image/ImageInjection.js +3 -6
  39. package/Libraries/Image/ImageTypes.flow.js +3 -7
  40. package/Libraries/Lists/FlatList.js +8 -8
  41. package/Libraries/Lists/SectionList.d.ts +5 -1
  42. package/Libraries/Lists/ViewabilityHelper.js +1 -1
  43. package/Libraries/Lists/VirtualizedList.js +1 -0
  44. package/Libraries/LogBox/UI/AnsiHighlight.js +4 -1
  45. package/Libraries/NativeComponent/BaseViewConfig.android.js +11 -2
  46. package/Libraries/NativeComponent/NativeComponentRegistry.d.ts +98 -0
  47. package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -0
  48. package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +3 -1
  49. package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +45 -0
  50. package/Libraries/Network/RCTNetworking.android.js +3 -1
  51. package/Libraries/Network/RCTNetworking.ios.js +3 -0
  52. package/Libraries/Network/RCTNetworking.windows.js +3 -0
  53. package/Libraries/Network/XMLHttpRequest.js +1 -41
  54. package/Libraries/Pressability/usePressability.js +14 -3
  55. package/Libraries/ReactNative/PaperUIManager.windows.js +3 -3
  56. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +20 -82
  57. package/Libraries/ReactNative/getNativeComponentAttributes.js +12 -0
  58. package/Libraries/Renderer/implementations/ReactFabric-dev.js +6759 -4478
  59. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3169 -3119
  60. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4732 -3535
  61. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +6646 -4070
  62. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3136 -2825
  63. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4761 -3312
  64. package/Libraries/Renderer/shims/ReactNative.js +3 -1
  65. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  66. package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +2 -1
  67. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
  68. package/Libraries/StyleSheet/StyleSheetTypes.js +44 -0
  69. package/Libraries/StyleSheet/processBackgroundPosition.js +284 -0
  70. package/Libraries/StyleSheet/processBackgroundRepeat.js +105 -0
  71. package/Libraries/StyleSheet/processBackgroundSize.js +104 -0
  72. package/Libraries/Text/Text.d.ts +2 -2
  73. package/Libraries/Text/TextNativeComponent.js +10 -0
  74. package/Libraries/TurboModule/TurboModuleRegistry.js +3 -9
  75. package/Libraries/Utilities/DevLoadingView.js +14 -6
  76. package/Libraries/Utilities/HMRClient.js +13 -5
  77. package/Microsoft.ReactNative/CompositionComponentView.idl +2 -0
  78. package/Microsoft.ReactNative/CompositionHwndHost.idl +1 -0
  79. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +1 -1
  80. package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
  81. package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +10 -40
  82. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +3 -80
  83. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +45 -12
  84. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +8 -0
  85. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +61 -74
  86. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +4 -0
  87. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +1 -0
  88. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +4 -3
  89. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +2 -1
  90. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.cpp +245 -0
  91. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.h +80 -0
  92. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +20 -36
  93. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -0
  94. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +1 -0
  95. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
  96. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +20 -94
  97. package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -3
  98. package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +0 -41
  99. package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +0 -11
  100. package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -3
  101. package/Microsoft.ReactNative/ReactNativeWin32App.cpp +31 -101
  102. package/Microsoft.ReactNative/ReactNativeWin32App.h +2 -13
  103. package/Microsoft.ReactNative/ReactNativeWindow.idl +44 -0
  104. package/Microsoft.ReactNative.Cxx/AutoDraw.h +9 -1
  105. package/Microsoft.ReactNative.Cxx/ReactCommon/CallInvoker.h +13 -16
  106. package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +24 -36
  107. package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModuleUtils.h +5 -8
  108. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/AString.h +8 -6
  109. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Array.h +32 -49
  110. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Base.h +27 -76
  111. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bool.h +4 -2
  112. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/CallbackWrapper.h +19 -18
  113. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Class.h +25 -48
  114. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Convert.h +38 -31
  115. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Error.h +11 -6
  116. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/EventEmitter.h +47 -45
  117. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Function.h +69 -89
  118. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/HighResTimeStamp.h +8 -8
  119. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/LongLivedObject.h +6 -6
  120. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Number.h +16 -8
  121. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Object.h +17 -24
  122. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Promise.h +17 -17
  123. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Value.h +20 -29
  124. package/Microsoft.ReactNative.Cxx/ReactCommon/react/debug/react_native_assert.h +2 -7
  125. package/Microsoft.ReactNative.Cxx/ReactCommon/react/timing/primitives.h +127 -115
  126. package/PropertySheets/Generated/PackageVersion.g.props +4 -4
  127. package/PropertySheets/Warnings.props +2 -1
  128. package/ReactCommon/ReactCommon.vcxproj +11 -2
  129. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +2 -2
  130. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/Instance.cpp +4 -2
  131. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +4 -2
  132. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +4 -2
  133. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/MethodCall.cpp +4 -2
  134. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ModuleRegistry.cpp +5 -3
  135. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +4 -4
  136. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/RAMBundleRegistry.cpp +6 -4
  137. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +2 -0
  138. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +25 -35
  139. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +86 -67
  140. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +15 -8
  141. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSINativeModules.cpp +4 -2
  142. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +84 -68
  143. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +31 -35
  144. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/Utf8.h +4 -5
  145. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/network/HttpUtils.cpp +2 -1
  146. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +24 -36
  147. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.h +28 -66
  148. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/webperformance/NativePerformance.cpp +5 -0
  149. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +3 -3
  150. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +8 -4
  151. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +19 -16
  152. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +8 -9
  153. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +25 -95
  154. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/BaseViewProps.cpp +36 -0
  155. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +85 -42
  156. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +2 -0
  157. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +2 -0
  158. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +25 -31
  159. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +19 -5
  160. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +16 -1
  161. package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +1 -15
  162. package/Scripts/creaternwapp.cmd +1 -1
  163. package/Scripts/perf/compare-results.js +357 -0
  164. package/Scripts/perf/create-perf-test.js +343 -0
  165. package/Scripts/perf/post-pr-comment.js +210 -0
  166. package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +8 -0
  167. package/Shared/Hermes/HermesRuntimeTargetDelegate.h +3 -0
  168. package/Shared/Shared.vcxitems +15 -3
  169. package/Shared/Shared.vcxitems.filters +11 -3
  170. package/codegen/NativeIntersectionObserverSpec.g.h +2 -0
  171. package/codegen/NativeNetworkingIOSSpec.g.h +2 -0
  172. package/codegen/NativePerformanceSpec.g.h +6 -0
  173. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +229 -139
  174. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +2 -1
  175. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +42 -25
  176. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +2 -1
  177. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +2 -1
  178. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +11 -6
  179. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +11 -6
  180. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +1 -0
  181. package/codegen/react/components/rnwcore/InputAccessory.g.h +2 -1
  182. package/codegen/react/components/rnwcore/ModalHostView.g.h +40 -23
  183. package/codegen/react/components/rnwcore/Props.cpp +6 -1
  184. package/codegen/react/components/rnwcore/Props.h +1 -0
  185. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +11 -6
  186. package/codegen/react/components/rnwcore/SafeAreaView.g.h +1 -0
  187. package/codegen/react/components/rnwcore/Switch.g.h +11 -6
  188. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +2 -1
  189. package/codegen/react/components/rnwcore/VirtualView.g.h +41 -8
  190. package/codegen/react/components/rnwcore/VirtualViewExperimental.g.h +45 -8
  191. package/codegen/rnwcoreJSI.h +3973 -6059
  192. package/index.js +6 -0
  193. package/index.windows.js +6 -0
  194. package/jest/mockComponent.js +6 -6
  195. package/jest/setup.js +15 -10
  196. package/package.json +27 -27
  197. package/src/private/components/virtualview/VirtualView.js +22 -27
  198. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +6 -0
  199. package/src/private/featureflags/ReactNativeFeatureFlags.js +100 -19
  200. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +18 -3
  201. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
  202. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  203. package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
  204. package/src/private/webapis/dom/nodes/ReactNativeElement.js +12 -2
  205. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +76 -15
  206. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +1 -0
  207. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  208. package/src/private/webapis/performance/ResourceTiming.js +31 -4
  209. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +4 -1
  210. package/src/private/webapis/performance/specs/NativePerformance.js +3 -0
  211. package/stubs/double-conversion/double-conversion.h +5 -0
  212. package/templates/cpp-app/template.config.js +1 -1
  213. package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +1 -1
  214. package/templates/cpp-lib/template.config.js +1 -1
  215. package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
  216. package/types/index.d.ts +1 -0
  217. package/types/public/ReactNativeTypes.d.ts +115 -2
  218. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +0 -152
  219. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +0 -1574
  220. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ShadowNode.cpp +0 -528
  221. package/Scripts/OpenSSL.nuspec +0 -39
  222. package/Scripts/OpenSSL.targets +0 -36
  223. package/codegen/rnwcoreJSI-generated.cpp +0 -3470
@@ -7,7 +7,9 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow
10
- * @generated SignedSource<<8f46fdc9267fcc4fdc9e76842fe24066>>
10
+ *
11
+ * This file is no longer sync'd from the facebook/react repository.
12
+ * The version compatability check is removed. Use at your own risk.
11
13
  */
12
14
  'use strict';
13
15
 
@@ -7,7 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict
10
- * @generated SignedSource<<deb7924d11c790f99448a1c2f0edddb9>>
10
+ * @generated SignedSource<<c0e57723772ea5f1aa8c3c897ac3c216>>
11
11
  */
12
12
 
13
13
  import type {
@@ -135,6 +135,7 @@ export type RenderRootOptions = {
135
135
  error: mixed,
136
136
  errorInfo: {+componentStack?: ?string},
137
137
  ) => void,
138
+ onDefaultTransitionIndicator?: () => void | (() => void),
138
139
  };
139
140
 
140
141
  /**
@@ -7,7 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict
10
- * @generated SignedSource<<deb7924d11c790f99448a1c2f0edddb9>>
10
+ * @generated SignedSource<<c0e57723772ea5f1aa8c3c897ac3c216>>
11
11
  */
12
12
 
13
13
  import type {
@@ -139,6 +139,7 @@ export type RenderRootOptions = {
139
139
  error: mixed,
140
140
  errorInfo: {+componentStack?: ?string},
141
141
  ) => void,
142
+ onDefaultTransitionIndicator?: () => void | (() => void),
142
143
  };
143
144
 
144
145
  /**
@@ -373,7 +373,7 @@ export type GradientValue = {
373
373
  direction?: string | undefined;
374
374
  colorStops: ReadonlyArray<{
375
375
  color: ColorValue | null;
376
- positions?: ReadonlyArray<string[]> | undefined;
376
+ positions?: ReadonlyArray<string> | undefined;
377
377
  }>;
378
378
  };
379
379
 
@@ -779,6 +779,43 @@ type RadialGradientValue = {
779
779
 
780
780
  export type BackgroundImageValue = LinearGradientValue | RadialGradientValue;
781
781
 
782
+ export type BackgroundSizeValue =
783
+ | {
784
+ x: string | number,
785
+ y: string | number,
786
+ }
787
+ | 'cover'
788
+ | 'contain';
789
+
790
+ export type BackgroundRepeatKeyword =
791
+ | 'repeat'
792
+ | 'space'
793
+ | 'round'
794
+ | 'no-repeat';
795
+
796
+ export type BackgroundPositionValue =
797
+ | {
798
+ top: number | string,
799
+ left: number | string,
800
+ }
801
+ | {
802
+ top: number | string,
803
+ right: number | string,
804
+ }
805
+ | {
806
+ bottom: number | string,
807
+ left: number | string,
808
+ }
809
+ | {
810
+ bottom: number | string,
811
+ right: number | string,
812
+ };
813
+
814
+ export type BackgroundRepeatValue = {
815
+ x: BackgroundRepeatKeyword,
816
+ y: BackgroundRepeatKeyword,
817
+ };
818
+
782
819
  export type BoxShadowValue = {
783
820
  offsetX: number | string,
784
821
  offsetY: number | string,
@@ -853,6 +890,13 @@ export type ____ViewStyle_InternalBase = $ReadOnly<{
853
890
  filter?: $ReadOnlyArray<FilterFunction> | string,
854
891
  mixBlendMode?: ____BlendMode_Internal,
855
892
  experimental_backgroundImage?: $ReadOnlyArray<BackgroundImageValue> | string,
893
+ experimental_backgroundSize?: $ReadOnlyArray<BackgroundSizeValue> | string,
894
+ experimental_backgroundPosition?:
895
+ | $ReadOnlyArray<BackgroundPositionValue>
896
+ | string,
897
+ experimental_backgroundRepeat?:
898
+ | $ReadOnlyArray<BackgroundRepeatValue>
899
+ | string,
856
900
  isolation?: 'auto' | 'isolate',
857
901
  }>;
858
902
 
@@ -0,0 +1,284 @@
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 strict-local
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+ import type {BackgroundPositionValue} from './StyleSheetTypes';
13
+
14
+ export default function processBackgroundPosition(
15
+ backgroundPosition: ?($ReadOnlyArray<BackgroundPositionValue> | string),
16
+ ): $ReadOnlyArray<BackgroundPositionValue> {
17
+ let result: $ReadOnlyArray<BackgroundPositionValue> = [];
18
+
19
+ if (backgroundPosition == null) {
20
+ return [];
21
+ }
22
+ if (typeof backgroundPosition === 'string') {
23
+ result = parseBackgroundPositionCSSString(
24
+ backgroundPosition.replace(/\n/g, ' '),
25
+ );
26
+ } else if (Array.isArray(backgroundPosition)) {
27
+ result = backgroundPosition;
28
+ }
29
+
30
+ return result;
31
+ }
32
+
33
+ // https://www.w3.org/TR/css-backgrounds-3/#typedef-bg-position
34
+ const parseBackgroundPositionCSSString = (
35
+ backgroundPosition: string,
36
+ ): $ReadOnlyArray<BackgroundPositionValue> => {
37
+ const result: Array<BackgroundPositionValue> = [];
38
+ const positions = backgroundPosition.split(',').map(s => s.trim());
39
+
40
+ for (const position of positions) {
41
+ let top: string | number;
42
+ let left: string | number;
43
+ let right: string | number;
44
+ let bottom: string | number;
45
+ const parts = position.split(/\s+/).filter(p => p.length > 0);
46
+ // 1. Single value syntax [ left | center | right | top | bottom | <length-percentage> ]
47
+ if (parts.length === 1) {
48
+ const t1 = parts[0];
49
+ if (t1 == null) {
50
+ return [];
51
+ }
52
+ const token1 = t1.toLowerCase().trim();
53
+ if (token1 === 'left') {
54
+ left = '0%';
55
+ top = '50%';
56
+ } else if (token1 === 'center') {
57
+ left = '50%';
58
+ top = '50%';
59
+ } else if (token1 === 'right') {
60
+ left = '100%';
61
+ top = '50%';
62
+ } else if (token1 === 'top') {
63
+ left = '50%';
64
+ top = '0%';
65
+ } else if (token1 === 'bottom') {
66
+ left = '50%';
67
+ top = '100%';
68
+ } else if (isValidPosition(token1)) {
69
+ const value = getPositionFromCSSValue(token1);
70
+ if (value == null) {
71
+ return [];
72
+ }
73
+ left = value;
74
+ top = '50%';
75
+ }
76
+ }
77
+
78
+ // 2. Two value syntax [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]
79
+ if (parts.length === 2) {
80
+ const t1 = parts[0];
81
+ const t2 = parts[1];
82
+ if (t1 == null || t2 == null) {
83
+ return [];
84
+ }
85
+ const token1 = t1.toLowerCase().trim();
86
+ if (token1 === 'left') {
87
+ left = '0%';
88
+ } else if (token1 === 'center') {
89
+ left = '50%';
90
+ } else if (token1 === 'right') {
91
+ left = '100%';
92
+ } else if (token1 === 'top') {
93
+ top = '0%';
94
+ } else if (token1 === 'bottom') {
95
+ top = '100%';
96
+ } else if (isValidPosition(token1)) {
97
+ const value = getPositionFromCSSValue(token1);
98
+ if (value == null) {
99
+ return [];
100
+ }
101
+ left = value;
102
+ }
103
+
104
+ const token2 = t2.toLowerCase().trim();
105
+ if (token2 === 'top') {
106
+ top = '0%';
107
+ } else if (token2 === 'center') {
108
+ top = '50%';
109
+ } else if (token2 === 'bottom') {
110
+ top = '100%';
111
+ } else if (token2 === 'left') {
112
+ left = '0%';
113
+ } else if (token2 === 'right') {
114
+ left = '100%';
115
+ } else if (isValidPosition(token2)) {
116
+ const value = getPositionFromCSSValue(token2);
117
+ if (value == null) {
118
+ return [];
119
+ }
120
+ top = value;
121
+ }
122
+ }
123
+
124
+ // 3. Three value syntax [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ]
125
+ if (parts.length === 3) {
126
+ const t1 = parts[0];
127
+ const t2 = parts[1];
128
+ const t3 = parts[2];
129
+ if (t1 == null || t2 == null || t3 == null) {
130
+ return [];
131
+ }
132
+ const token1 = t1.toLowerCase().trim();
133
+ const token2 = t2.toLowerCase().trim();
134
+ const token3 = t3.toLowerCase().trim();
135
+ // e.g. center top 40%
136
+ if (token1 === 'center') {
137
+ left = '50%';
138
+ const value = getPositionFromCSSValue(token3);
139
+ if (value == null) {
140
+ return [];
141
+ }
142
+ if (token2 === 'top') {
143
+ top = value;
144
+ } else if (token2 === 'bottom') {
145
+ bottom = value;
146
+ } else {
147
+ return [];
148
+ }
149
+ }
150
+ // e.g. left 40% center
151
+ else if (token3 === 'center') {
152
+ top = '50%';
153
+ const value = getPositionFromCSSValue(token2);
154
+ if (value == null) {
155
+ return [];
156
+ }
157
+ if (token1 === 'left') {
158
+ left = value;
159
+ } else if (token1 === 'right') {
160
+ right = value;
161
+ } else {
162
+ return [];
163
+ }
164
+ }
165
+ // e.g. left 40% top, left top 10%
166
+ else {
167
+ const tokens = [token1, token2, token3];
168
+ for (let i = 0; i < tokens.length; i++) {
169
+ const token = tokens[i];
170
+ if (isValidPosition(token)) {
171
+ const value = getPositionFromCSSValue(token);
172
+ if (value == null) {
173
+ return [];
174
+ }
175
+ const previousToken = tokens[i - 1];
176
+ if (previousToken === 'left') {
177
+ left = value;
178
+ } else if (previousToken === 'right') {
179
+ right = value;
180
+ } else if (previousToken === 'top') {
181
+ top = value;
182
+ } else if (previousToken === 'bottom') {
183
+ bottom = value;
184
+ }
185
+ } else {
186
+ if (token === 'left') {
187
+ left = '0%';
188
+ } else if (token === 'right') {
189
+ right = '0%';
190
+ } else if (token === 'top') {
191
+ top = '0%';
192
+ } else if (token === 'bottom') {
193
+ bottom = '0%';
194
+ } else {
195
+ return [];
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ // 4. Four value syntax [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ]
203
+ if (parts.length === 4) {
204
+ const t1 = parts.shift();
205
+ const t2 = parts.shift();
206
+ const t3 = parts.shift();
207
+ const t4 = parts.shift();
208
+ if (t1 == null || t2 == null || t3 == null || t4 == null) {
209
+ return [];
210
+ }
211
+ const token1 = t1.toLowerCase().trim();
212
+ const token2 = t2.toLowerCase().trim();
213
+ const token3 = t3.toLowerCase().trim();
214
+ const token4 = t4.toLowerCase().trim();
215
+ const keyword1 = token1;
216
+ const value1 = getPositionFromCSSValue(token2);
217
+ const keyword2 = token3;
218
+ const value2 = getPositionFromCSSValue(token4);
219
+ if (value1 == null || value2 == null) {
220
+ return [];
221
+ }
222
+ if (keyword1 === 'left') {
223
+ left = value1;
224
+ } else if (keyword1 === 'right') {
225
+ right = value1;
226
+ }
227
+
228
+ if (keyword2 === 'top') {
229
+ top = value2;
230
+ } else if (keyword2 === 'bottom') {
231
+ bottom = value2;
232
+ }
233
+ }
234
+
235
+ if (top != null && left != null) {
236
+ result.push({
237
+ top,
238
+ left,
239
+ });
240
+ } else if (bottom != null && right != null) {
241
+ result.push({
242
+ bottom,
243
+ right,
244
+ });
245
+ } else if (top != null && right != null) {
246
+ result.push({
247
+ top,
248
+ right,
249
+ });
250
+ } else if (bottom != null && left != null) {
251
+ result.push({
252
+ bottom,
253
+ left,
254
+ });
255
+ } else {
256
+ return [];
257
+ }
258
+ }
259
+
260
+ return result;
261
+ };
262
+
263
+ function getPositionFromCSSValue(position: string) {
264
+ if (position.endsWith('px')) {
265
+ return parseFloat(position);
266
+ }
267
+
268
+ if (position.endsWith('%')) {
269
+ return position;
270
+ }
271
+
272
+ // CSS length allows 0 as a valid value
273
+ if (position === '0') {
274
+ return 0;
275
+ }
276
+ }
277
+
278
+ function isValidPosition(position: string) {
279
+ if (position.endsWith('px') || position.endsWith('%') || position === '0') {
280
+ return true;
281
+ }
282
+
283
+ return false;
284
+ }
@@ -0,0 +1,105 @@
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 strict-local
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {
14
+ BackgroundRepeatKeyword,
15
+ BackgroundRepeatValue,
16
+ } from './StyleSheetTypes';
17
+
18
+ function isBackgroundRepeatKeyword(
19
+ value: string,
20
+ ): value is BackgroundRepeatKeyword {
21
+ return (
22
+ value === 'repeat' ||
23
+ value === 'space' ||
24
+ value === 'round' ||
25
+ value === 'no-repeat'
26
+ );
27
+ }
28
+
29
+ export default function processBackgroundRepeat(
30
+ backgroundRepeat: ?($ReadOnlyArray<BackgroundRepeatValue> | string),
31
+ ): $ReadOnlyArray<BackgroundRepeatValue> {
32
+ let result: $ReadOnlyArray<BackgroundRepeatValue> = [];
33
+ if (backgroundRepeat == null) {
34
+ return [];
35
+ }
36
+
37
+ if (Array.isArray(backgroundRepeat)) {
38
+ return backgroundRepeat;
39
+ }
40
+
41
+ if (typeof backgroundRepeat === 'string') {
42
+ result = parseBackgroundRepeatCSSString(
43
+ backgroundRepeat.replace(/\n/g, ' '),
44
+ );
45
+ }
46
+
47
+ return result;
48
+ }
49
+
50
+ // https://www.w3.org/TR/css-backgrounds-3/#typedef-repeat-style
51
+ function parseBackgroundRepeatCSSString(
52
+ backgroundRepeat: string,
53
+ ): $ReadOnlyArray<BackgroundRepeatValue> {
54
+ const result: Array<BackgroundRepeatValue> = [];
55
+ const bgRepeatArray = backgroundRepeat.split(',').map(s => s.trim());
56
+
57
+ for (const bgRepeat of bgRepeatArray) {
58
+ if (bgRepeat.length === 0) {
59
+ return [];
60
+ }
61
+
62
+ const parts = bgRepeat.split(/\s+/).filter(p => p.length > 0);
63
+ if (parts.length === 1) {
64
+ const part1 = parts[0];
65
+ if (part1 == null) {
66
+ return [];
67
+ }
68
+ const token1 = part1.toLowerCase();
69
+ if (token1 === 'repeat-x') {
70
+ result.push({x: 'repeat', y: 'no-repeat'});
71
+ } else if (token1 === 'repeat-y') {
72
+ result.push({x: 'no-repeat', y: 'repeat'});
73
+ } else if (token1 === 'repeat') {
74
+ result.push({x: 'repeat', y: 'repeat'});
75
+ } else if (token1 === 'space') {
76
+ result.push({x: 'space', y: 'space'});
77
+ } else if (token1 === 'round') {
78
+ result.push({x: 'round', y: 'round'});
79
+ } else if (token1 === 'no-repeat') {
80
+ result.push({x: 'no-repeat', y: 'no-repeat'});
81
+ } else {
82
+ return [];
83
+ }
84
+ } else if (parts.length === 2) {
85
+ const part1 = parts[0];
86
+ const part2 = parts[1];
87
+ if (part1 == null || part2 == null) {
88
+ return [];
89
+ }
90
+ const token1 = part1.toLowerCase();
91
+ const token2 = part2.toLowerCase();
92
+
93
+ if (
94
+ isBackgroundRepeatKeyword(token1) &&
95
+ isBackgroundRepeatKeyword(token2)
96
+ ) {
97
+ result.push({x: token1, y: token2});
98
+ } else {
99
+ return [];
100
+ }
101
+ }
102
+ }
103
+
104
+ return result;
105
+ }
@@ -0,0 +1,104 @@
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 strict-local
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {BackgroundSizeValue} from './StyleSheetTypes';
14
+
15
+ export default function processBackgroundSize(
16
+ backgroundSize: ?($ReadOnlyArray<BackgroundSizeValue> | string),
17
+ ): $ReadOnlyArray<BackgroundSizeValue> {
18
+ let result: $ReadOnlyArray<BackgroundSizeValue> = [];
19
+
20
+ if (backgroundSize == null) {
21
+ // If the size is invalid, return an empty array and do not apply any background size. Same as web.
22
+ return [];
23
+ }
24
+
25
+ if (typeof backgroundSize === 'string') {
26
+ result = parseBackgroundSizeCSSString(backgroundSize.replace(/\n/g, ' '));
27
+ } else if (Array.isArray(backgroundSize)) {
28
+ result = backgroundSize;
29
+ }
30
+
31
+ return result;
32
+ }
33
+ // https://www.w3.org/TR/css-backgrounds-3/#typedef-bg-size
34
+ // <bg-size> = [ <length-percentage [0,∞]> | auto ]{1,2} | cover | contain
35
+ function parseBackgroundSizeCSSString(
36
+ backgroundSize: string,
37
+ ): $ReadOnlyArray<BackgroundSizeValue> {
38
+ const result: Array<BackgroundSizeValue> = [];
39
+ const sizes = backgroundSize.split(',').map(s => s.trim());
40
+
41
+ for (const size of sizes) {
42
+ if (size.length === 0) {
43
+ return [];
44
+ }
45
+
46
+ const parts = size.split(/\s+/).filter(p => p.length > 0);
47
+
48
+ if (parts.length === 2) {
49
+ const x = getValidLengthPercentageSizeOrNull(parts[0].toLowerCase());
50
+ const y = getValidLengthPercentageSizeOrNull(parts[1].toLowerCase());
51
+ if (x != null && y != null) {
52
+ result.push({
53
+ x,
54
+ y,
55
+ });
56
+ } else {
57
+ return [];
58
+ }
59
+ } else if (parts.length === 1) {
60
+ const part = parts[0].toLowerCase();
61
+ if (part === 'cover' || part === 'contain') {
62
+ result.push(part);
63
+ } else {
64
+ const x = getValidLengthPercentageSizeOrNull(parts[0].toLowerCase());
65
+ if (x != null) {
66
+ result.push({
67
+ x,
68
+ y: 'auto',
69
+ });
70
+ } else {
71
+ return [];
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ return result;
78
+ }
79
+
80
+ // [ <length-percentage [0,∞]> | auto ]
81
+ function getValidLengthPercentageSizeOrNull(size: ?string) {
82
+ if (size == null) {
83
+ return null;
84
+ }
85
+
86
+ if (size.endsWith('px')) {
87
+ const num = parseFloat(size);
88
+ if (!Number.isNaN(num) && num >= 0) {
89
+ return num;
90
+ }
91
+ }
92
+
93
+ if (size.endsWith('%')) {
94
+ if (parseFloat(size) >= 0) {
95
+ return size;
96
+ }
97
+ }
98
+
99
+ if (size === 'auto') {
100
+ return size;
101
+ }
102
+
103
+ return null;
104
+ }
@@ -10,7 +10,7 @@
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../types/private/Utilities';
12
12
  import {AccessibilityProps} from '../Components/View/ViewAccessibility';
13
- import {NativeMethods} from '../../types/public/ReactNativeTypes';
13
+ import {HostInstance} from '../../types/public/ReactNativeTypes';
14
14
  import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet';
15
15
  import {TextStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes';
16
16
  import {
@@ -234,5 +234,5 @@ export interface TextProps
234
234
  * A React component for displaying text which supports nesting, styling, and touch handling.
235
235
  */
236
236
  declare class TextComponent extends React.Component<TextProps> {}
237
- declare const TextBase: Constructor<NativeMethods> & typeof TextComponent;
237
+ declare const TextBase: Constructor<HostInstance> & typeof TextComponent;
238
238
  export class Text extends TextBase {}
@@ -65,6 +65,16 @@ const virtualTextViewConfig = {
65
65
  uiViewClassName: 'RCTVirtualText',
66
66
  };
67
67
 
68
+ /**
69
+ * `NativeText` is an internal React Native host component, and is exported to
70
+ * provide lower-level access for libraries.
71
+ *
72
+ * @warning `<unstable_NativeText>` provides no semver guarantees and is not
73
+ * intended to be used in app code. Please use
74
+ * [`<Text>`](https://reactnative.dev/docs/text) instead.
75
+ */
76
+ // Additional note: Our long term plan is to reduce the overhead of the <Text>
77
+ // and <View> wrappers so that we no longer have any reason to export these APIs.
68
78
  export const NativeText: HostComponent<NativeTextProps> =
69
79
  (createReactNativeComponentClass('RCTText', () =>
70
80
  /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
@@ -24,15 +24,9 @@ function requireModule<T: TurboModule>(name: string): ?T {
24
24
  }
25
25
  }
26
26
 
27
- if (
28
- global.RN$Bridgeless !== true ||
29
- global.RN$TurboInterop === true ||
30
- global.RN$UnifiedNativeModuleProxy === true
31
- ) {
32
- const legacyModule: ?T = NativeModules[name];
33
- if (legacyModule != null) {
34
- return legacyModule;
35
- }
27
+ const legacyModule: ?T = NativeModules[name];
28
+ if (legacyModule != null) {
29
+ return legacyModule;
36
30
  }
37
31
 
38
32
  return null;