react-native-windows 0.0.0-canary.992 → 0.0.0-canary.993

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 (195) hide show
  1. package/.flowconfig +3 -1
  2. package/Libraries/Animated/Animated.js +0 -1
  3. package/Libraries/Animated/Animated.js.flow +0 -1
  4. package/Libraries/Animated/AnimatedExports.js +0 -1
  5. package/Libraries/Animated/AnimatedExports.js.flow +1 -2
  6. package/Libraries/Animated/animations/Animation.js +5 -2
  7. package/Libraries/Animated/components/AnimatedScrollView.js +53 -52
  8. package/Libraries/Animated/createAnimatedComponent.js +37 -33
  9. package/Libraries/Animated/nodes/AnimatedObject.js +2 -3
  10. package/Libraries/Animated/nodes/AnimatedProps.js +1 -1
  11. package/Libraries/Animated/shouldUseTurboAnimatedModule.js +6 -1
  12. package/Libraries/AppState/AppState.js +6 -1
  13. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +19 -18
  14. package/Libraries/Components/Button.js +2 -2
  15. package/Libraries/Components/Button.windows.js +2 -3
  16. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +2 -3
  17. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +2 -1
  18. package/Libraries/Components/LayoutConformance/LayoutConformance.js +0 -1
  19. package/Libraries/Components/Pressable/Pressable.js +9 -6
  20. package/Libraries/Components/Pressable/Pressable.windows.js +9 -6
  21. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +14 -13
  22. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +13 -1
  23. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
  24. package/Libraries/Components/ScrollView/ScrollView.d.ts +9 -5
  25. package/Libraries/Components/ScrollView/ScrollView.js +18 -12
  26. package/Libraries/Components/ScrollView/ScrollView.windows.js +19 -12
  27. package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -1
  28. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +1 -1
  29. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +19 -6
  30. package/Libraries/Components/Switch/Switch.js +8 -2
  31. package/Libraries/Components/Switch/Switch.windows.js +8 -2
  32. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -5
  33. package/Libraries/Components/TextInput/TextInput.flow.js +1 -5
  34. package/Libraries/Components/TextInput/TextInput.flow.windows.js +1 -6
  35. package/Libraries/Components/TextInput/TextInput.js +26 -25
  36. package/Libraries/Components/TextInput/TextInput.windows.js +27 -25
  37. package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +1 -5
  38. package/Libraries/Components/Touchable/TouchableBounce.js +9 -3
  39. package/Libraries/Components/Touchable/TouchableBounce.windows.js +9 -3
  40. package/Libraries/Components/Touchable/TouchableHighlight.js +9 -4
  41. package/Libraries/Components/Touchable/TouchableHighlight.windows.js +9 -4
  42. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -1
  43. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -1
  44. package/Libraries/Components/Touchable/TouchableOpacity.js +7 -3
  45. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +7 -3
  46. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
  47. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -2
  48. package/Libraries/Components/View/View.js +111 -25
  49. package/Libraries/Components/View/View.windows.js +427 -227
  50. package/Libraries/Core/Devtools/loadBundleFromServer.js +49 -7
  51. package/Libraries/Core/Devtools/loadBundleFromServer.windows.js +49 -7
  52. package/Libraries/Core/InitializeCore.js +1 -22
  53. package/Libraries/Core/ReactNativeVersion.js +3 -2
  54. package/Libraries/Debugging/DebuggingOverlay.js +6 -8
  55. package/Libraries/Debugging/DebuggingOverlayRegistry.js +0 -1
  56. package/Libraries/Debugging/useSubscribeToDebuggingOverlayRegistry.js +0 -1
  57. package/Libraries/EventEmitter/NativeEventEmitter.js +1 -1
  58. package/Libraries/Image/AssetRegistry.js +4 -10
  59. package/Libraries/Image/AssetSourceResolver.js +17 -4
  60. package/Libraries/Image/AssetSourceResolver.windows.js +17 -4
  61. package/Libraries/Image/Image.android.js +112 -106
  62. package/Libraries/Image/Image.ios.js +10 -2
  63. package/Libraries/Image/Image.windows.js +30 -20
  64. package/Libraries/Image/ImageAnalyticsTagContext.js +2 -2
  65. package/Libraries/Image/RelativeImageStub.js +1 -0
  66. package/Libraries/Lists/FlatList.d.ts +9 -5
  67. package/Libraries/Lists/FlatList.js +1 -1
  68. package/Libraries/Lists/SectionListModern.js +9 -3
  69. package/Libraries/LogBox/UI/LogBoxButton.js +2 -1
  70. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +2 -1
  71. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.windows.js +2 -1
  72. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +3 -2
  73. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +2 -1
  74. package/Libraries/ReactNative/AppContainer-dev.js +4 -4
  75. package/Libraries/ReactNative/AppContainer-prod.js +0 -1
  76. package/Libraries/ReactNative/RootTag.js +2 -2
  77. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
  78. package/Libraries/Renderer/shims/ReactNativeTypes.js +21 -25
  79. package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +270 -0
  80. package/Libraries/StyleSheet/StyleSheetExports.js.flow +3 -1
  81. package/Libraries/StyleSheet/StyleSheetTypes.js +4 -3
  82. package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
  83. package/Libraries/StyleSheet/processBoxShadow.js +0 -1
  84. package/Libraries/StyleSheet/processFilter.js +0 -1
  85. package/Libraries/Text/Text.d.ts +1 -2
  86. package/Libraries/Text/Text.js +255 -244
  87. package/Libraries/Text/Text.windows.js +281 -300
  88. package/Libraries/Text/TextAncestor.js +3 -2
  89. package/Libraries/Text/TextProps.js +2 -34
  90. package/Libraries/Text/TextProps.windows.js +2 -34
  91. package/Libraries/Types/ReactDevToolsTypes.js +0 -1
  92. package/Libraries/Utilities/PerformanceLoggerContext.js +2 -2
  93. package/Libraries/Utilities/PlatformTypes.js +1 -1
  94. package/Libraries/vendor/core/ErrorUtils.js +28 -4
  95. package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +1 -1
  96. package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.h +1 -1
  97. package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +1 -1
  98. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +1 -1
  99. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +2 -2
  100. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +10 -9
  101. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +21 -17
  102. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -4
  103. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +19 -0
  104. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +76 -0
  105. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +6 -0
  106. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +19 -2
  107. package/Microsoft.ReactNative/Utils/ThemeUtils.cpp +49 -0
  108. package/Microsoft.ReactNative/Utils/ThemeUtils.h +31 -0
  109. package/Microsoft.ReactNative/Views/ShadowNodeBase.cpp +36 -8
  110. package/Microsoft.ReactNative/Views/ShadowNodeRegistry.cpp +6 -2
  111. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +9 -1
  112. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Base.h +45 -34
  113. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bool.h +1 -1
  114. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bridging.h +1 -0
  115. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Class.h +36 -33
  116. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Number.h +10 -10
  117. package/PropertySheets/External/Microsoft.ReactNative.Cpp.Dependencies.props +10 -0
  118. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  119. package/PropertySheets/React.Cpp.props +1 -1
  120. package/ReactCommon/ReactCommon.vcxproj +10 -19
  121. package/ReactCommon/ReactCommon.vcxproj.filters +36 -13
  122. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +1 -1
  123. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +110 -0
  124. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Bridging.h +1 -0
  125. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.cpp +19 -3
  126. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.h +9 -0
  127. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +459 -0
  128. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +92 -0
  129. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +35 -0
  130. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityProps.cpp +28 -1
  131. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/css/CSSTokenizer.h +1 -2
  132. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +2 -1
  133. package/Scripts/creaternwapp.cmd +11 -8
  134. package/Shared/HermesRuntimeHolder.cpp +3 -1
  135. package/Shared/Shared.vcxitems +5 -1
  136. package/Shared/Shared.vcxitems.filters +4 -0
  137. package/codegen/NativeDOMSpec.g.h +6 -0
  138. package/codegen/NativeIntersectionObserverSpec.g.h +19 -5
  139. package/codegen/NativeMutationObserverSpec.g.h +11 -5
  140. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +104 -92
  141. package/codegen/react/components/rnwcore/States.h +8 -8
  142. package/codegen/rnwcoreJSI-generated.cpp +48 -3
  143. package/codegen/rnwcoreJSI.h +73 -10
  144. package/index.js +0 -1
  145. package/jest/mockNativeComponent.js +2 -1
  146. package/jest/renderer.js +0 -1
  147. package/jest/resolver.js +31 -0
  148. package/package.json +13 -13
  149. package/src/private/animated/NativeAnimatedHelper.js +6 -1
  150. package/src/private/animated/createAnimatedPropsHook.js +11 -4
  151. package/src/private/animated/createAnimatedPropsMemoHook.js +0 -1
  152. package/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js +0 -1
  153. package/src/private/components/scrollview/HScrollViewNativeComponents.js +0 -1
  154. package/src/private/components/scrollview/VScrollViewNativeComponents.js +0 -1
  155. package/src/private/devsupport/rndevtools/FuseboxSessionObserver.js +0 -1
  156. package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.android.js +8 -9
  157. package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.ios.js +12 -15
  158. package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.windows.js +8 -9
  159. package/src/private/devsupport/rndevtools/setUpFuseboxReactDevToolsDispatcher.js +0 -1
  160. package/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js +0 -1
  161. package/src/private/featureflags/ReactNativeFeatureFlags.js +39 -4
  162. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -2
  163. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +44 -0
  164. package/src/private/styles/composeStyles.js +12 -5
  165. package/src/private/webapis/dom/events/Event.js +3 -0
  166. package/src/private/webapis/dom/events/EventTarget.js +3 -0
  167. package/src/private/webapis/dom/nodes/ReactNativeElement.js +6 -23
  168. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +3 -1
  169. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +38 -0
  170. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +3 -0
  171. package/src/private/webapis/dom/oldstylecollections/NodeList.js +3 -0
  172. package/src/private/webapis/errors/DOMException.js +166 -0
  173. package/src/private/webapis/geometry/DOMRect.js +5 -0
  174. package/src/private/webapis/geometry/DOMRectList.js +3 -0
  175. package/src/private/webapis/geometry/DOMRectReadOnly.js +6 -0
  176. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +15 -7
  177. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +3 -0
  178. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +80 -18
  179. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +12 -0
  180. package/src/private/webapis/mutationobserver/MutationObserver.js +23 -33
  181. package/src/private/webapis/mutationobserver/MutationRecord.js +3 -0
  182. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +56 -24
  183. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -1
  184. package/src/private/webapis/performance/MemoryInfo.js +4 -1
  185. package/src/private/webapis/performance/Performance.js +19 -8
  186. package/src/private/webapis/performance/PerformanceEntry.js +4 -0
  187. package/src/private/webapis/performance/ReactNativeStartupTiming.js +4 -1
  188. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +2 -0
  189. package/src/private/webapis/structuredClone/structuredClone.js +233 -0
  190. package/src/private/webapis/webidl/PlatformObjects.js +59 -0
  191. package/src/types/globals.d.ts +42 -0
  192. package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +0 -1
  193. package/types/index.d.ts +1 -1
  194. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +0 -78
  195. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +0 -196
@@ -17,11 +17,23 @@ import Platform from '../../Utilities/Platform';
17
17
 
18
18
  export type {ProgressBarAndroidProps};
19
19
 
20
+ // A utility type to preserve the semantics of the union uses in the definition
21
+ // of ProgressBarAndroidProps. TS's Omit does not distribute over unions, so
22
+ // we define our own version which does. This does not affect Flow.
23
+ // $FlowExpectedError[unclear-type]
24
+ type Omit<T, K> = T extends any ? Pick<T, Exclude<$Keys<T>, K>> : T;
25
+
26
+ /**
27
+ * ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
28
+ * It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
29
+ * @see https://github.com/react-native-community/progress-bar-android
30
+ * @deprecated
31
+ */
20
32
  let ProgressBarAndroid: component(
21
33
  ref?: React.RefSetter<
22
34
  React.ElementRef<ProgressBarAndroidNativeComponentType>,
23
35
  >,
24
- ...props: ProgressBarAndroidProps
36
+ ...props: Omit<ProgressBarAndroidProps, empty>
25
37
  );
26
38
 
27
39
  if (Platform.OS === 'android') {
@@ -17,28 +17,25 @@ import type {ViewProps} from '../View/ViewPropTypes';
17
17
  * `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
18
18
  * `progress` value.
19
19
  */
20
- type ProgressBarAndroidStyleAttrProp =
21
- | {
22
- styleAttr: 'Horizontal',
23
- indeterminate: false,
24
- progress: number,
25
- }
26
- | {
27
- styleAttr:
28
- | 'Horizontal'
29
- | 'Normal'
30
- | 'Small'
31
- | 'Large'
32
- | 'Inverse'
33
- | 'SmallInverse'
34
- | 'LargeInverse',
35
- indeterminate: true,
36
- };
20
+ type DeterminateProgressBarAndroidStyleAttrProp = {
21
+ styleAttr: 'Horizontal',
22
+ indeterminate: false,
23
+ progress: number,
24
+ };
37
25
 
38
- export type ProgressBarAndroidProps = $ReadOnly<{
39
- ...ViewProps,
40
- ...ProgressBarAndroidStyleAttrProp,
26
+ type IndeterminateProgressBarAndroidStyleAttrProp = {
27
+ styleAttr:
28
+ | 'Horizontal'
29
+ | 'Normal'
30
+ | 'Small'
31
+ | 'Large'
32
+ | 'Inverse'
33
+ | 'SmallInverse'
34
+ | 'LargeInverse',
35
+ indeterminate: true,
36
+ };
41
37
 
38
+ type ProgressBarAndroidBaseProps = $ReadOnly<{
42
39
  /**
43
40
  * Whether to show the ProgressBar (true, the default) or hide it (false).
44
41
  */
@@ -52,3 +49,15 @@ export type ProgressBarAndroidProps = $ReadOnly<{
52
49
  */
53
50
  testID?: ?string,
54
51
  }>;
52
+
53
+ export type ProgressBarAndroidProps =
54
+ | $ReadOnly<{
55
+ ...ViewProps,
56
+ ...ProgressBarAndroidBaseProps,
57
+ ...DeterminateProgressBarAndroidStyleAttrProp,
58
+ }>
59
+ | $ReadOnly<{
60
+ ...ViewProps,
61
+ ...ProgressBarAndroidBaseProps,
62
+ ...IndeterminateProgressBarAndroidStyleAttrProp,
63
+ }>;
@@ -565,16 +565,20 @@ export interface ScrollViewPropsAndroid {
565
565
  nestedScrollEnabled?: boolean | undefined;
566
566
 
567
567
  /**
568
- * Fades out the edges of the scroll content.
568
+ * Controls the fading effect at the edges of the scroll content.
569
569
  *
570
- * If the value is greater than 0, the fading edges will be set accordingly
571
- * to the current scroll direction and position,
572
- * indicating if there is more content to show.
570
+ * A value greater than 0 will apply the fading effect, indicating more content is available
571
+ * to scroll.
572
+ *
573
+ * You can specify a single number to apply the same fading length to both edges.
574
+ * Alternatively, use an object with `start` and `end` properties to set different
575
+ * fading lengths for the start and end of the scroll content.
573
576
  *
574
577
  * The default value is 0.
578
+ *
575
579
  * @platform android
576
580
  */
577
- fadingEdgeLength?: number | undefined;
581
+ fadingEdgeLength?: number | {start: number; end: number} | undefined;
578
582
 
579
583
  /**
580
584
  * Causes the scrollbars not to turn transparent when they are not in use. The default value is false.
@@ -52,6 +52,7 @@ import invariant from 'invariant';
52
52
  import memoize from 'memoize-one';
53
53
  import nullthrows from 'nullthrows';
54
54
  import * as React from 'react';
55
+ import {cloneElement} from 'react';
55
56
 
56
57
  /*
57
58
  * iOS scroll event timing nuances:
@@ -372,17 +373,20 @@ export type ScrollViewPropsAndroid = $ReadOnly<{
372
373
  */
373
374
  persistentScrollbar?: ?boolean,
374
375
  /**
375
- * Fades out the edges of the scroll content.
376
+ * Controls the fading effect at the edges of the scroll content.
376
377
  *
377
- * If the value is greater than 0, the fading edges will be set accordingly
378
- * to the current scroll direction and position,
379
- * indicating if there is more content to show.
378
+ * A value greater than 0 will apply the fading effect, indicating more content is available
379
+ * to scroll.
380
+ *
381
+ * You can specify a single number to apply the same fading length to both edges.
382
+ * Alternatively, use an object with `start` and `end` properties to set different
383
+ * fading lengths for the start and end of the scroll content.
380
384
  *
381
385
  * The default value is 0.
382
386
  *
383
387
  * @platform android
384
388
  */
385
- fadingEdgeLength?: ?number,
389
+ fadingEdgeLength?: ?number | {start: number, end: number},
386
390
  }>;
387
391
 
388
392
  type StickyHeaderComponentType = component(
@@ -1827,7 +1831,7 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
1827
1831
  // however, the ScrollView still needs the baseStyle to be scrollable
1828
1832
  const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
1829
1833
  // $FlowFixMe[incompatible-call]
1830
- return React.cloneElement(
1834
+ return cloneElement(
1831
1835
  refreshControl,
1832
1836
  {style: StyleSheet.compose(baseStyle, outer)},
1833
1837
  <NativeScrollView
@@ -1907,23 +1911,25 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
1907
1911
  return state;
1908
1912
  }
1909
1913
 
1910
- // TODO: After upgrading to React 19, remove `forwardRef` from this component.
1911
1914
  // NOTE: This wrapper component is necessary because `ScrollView` is a class
1912
1915
  // component and we need to map `ref` to a differently named prop. This can be
1913
1916
  // removed when `ScrollView` is a functional component.
1914
1917
  const ScrollViewWrapper: component(
1915
1918
  ref?: React.RefSetter<PublicScrollViewInstance>,
1916
1919
  ...props: ScrollViewProps
1917
- ) = React.forwardRef(function Wrapper(
1918
- props: ScrollViewProps,
1919
- ref: ?React.RefSetter<PublicScrollViewInstance>,
1920
- ): React.Node {
1920
+ ) = function Wrapper({
1921
+ ref,
1922
+ ...props
1923
+ }: {
1924
+ ref?: React.RefSetter<PublicScrollViewInstance>,
1925
+ ...ScrollViewProps,
1926
+ }): React.Node {
1921
1927
  return ref == null ? (
1922
1928
  <ScrollView {...props} />
1923
1929
  ) : (
1924
1930
  <ScrollView {...props} scrollViewRef={ref} />
1925
1931
  );
1926
- });
1932
+ };
1927
1933
  ScrollViewWrapper.displayName = 'ScrollView';
1928
1934
  // $FlowExpectedError[prop-missing]
1929
1935
  ScrollViewWrapper.Context = ScrollViewContext;
@@ -52,6 +52,7 @@ import invariant from 'invariant';
52
52
  import memoize from 'memoize-one';
53
53
  import nullthrows from 'nullthrows';
54
54
  import * as React from 'react';
55
+ import {cloneElement} from 'react';
55
56
 
56
57
  /*
57
58
  * iOS scroll event timing nuances:
@@ -372,17 +373,20 @@ export type ScrollViewPropsAndroid = $ReadOnly<{
372
373
  */
373
374
  persistentScrollbar?: ?boolean,
374
375
  /**
375
- * Fades out the edges of the scroll content.
376
+ * Controls the fading effect at the edges of the scroll content.
376
377
  *
377
- * If the value is greater than 0, the fading edges will be set accordingly
378
- * to the current scroll direction and position,
379
- * indicating if there is more content to show.
378
+ * A value greater than 0 will apply the fading effect, indicating more content is available
379
+ * to scroll.
380
+ *
381
+ * You can specify a single number to apply the same fading length to both edges.
382
+ * Alternatively, use an object with `start` and `end` properties to set different
383
+ * fading lengths for the start and end of the scroll content.
380
384
  *
381
385
  * The default value is 0.
382
386
  *
383
387
  * @platform android
384
388
  */
385
- fadingEdgeLength?: ?number,
389
+ fadingEdgeLength?: ?number | {start: number, end: number},
386
390
  }>;
387
391
 
388
392
  type StickyHeaderComponentType = component(
@@ -1165,6 +1169,7 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
1165
1169
  // they are callable from the ref.
1166
1170
 
1167
1171
  // $FlowFixMe[prop-missing] - Known issue with appending custom methods.
1172
+ // $FlowFixMe[unsafe-object-assign] - Using Object.assign to append methods to native instance
1168
1173
  const publicInstance: PublicScrollViewInstance = Object.assign(
1169
1174
  nativeInstance,
1170
1175
  {
@@ -1829,7 +1834,7 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
1829
1834
  // however, the ScrollView still needs the baseStyle to be scrollable
1830
1835
  const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
1831
1836
  // $FlowFixMe[incompatible-call]
1832
- return React.cloneElement(
1837
+ return cloneElement(
1833
1838
  refreshControl,
1834
1839
  {style: StyleSheet.compose(baseStyle, outer)},
1835
1840
  <NativeScrollView
@@ -1909,23 +1914,25 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
1909
1914
  return state;
1910
1915
  }
1911
1916
 
1912
- // TODO: After upgrading to React 19, remove `forwardRef` from this component.
1913
1917
  // NOTE: This wrapper component is necessary because `ScrollView` is a class
1914
1918
  // component and we need to map `ref` to a differently named prop. This can be
1915
1919
  // removed when `ScrollView` is a functional component.
1916
1920
  const ScrollViewWrapper: component(
1917
1921
  ref?: React.RefSetter<PublicScrollViewInstance>,
1918
1922
  ...props: ScrollViewProps
1919
- ) = React.forwardRef(function Wrapper(
1920
- props: ScrollViewProps,
1921
- ref: ?React.RefSetter<PublicScrollViewInstance>,
1922
- ): React.Node {
1923
+ ) = function Wrapper({
1924
+ ref,
1925
+ ...props
1926
+ }: {
1927
+ ref?: React.RefSetter<PublicScrollViewInstance>,
1928
+ ...ScrollViewProps,
1929
+ }): React.Node {
1923
1930
  return ref == null ? (
1924
1931
  <ScrollView {...props} />
1925
1932
  ) : (
1926
1933
  <ScrollView {...props} scrollViewRef={ref} />
1927
1934
  );
1928
- });
1935
+ };
1929
1936
  ScrollViewWrapper.displayName = 'ScrollView';
1930
1937
  // $FlowExpectedError[prop-missing]
1931
1938
  ScrollViewWrapper.Context = ScrollViewContext;
@@ -9,10 +9,11 @@
9
9
  */
10
10
 
11
11
  import * as React from 'react';
12
+ import {createContext} from 'react';
12
13
 
13
14
  type Value = {horizontal: boolean} | null;
14
15
 
15
- const ScrollViewContext: React.Context<Value> = React.createContext(null);
16
+ const ScrollViewContext: React.Context<Value> = createContext(null);
16
17
  if (__DEV__) {
17
18
  ScrollViewContext.displayName = 'ScrollViewContext';
18
19
  }
@@ -42,7 +42,7 @@ export type ScrollViewNativeProps = $ReadOnly<{
42
42
  directionalLockEnabled?: ?boolean,
43
43
  disableIntervalMomentum?: ?boolean,
44
44
  endFillColor?: ?ColorValue,
45
- fadingEdgeLength?: ?number,
45
+ fadingEdgeLength?: ?number | {start: number, end: number},
46
46
  indicatorStyle?: ?('default' | 'black' | 'white'),
47
47
  isInvertedVirtualizedList?: ?boolean,
48
48
  keyboardDismissMode?: ?('none' | 'on-drag' | 'interactive'),
@@ -16,7 +16,14 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
16
16
  import Platform from '../../Utilities/Platform';
17
17
  import useMergeRefs from '../../Utilities/useMergeRefs';
18
18
  import * as React from 'react';
19
- import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
19
+ import {
20
+ cloneElement,
21
+ useCallback,
22
+ useEffect,
23
+ useMemo,
24
+ useRef,
25
+ useState,
26
+ } from 'react';
20
27
 
21
28
  export type ScrollViewStickyHeaderProps = $ReadOnly<{
22
29
  children?: React.Node,
@@ -36,10 +43,16 @@ interface Instance extends React.ElementRef<typeof Animated.View> {
36
43
  +setNextHeaderY: number => void;
37
44
  }
38
45
 
39
- const ScrollViewStickyHeaderWithForwardedRef: component(
46
+ const ScrollViewStickyHeader: component(
40
47
  ref: React.RefSetter<Instance>,
41
48
  ...props: ScrollViewStickyHeaderProps
42
- ) = React.forwardRef(function ScrollViewStickyHeader(props, forwardedRef) {
49
+ ) = function ScrollViewStickyHeader({
50
+ ref: forwardedRef,
51
+ ...props
52
+ }: {
53
+ ref?: React.RefSetter<Instance>,
54
+ ...ScrollViewStickyHeaderProps,
55
+ }) {
43
56
  const {
44
57
  inverted,
45
58
  scrollViewHeight,
@@ -289,13 +302,13 @@ const ScrollViewStickyHeaderWithForwardedRef: component(
289
302
  passthroughAnimatedPropExplicitValues={
290
303
  passthroughAnimatedPropExplicitValues
291
304
  }>
292
- {React.cloneElement(child, {
305
+ {cloneElement(child, {
293
306
  style: styles.fill, // We transfer the child style to the wrapper.
294
307
  onLayout: undefined, // we call this manually through our this._onLayout
295
308
  })}
296
309
  </Animated.View>
297
310
  );
298
- });
311
+ };
299
312
 
300
313
  const styles = StyleSheet.create({
301
314
  header: {
@@ -306,4 +319,4 @@ const styles = StyleSheet.create({
306
319
  },
307
320
  });
308
321
 
309
- export default ScrollViewStickyHeaderWithForwardedRef;
322
+ export default ScrollViewStickyHeader;
@@ -165,7 +165,13 @@ type SwitchRef = React.ElementRef<
165
165
  const Switch: component(
166
166
  ref?: React.RefSetter<SwitchRef>,
167
167
  ...props: SwitchProps
168
- ) = React.forwardRef(function Switch(props, forwardedRef): React.Node {
168
+ ) = function Switch({
169
+ ref: forwardedRef,
170
+ ...props
171
+ }: {
172
+ ref?: React.RefSetter<SwitchRef>,
173
+ ...SwitchProps,
174
+ }): React.Node {
169
175
  const {
170
176
  disabled,
171
177
  ios_backgroundColor,
@@ -285,6 +291,6 @@ const Switch: component(
285
291
  />
286
292
  );
287
293
  }
288
- });
294
+ };
289
295
 
290
296
  export default Switch;
@@ -165,7 +165,13 @@ type SwitchRef = React.ElementRef<
165
165
  const Switch: component(
166
166
  ref?: React.RefSetter<SwitchRef>,
167
167
  ...props: SwitchProps
168
- ) = React.forwardRef(function Switch(props, forwardedRef): React.Node {
168
+ ) = function Switch({
169
+ ref: forwardedRef,
170
+ ...props
171
+ }: {
172
+ ref?: React.RefSetter<SwitchRef>,
173
+ ...SwitchProps,
174
+ }): React.Node {
169
175
  const {
170
176
  disabled,
171
177
  focusable, // [Windows]
@@ -298,6 +304,6 @@ const Switch: component(
298
304
  />
299
305
  );
300
306
  }
301
- });
307
+ };
302
308
 
303
309
  export default Switch;
@@ -10,11 +10,7 @@
10
10
 
11
11
  import type {HostComponent} from '../../../src/private/types/HostComponent';
12
12
  import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
13
- import type {
14
- ColorValue,
15
- TextStyleProp,
16
- ViewStyleProp,
17
- } from '../../StyleSheet/StyleSheet';
13
+ import type {ColorValue, TextStyleProp} from '../../StyleSheet/StyleSheet';
18
14
  import type {
19
15
  BubblingEventHandler,
20
16
  DirectEventHandler,
@@ -16,11 +16,7 @@ import type {
16
16
  } from '../../Types/CoreEventTypes';
17
17
  import type {ViewProps} from '../View/ViewPropTypes';
18
18
 
19
- import {
20
- type ColorValue,
21
- type TextStyleProp,
22
- type ViewStyleProp,
23
- } from '../../StyleSheet/StyleSheet';
19
+ import {type ColorValue, type TextStyleProp} from '../../StyleSheet/StyleSheet';
24
20
  import * as React from 'react';
25
21
 
26
22
  /**
@@ -18,14 +18,9 @@ import type {
18
18
  } from '../../Types/CoreEventTypes';
19
19
  import type {ViewProps} from '../View/ViewPropTypes';
20
20
 
21
+ import {type ColorValue, type TextStyleProp} from '../../StyleSheet/StyleSheet';
21
22
  import type {HandledKeyboardEvent} from '../View/ViewPropTypes'; // Windows
22
23
 
23
- import {
24
- type ColorValue,
25
- type TextStyleProp,
26
- type ViewStyleProp,
27
- } from '../../StyleSheet/StyleSheet';
28
-
29
24
  import * as React from 'react';
30
25
 
31
26
  /**
@@ -60,7 +60,7 @@ import TextInputState from './TextInputState';
60
60
  import invariant from 'invariant';
61
61
  import nullthrows from 'nullthrows';
62
62
  import * as React from 'react';
63
- import {useCallback, useLayoutEffect, useRef, useState} from 'react';
63
+ import {useCallback, useLayoutEffect, useMemo, useRef, useState} from 'react';
64
64
 
65
65
  let AndroidTextInput;
66
66
  let AndroidTextInputCommands;
@@ -578,7 +578,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
578
578
  rejectResponderTermination,
579
579
  } = props;
580
580
 
581
- const config = React.useMemo(
581
+ const config = useMemo(
582
582
  () => ({
583
583
  hitSlop,
584
584
  onPress: (event: GestureResponderEvent) => {
@@ -871,27 +871,28 @@ const autoCompleteWebToTextContentTypeMap = {
871
871
  username: 'username',
872
872
  };
873
873
 
874
- const ExportedForwardRef: component(
874
+ const TextInput: component(
875
875
  ref?: React.RefSetter<TextInputInstance>,
876
876
  ...props: React.ElementConfig<typeof InternalTextInput>
877
- ) = React.forwardRef(function TextInput(
878
- {
879
- allowFontScaling = true,
880
- rejectResponderTermination = true,
881
- underlineColorAndroid = 'transparent',
882
- autoComplete,
883
- textContentType,
884
- readOnly,
885
- editable,
886
- enterKeyHint,
887
- returnKeyType,
888
- inputMode,
889
- showSoftInputOnFocus,
890
- keyboardType,
891
- ...restProps
892
- },
893
- forwardedRef: React.RefSetter<TextInputInstance>,
894
- ) {
877
+ ) = function TextInput({
878
+ ref: forwardedRef,
879
+ allowFontScaling = true,
880
+ rejectResponderTermination = true,
881
+ underlineColorAndroid = 'transparent',
882
+ autoComplete,
883
+ textContentType,
884
+ readOnly,
885
+ editable,
886
+ enterKeyHint,
887
+ returnKeyType,
888
+ inputMode,
889
+ showSoftInputOnFocus,
890
+ keyboardType,
891
+ ...restProps
892
+ }: {
893
+ ref?: React.RefSetter<TextInputInstance>,
894
+ ...React.ElementConfig<typeof InternalTextInput>,
895
+ }) {
895
896
  return (
896
897
  <InternalTextInput
897
898
  allowFontScaling={allowFontScaling}
@@ -930,12 +931,12 @@ const ExportedForwardRef: component(
930
931
  forwardedRef={forwardedRef}
931
932
  />
932
933
  );
933
- });
934
+ };
934
935
 
935
- ExportedForwardRef.displayName = 'TextInput';
936
+ TextInput.displayName = 'TextInput';
936
937
 
937
938
  // $FlowFixMe[prop-missing]
938
- ExportedForwardRef.State = {
939
+ TextInput.State = {
939
940
  currentlyFocusedInput: TextInputState.currentlyFocusedInput,
940
941
 
941
942
  currentlyFocusedField: TextInputState.currentlyFocusedField,
@@ -964,4 +965,4 @@ const verticalAlignToTextAlignVerticalMap = {
964
965
  };
965
966
 
966
967
  // $FlowFixMe[unclear-type] Unclear type. Using `any` type is not safe.
967
- export default ExportedForwardRef as any as TextInputType;
968
+ export default TextInput as any as TextInputType;
@@ -64,7 +64,7 @@ import TextInputState from './TextInputState';
64
64
  import invariant from 'invariant';
65
65
  import nullthrows from 'nullthrows';
66
66
  import * as React from 'react';
67
- import {useCallback, useLayoutEffect, useRef, useState} from 'react';
67
+ import {useCallback, useLayoutEffect, useMemo, useRef, useState} from 'react';
68
68
 
69
69
  let AndroidTextInput;
70
70
  let AndroidTextInputCommands;
@@ -472,6 +472,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
472
472
  */
473
473
  if (instance != null) {
474
474
  // $FlowFixMe[prop-missing] - See the explanation above.
475
+ // $FlowFixMe[unsafe-object-assign] - Intentional mutation of ref instance
475
476
  Object.assign(instance, {
476
477
  clear(): void {
477
478
  if (inputRef.current != null) {
@@ -613,7 +614,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
613
614
  rejectResponderTermination,
614
615
  } = props;
615
616
 
616
- const config = React.useMemo(
617
+ const config = useMemo(
617
618
  () => ({
618
619
  hitSlop,
619
620
  onPress: (event: GestureResponderEvent) => {
@@ -1016,27 +1017,28 @@ const autoCompleteWebToTextContentTypeMap = {
1016
1017
  username: 'username',
1017
1018
  };
1018
1019
 
1019
- const ExportedForwardRef: component(
1020
+ const TextInput: component(
1020
1021
  ref?: React.RefSetter<TextInputInstance>,
1021
1022
  ...props: React.ElementConfig<typeof InternalTextInput>
1022
- ) = React.forwardRef(function TextInput(
1023
- {
1024
- allowFontScaling = true,
1025
- rejectResponderTermination = true,
1026
- underlineColorAndroid = 'transparent',
1027
- autoComplete,
1028
- textContentType,
1029
- readOnly,
1030
- editable,
1031
- enterKeyHint,
1032
- returnKeyType,
1033
- inputMode,
1034
- showSoftInputOnFocus,
1035
- keyboardType,
1036
- ...restProps
1037
- },
1038
- forwardedRef: React.RefSetter<TextInputInstance>,
1039
- ) {
1023
+ ) = function TextInput({
1024
+ ref: forwardedRef,
1025
+ allowFontScaling = true,
1026
+ rejectResponderTermination = true,
1027
+ underlineColorAndroid = 'transparent',
1028
+ autoComplete,
1029
+ textContentType,
1030
+ readOnly,
1031
+ editable,
1032
+ enterKeyHint,
1033
+ returnKeyType,
1034
+ inputMode,
1035
+ showSoftInputOnFocus,
1036
+ keyboardType,
1037
+ ...restProps
1038
+ }: {
1039
+ ref?: React.RefSetter<TextInputInstance>,
1040
+ ...React.ElementConfig<typeof InternalTextInput>,
1041
+ }) {
1040
1042
  return (
1041
1043
  <InternalTextInput
1042
1044
  allowFontScaling={allowFontScaling}
@@ -1074,12 +1076,12 @@ const ExportedForwardRef: component(
1074
1076
  forwardedRef={forwardedRef}
1075
1077
  />
1076
1078
  );
1077
- });
1079
+ };
1078
1080
 
1079
- ExportedForwardRef.displayName = 'TextInput';
1081
+ TextInput.displayName = 'TextInput';
1080
1082
 
1081
1083
  // $FlowFixMe[prop-missing]
1082
- ExportedForwardRef.State = {
1084
+ TextInput.State = {
1083
1085
  currentlyFocusedInput: TextInputState.currentlyFocusedInput,
1084
1086
 
1085
1087
  currentlyFocusedField: TextInputState.currentlyFocusedField,
@@ -1108,4 +1110,4 @@ const verticalAlignToTextAlignVerticalMap = {
1108
1110
  };
1109
1111
 
1110
1112
  // $FlowFixMe[unclear-type] Unclear type. Using `any` type is not safe.
1111
- export default ExportedForwardRef as any as TextInputType;
1113
+ export default TextInput as any as TextInputType;
@@ -10,11 +10,7 @@
10
10
 
11
11
  import type {HostComponent} from '../../../src/private/types/HostComponent';
12
12
  import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
13
- import type {
14
- ColorValue,
15
- TextStyleProp,
16
- ViewStyleProp,
17
- } from '../../StyleSheet/StyleSheet';
13
+ import type {ColorValue, TextStyleProp} from '../../StyleSheet/StyleSheet';
18
14
  import type {
19
15
  BubblingEventHandler,
20
16
  DirectEventHandler,
@@ -221,9 +221,15 @@ class TouchableBounce extends React.Component<
221
221
  }
222
222
  }
223
223
 
224
- export default (React.forwardRef((props, hostRef: React.RefSetter<mixed>) => (
225
- <TouchableBounce {...props} hostRef={hostRef} />
226
- )): component(
224
+ export default (function TouchableBounceWrapper({
225
+ ref: hostRef,
226
+ ...props
227
+ }: {
228
+ ref: React.RefSetter<mixed>,
229
+ ...$ReadOnly<Omit<TouchableBounceProps, 'hostRef'>>,
230
+ }) {
231
+ return <TouchableBounce {...props} hostRef={hostRef} />;
232
+ } as component(
227
233
  ref: React.RefSetter<mixed>,
228
234
  ...props: $ReadOnly<Omit<TouchableBounceProps, 'hostRef'>>
229
235
  ));