@office-iss/react-native-win32 0.76.2 → 0.77.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 (248) hide show
  1. package/.eslintignore +1 -1
  2. package/.flowconfig +5 -1
  3. package/CHANGELOG.json +164 -53
  4. package/CHANGELOG.md +74 -28
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
  7. package/Libraries/Animated/AnimatedEvent.js +1 -1
  8. package/Libraries/Animated/AnimatedImplementation.js +2 -2
  9. package/Libraries/Animated/NativeAnimatedAllowlist.js +20 -9
  10. package/Libraries/Animated/animations/Animation.js +60 -25
  11. package/Libraries/Animated/animations/DecayAnimation.js +26 -38
  12. package/Libraries/Animated/animations/SpringAnimation.js +33 -39
  13. package/Libraries/Animated/animations/TimingAnimation.js +34 -42
  14. package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
  15. package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
  16. package/Libraries/Animated/createAnimatedComponent.js +60 -33
  17. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  18. package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
  19. package/Libraries/Animated/nodes/AnimatedNode.js +39 -45
  20. package/Libraries/Animated/nodes/AnimatedObject.js +13 -3
  21. package/Libraries/Animated/nodes/AnimatedProps.js +96 -46
  22. package/Libraries/Animated/nodes/AnimatedStyle.js +108 -39
  23. package/Libraries/Animated/nodes/AnimatedTransform.js +56 -23
  24. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  25. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -3
  26. package/Libraries/Animated/useAnimatedProps.js +41 -35
  27. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
  28. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +77 -5
  29. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +82 -5
  30. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +4 -4
  31. package/Libraries/Components/Button.js +9 -4
  32. package/Libraries/Components/Button.win32.js +12 -4
  33. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
  34. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -0
  35. package/Libraries/Components/Pressable/Pressable.js +4 -4
  36. package/Libraries/Components/Pressable/Pressable.win32.js +4 -4
  37. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +13 -7
  38. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +3 -2
  39. package/Libraries/Components/SafeAreaView/SafeAreaView.js +4 -4
  40. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -4
  41. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
  42. package/Libraries/Components/ScrollView/ScrollView.js +49 -88
  43. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  44. package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -0
  45. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
  46. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +8 -9
  47. package/Libraries/Components/Switch/Switch.js +8 -6
  48. package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
  49. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +4 -4
  50. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +6 -4
  51. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -1
  52. package/Libraries/Components/TextInput/TextInput.d.ts +27 -4
  53. package/Libraries/Components/TextInput/TextInput.flow.js +36 -19
  54. package/Libraries/Components/TextInput/TextInput.js +37 -13
  55. package/Libraries/Components/TextInput/TextInput.win32.js +40 -15
  56. package/Libraries/Components/TextInput/TextInputState.js +11 -13
  57. package/Libraries/Components/TextInput/TextInputState.win32.js +13 -16
  58. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +3 -0
  59. package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
  60. package/Libraries/Components/Touchable/Position.js +7 -2
  61. package/Libraries/Components/Touchable/Touchable.js +4 -0
  62. package/Libraries/Components/Touchable/Touchable.win32.js +4 -0
  63. package/Libraries/Components/Touchable/TouchableBounce.js +6 -2
  64. package/Libraries/Components/Touchable/TouchableHighlight.js +5 -5
  65. package/Libraries/Components/Touchable/TouchableOpacity.js +6 -5
  66. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
  67. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -1
  68. package/Libraries/Components/View/View.js +4 -4
  69. package/Libraries/Components/View/View.win32.js +4 -4
  70. package/Libraries/Components/View/ViewNativeComponent.js +6 -98
  71. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  72. package/Libraries/Components/View/ViewPropTypes.js +0 -3
  73. package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
  74. package/Libraries/Components/View/ViewWin32.js +1 -0
  75. package/Libraries/Core/ExceptionsManager.js +50 -29
  76. package/Libraries/Core/ReactNativeVersion.js +3 -3
  77. package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -1
  78. package/Libraries/Core/setUpBatchedBridge.js +1 -10
  79. package/Libraries/Core/setUpDeveloperTools.js +1 -5
  80. package/Libraries/Core/setUpErrorHandling.js +20 -18
  81. package/Libraries/Core/setUpReactDevTools.js +107 -8
  82. package/Libraries/Core/setUpSegmentFetcher.js +1 -0
  83. package/Libraries/Core/setUpTimers.js +21 -18
  84. package/Libraries/Debugging/DebuggingOverlay.js +4 -5
  85. package/Libraries/Image/AssetSourceResolver.js +12 -1
  86. package/Libraries/Image/Image.android.js +1 -5
  87. package/Libraries/Image/Image.d.ts +20 -29
  88. package/Libraries/Image/Image.ios.js +0 -2
  89. package/Libraries/Image/Image.win32.js +0 -2
  90. package/Libraries/Image/ImageBackground.js +2 -5
  91. package/Libraries/Image/ImageProps.js +7 -6
  92. package/Libraries/Image/ImageResizeMode.d.ts +8 -1
  93. package/Libraries/Image/ImageResizeMode.js +4 -1
  94. package/Libraries/Image/ImageSource.d.ts +0 -2
  95. package/Libraries/Image/ImageSource.js +0 -2
  96. package/Libraries/Image/ImageTypes.flow.js +11 -9
  97. package/Libraries/Image/ImageUtils.js +6 -3
  98. package/Libraries/Image/ImageViewNativeComponent.js +5 -3
  99. package/Libraries/Inspector/Inspector.js +1 -0
  100. package/Libraries/Inspector/Inspector.win32.js +2 -1
  101. package/Libraries/Inspector/NetworkOverlay.js +4 -0
  102. package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -14
  103. package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +3 -5
  104. package/Libraries/Interaction/InteractionManager.js +6 -1
  105. package/Libraries/Interaction/InteractionManagerStub.js +176 -0
  106. package/Libraries/Interaction/TouchHistoryMath.js +22 -19
  107. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  108. package/Libraries/Lists/FlatList.d.ts +1 -2
  109. package/Libraries/Lists/FlatList.js +2 -2
  110. package/Libraries/Lists/SectionListModern.js +7 -7
  111. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +2 -2
  112. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
  113. package/Libraries/LogBox/Data/LogBoxData.js +3 -3
  114. package/Libraries/LogBox/LogBox.js +18 -5
  115. package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
  116. package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
  117. package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
  118. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
  119. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
  120. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
  121. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -1
  122. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +1 -1
  123. package/Libraries/LogBox/UI/LogBoxMessage.js +2 -2
  124. package/Libraries/Modal/Modal.d.ts +12 -0
  125. package/Libraries/Modal/Modal.js +31 -4
  126. package/Libraries/NativeComponent/BaseViewConfig.android.js +72 -1
  127. package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -1
  128. package/Libraries/NativeComponent/BaseViewConfig.win32.js +3 -11
  129. package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -3
  130. package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -1
  131. package/Libraries/Network/XHRInterceptor.js +63 -14
  132. package/Libraries/Network/XMLHttpRequest.js +26 -1
  133. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
  134. package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
  135. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -4
  136. package/Libraries/Pressability/HoverState.js +2 -0
  137. package/Libraries/Pressability/HoverState.win32.js +2 -0
  138. package/Libraries/Pressability/Pressability.js +2 -3
  139. package/Libraries/Pressability/Pressability.win32.js +2 -3
  140. package/Libraries/Pressability/usePressability.js +4 -1
  141. package/Libraries/ReactNative/AppContainer.js +1 -1
  142. package/Libraries/ReactNative/AppRegistry.js +1 -11
  143. package/Libraries/ReactNative/DisplayMode.js +1 -1
  144. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -3
  145. package/Libraries/ReactNative/RendererImplementation.js +18 -17
  146. package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -3
  147. package/Libraries/ReactNative/renderApplication.js +9 -8
  148. package/Libraries/ReactNative/requireNativeComponent.js +5 -2
  149. package/Libraries/Renderer/shims/ReactFabric.js +3 -3
  150. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  151. package/Libraries/Renderer/shims/ReactNative.js +3 -3
  152. package/Libraries/Renderer/shims/ReactNativeTypes.js +22 -35
  153. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +5 -6
  154. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  155. package/Libraries/StyleSheet/StyleSheet.js +7 -1
  156. package/Libraries/StyleSheet/StyleSheet.win32.js +7 -1
  157. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +13 -2
  158. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -6
  159. package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
  160. package/Libraries/StyleSheet/processTransform.js +3 -34
  161. package/Libraries/Text/Text.js +248 -249
  162. package/Libraries/Text/Text.win32.js +282 -295
  163. package/Libraries/Text/TextNativeComponent.js +0 -1
  164. package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
  165. package/Libraries/Types/CoreEventTypes.d.ts +3 -10
  166. package/Libraries/Types/CoreEventTypes.js +4 -6
  167. package/Libraries/Types/CoreEventTypes.win32.js +4 -6
  168. package/Libraries/Utilities/Appearance.js +3 -1
  169. package/Libraries/Utilities/BackHandler.android.js +6 -18
  170. package/Libraries/Utilities/BackHandler.d.ts +0 -4
  171. package/Libraries/Utilities/BackHandler.ios.js +0 -7
  172. package/Libraries/Utilities/BackHandler.win32.js +6 -18
  173. package/Libraries/Utilities/FocusManager.win32.js +1 -1
  174. package/Libraries/Utilities/HMRClient.js +3 -4
  175. package/Libraries/Utilities/Platform.flow.js +2 -2
  176. package/Libraries/Utilities/Platform.flow.win32.js +3 -2
  177. package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
  178. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  179. package/Libraries/Utilities/useMergeRefs.js +26 -7
  180. package/Libraries/WebSocket/WebSocketEvent.js +4 -1
  181. package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
  182. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -5
  183. package/Libraries/promiseRejectionTrackingOptions.js +1 -1
  184. package/index.js +10 -3
  185. package/index.win32.js +10 -3
  186. package/jest/setup.js +36 -1
  187. package/overrides.json +37 -37
  188. package/package.json +20 -20
  189. package/src/private/animated/NativeAnimatedHelper.js +18 -16
  190. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -15
  191. package/src/private/animated/useAnimatedPropsMemo.js +348 -0
  192. package/src/private/components/HScrollViewNativeComponents.js +1 -27
  193. package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +11 -8
  194. package/src/private/components/VScrollViewNativeComponents.js +2 -25
  195. package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
  196. package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
  197. package/src/private/debugging/ReactDevToolsSettingsManager.win32.js +20 -0
  198. package/src/private/{fusebox → debugging}/setUpFuseboxReactDevToolsDispatcher.js +6 -0
  199. package/src/private/devmenu/DevMenu.d.ts +20 -0
  200. package/src/private/devmenu/DevMenu.js +31 -0
  201. package/src/private/featureflags/ReactNativeFeatureFlags.js +95 -86
  202. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +8 -2
  203. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -19
  204. package/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js +34 -0
  205. package/src/private/setup/setUpDOM.js +14 -6
  206. package/src/private/setup/setUpMutationObserver.js +5 -0
  207. package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
  208. package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
  209. package/src/private/specs/modules/NativeAccessibilityInfo.js +9 -0
  210. package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +9 -0
  211. package/src/private/specs/modules/NativeAccessibilityManager.js +4 -0
  212. package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
  213. package/src/private/specs/modules/NativeAppearance.js +4 -10
  214. package/src/private/specs/modules/NativeExceptionsManager.js +0 -12
  215. package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
  216. package/src/private/webapis/dom/geometry/DOMRect.js +2 -2
  217. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +2 -2
  218. package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -3
  219. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +102 -11
  220. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
  221. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
  222. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  223. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
  224. package/src/private/webapis/performance/EventTiming.js +13 -8
  225. package/src/private/webapis/performance/Performance.js +66 -73
  226. package/src/private/webapis/performance/PerformanceEntry.js +2 -5
  227. package/src/private/webapis/performance/PerformanceObserver.js +65 -164
  228. package/src/private/webapis/performance/RawPerformanceEntry.js +1 -1
  229. package/src/private/webapis/performance/UserTiming.js +11 -7
  230. package/src/private/webapis/performance/Utilities.js +18 -0
  231. package/src/private/webapis/performance/specs/NativePerformance.js +71 -2
  232. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +267 -0
  233. package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
  234. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  235. package/types/index.d.ts +1 -1
  236. package/types/public/ReactNativeTypes.d.ts +4 -8
  237. package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
  238. package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
  239. package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
  240. package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +0 -35
  241. package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
  242. package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
  243. package/src/private/components/useSyncOnScroll.js +0 -48
  244. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +0 -61
  245. package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +0 -67
  246. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +0 -127
  247. package/types/experimental.d.ts +0 -59
  248. /package/src/private/{fusebox → debugging}/FuseboxSessionObserver.js +0 -0
@@ -33,257 +33,173 @@ type TextForwardRef = React.ElementRef<
33
33
  *
34
34
  * @see https://reactnative.dev/docs/text
35
35
  */
36
- const Text: React.AbstractComponent<TextProps, TextForwardRef> =
37
- React.forwardRef(
38
- (
39
- {
40
- accessible,
41
- accessibilityControls, // Win32
42
- accessibilityDescribedBy, // Win32
43
- accessibilityDescription, // Win32
44
- accessibilityLabel,
45
- accessibilityLevel, // Win32
46
- accessibilityPositionInSet, // Win32
47
- accessibilitySetSize, // Win32
48
- accessibilityState,
49
- allowFontScaling,
50
- 'aria-busy': ariaBusy,
51
- 'aria-checked': ariaChecked,
52
- 'aria-controls': ariaControls, // Win32
53
- 'aria-describedby': ariaDescribedBy, // Win32
54
- 'aria-description': ariaDescription, // Win32
55
- 'aria-disabled': ariaDisabled,
56
- 'aria-expanded': ariaExpanded,
57
- 'aria-label': ariaLabel,
58
- 'aria-level': ariaLevel, // Win32
59
- 'aria-multiselectable': ariaMultiselectable, // Win32
60
- 'aria-posinset': ariaPosinset, // Win32
61
- 'aria-required': ariaRequired, // Win32
62
- 'aria-selected': ariaSelected,
63
- 'aria-setsize': ariaSetsize, // Win32
64
- children,
65
- ellipsizeMode,
66
- disabled,
67
- id,
68
- nativeID,
69
- numberOfLines,
70
- onLongPress,
71
- onPress,
72
- onPressIn,
73
- onPressOut,
74
- onResponderGrant,
75
- onResponderMove,
76
- onResponderRelease,
77
- onResponderTerminate,
78
- onResponderTerminationRequest,
79
- onStartShouldSetResponder,
80
- pressRetentionOffset,
81
- selectable,
82
- selectionColor,
83
- suppressHighlighting,
84
- style,
85
- ...restProps
86
- }: TextProps,
87
- forwardedRef,
88
- ) => {
89
- const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
90
- const _accessibilityControls = ariaControls ?? accessibilityControls; // Win32
91
- const _accessibilityDescribedBy =
92
- ariaDescribedBy ?? accessibilityDescribedBy; // Win32
93
- const _accessibilityDescription =
94
- ariaDescription ?? accessibilityDescription; // Win32
95
- const _accessibilityLevel = ariaLevel ?? accessibilityLevel; // Win32
96
- const _accessibilityPositionInSet =
97
- ariaPosinset ?? accessibilityPositionInSet; // Win32
98
- const _accessibilitySetSize = ariaSetsize ?? accessibilitySetSize; // Win32
99
-
100
- let _accessibilityState: ?TextProps['accessibilityState'] =
101
- accessibilityState;
102
- if (
103
- ariaBusy != null ||
104
- ariaChecked != null ||
105
- ariaDisabled != null ||
106
- ariaExpanded != null ||
107
- ariaSelected != null
108
- ) {
109
- if (_accessibilityState != null) {
110
- _accessibilityState = {
111
- busy: ariaBusy ?? _accessibilityState.busy,
112
- checked: ariaChecked ?? _accessibilityState.checked,
113
- disabled: ariaDisabled ?? _accessibilityState.disabled,
114
- expanded: ariaExpanded ?? _accessibilityState.expanded,
115
- multiselectable:
116
- ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
117
- required: ariaRequired ?? accessibilityState?.required, // Win32
118
- selected: ariaSelected ?? _accessibilityState.selected,
119
- };
120
- } else {
121
- _accessibilityState = {
122
- busy: ariaBusy,
123
- checked: ariaChecked,
124
- disabled: ariaDisabled,
125
- expanded: ariaExpanded,
126
- multiselectable: ariaMultiselectable, // Win32,
127
- required: ariaRequired, // Win32
128
- selected: ariaSelected,
129
- };
130
- }
36
+ const Text: component(
37
+ ref: React.RefSetter<TextForwardRef>,
38
+ ...props: TextProps
39
+ ) = React.forwardRef(
40
+ (
41
+ {
42
+ accessible,
43
+ accessibilityControls, // Win32
44
+ accessibilityDescribedBy, // Win32
45
+ accessibilityDescription, // Win32
46
+ accessibilityLabel,
47
+ accessibilityLevel, // Win32
48
+ accessibilityPositionInSet, // Win32
49
+ accessibilitySetSize, // Win32
50
+ accessibilityState,
51
+ allowFontScaling,
52
+ 'aria-busy': ariaBusy,
53
+ 'aria-checked': ariaChecked,
54
+ 'aria-controls': ariaControls, // Win32
55
+ 'aria-describedby': ariaDescribedBy, // Win32
56
+ 'aria-description': ariaDescription, // Win32
57
+ 'aria-disabled': ariaDisabled,
58
+ 'aria-expanded': ariaExpanded,
59
+ 'aria-label': ariaLabel,
60
+ 'aria-level': ariaLevel, // Win32
61
+ 'aria-multiselectable': ariaMultiselectable, // Win32
62
+ 'aria-posinset': ariaPosinset, // Win32
63
+ 'aria-required': ariaRequired, // Win32
64
+ 'aria-selected': ariaSelected,
65
+ 'aria-setsize': ariaSetsize, // Win32
66
+ children,
67
+ ellipsizeMode,
68
+ disabled,
69
+ id,
70
+ nativeID,
71
+ numberOfLines,
72
+ onLongPress,
73
+ onPress,
74
+ onPressIn,
75
+ onPressOut,
76
+ onResponderGrant,
77
+ onResponderMove,
78
+ onResponderRelease,
79
+ onResponderTerminate,
80
+ onResponderTerminationRequest,
81
+ onStartShouldSetResponder,
82
+ pressRetentionOffset,
83
+ selectable,
84
+ selectionColor,
85
+ suppressHighlighting,
86
+ style,
87
+ ...restProps
88
+ }: TextProps,
89
+ forwardedRef,
90
+ ) => {
91
+ const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
92
+ const _accessibilityControls = ariaControls ?? accessibilityControls; // Win32
93
+ const _accessibilityDescribedBy =
94
+ ariaDescribedBy ?? accessibilityDescribedBy; // Win32
95
+ const _accessibilityDescription =
96
+ ariaDescription ?? accessibilityDescription; // Win32
97
+ const _accessibilityLevel = ariaLevel ?? accessibilityLevel; // Win32
98
+ const _accessibilityPositionInSet =
99
+ ariaPosinset ?? accessibilityPositionInSet; // Win32
100
+ const _accessibilitySetSize = ariaSetsize ?? accessibilitySetSize; // Win32
101
+
102
+ let _accessibilityState: ?TextProps['accessibilityState'] =
103
+ accessibilityState;
104
+ if (
105
+ ariaBusy != null ||
106
+ ariaChecked != null ||
107
+ ariaDisabled != null ||
108
+ ariaExpanded != null ||
109
+ ariaSelected != null
110
+ ) {
111
+ if (_accessibilityState != null) {
112
+ _accessibilityState = {
113
+ busy: ariaBusy ?? _accessibilityState.busy,
114
+ checked: ariaChecked ?? _accessibilityState.checked,
115
+ disabled: ariaDisabled ?? _accessibilityState.disabled,
116
+ expanded: ariaExpanded ?? _accessibilityState.expanded,
117
+ multiselectable:
118
+ ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
119
+ required: ariaRequired ?? accessibilityState?.required, // Win32
120
+ selected: ariaSelected ?? _accessibilityState.selected,
121
+ };
122
+ } else {
123
+ _accessibilityState = {
124
+ busy: ariaBusy,
125
+ checked: ariaChecked,
126
+ disabled: ariaDisabled,
127
+ expanded: ariaExpanded,
128
+ multiselectable: ariaMultiselectable, // Win32,
129
+ required: ariaRequired, // Win32
130
+ selected: ariaSelected,
131
+ };
131
132
  }
133
+ }
132
134
 
133
- const _accessibilityStateDisabled = _accessibilityState?.disabled;
134
- const _disabled = disabled ?? _accessibilityStateDisabled;
135
+ const _accessibilityStateDisabled = _accessibilityState?.disabled;
136
+ const _disabled = disabled ?? _accessibilityStateDisabled;
135
137
 
136
- const isPressable =
137
- (onPress != null ||
138
- onLongPress != null ||
139
- onStartShouldSetResponder != null) &&
140
- _disabled !== true;
138
+ const isPressable =
139
+ (onPress != null ||
140
+ onLongPress != null ||
141
+ onStartShouldSetResponder != null) &&
142
+ _disabled !== true;
141
143
 
142
- // TODO: Move this processing to the view configuration.
143
- const _selectionColor =
144
- selectionColor == null ? null : processColor(selectionColor);
144
+ // TODO: Move this processing to the view configuration.
145
+ const _selectionColor =
146
+ selectionColor != null ? processColor(selectionColor) : undefined;
145
147
 
146
- let _style = style;
147
- if (__DEV__) {
148
- if (PressabilityDebug.isEnabled() && onPress != null) {
149
- _style = [style, {color: 'magenta'}];
150
- }
148
+ let _style = style;
149
+ if (__DEV__) {
150
+ if (PressabilityDebug.isEnabled() && onPress != null) {
151
+ _style = [style, {color: 'magenta'}];
151
152
  }
153
+ }
152
154
 
153
- let _numberOfLines = numberOfLines;
154
- if (_numberOfLines != null && !(_numberOfLines >= 0)) {
155
- if (__DEV__) {
156
- console.error(
157
- `'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
158
- );
159
- }
160
- _numberOfLines = 0;
155
+ let _numberOfLines = numberOfLines;
156
+ if (_numberOfLines != null && !(_numberOfLines >= 0)) {
157
+ if (__DEV__) {
158
+ console.error(
159
+ `'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
160
+ );
161
161
  }
162
+ _numberOfLines = 0;
163
+ }
162
164
 
163
- let _selectable = selectable;
164
-
165
- let processedStyle = flattenStyle<TextStyleProp>(_style);
166
- if (processedStyle != null) {
167
- let overrides: ?{...TextStyleInternal} = null;
168
- if (typeof processedStyle.fontWeight === 'number') {
169
- overrides = overrides || ({}: {...TextStyleInternal});
170
- overrides.fontWeight =
171
- // $FlowFixMe[incompatible-cast]
172
- (processedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']);
173
- }
174
-
175
- if (processedStyle.userSelect != null) {
176
- _selectable = userSelectToSelectableMap[processedStyle.userSelect];
177
- overrides = overrides || ({}: {...TextStyleInternal});
178
- overrides.userSelect = undefined;
179
- }
180
-
181
- if (processedStyle.verticalAlign != null) {
182
- overrides = overrides || ({}: {...TextStyleInternal});
183
- overrides.textAlignVertical =
184
- verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
185
- overrides.verticalAlign = undefined;
186
- }
165
+ let _selectable = selectable;
187
166
 
188
- if (overrides != null) {
189
- // $FlowFixMe[incompatible-type]
190
- _style = [_style, overrides];
191
- }
167
+ let processedStyle = flattenStyle<TextStyleProp>(_style);
168
+ if (processedStyle != null) {
169
+ let overrides: ?{...TextStyleInternal} = null;
170
+ if (typeof processedStyle.fontWeight === 'number') {
171
+ overrides = overrides || ({}: {...TextStyleInternal});
172
+ overrides.fontWeight =
173
+ // $FlowFixMe[incompatible-cast]
174
+ (processedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']);
192
175
  }
193
176
 
194
- const _nativeID = id ?? nativeID;
195
-
196
- const hasTextAncestor = useContext(TextAncestor);
197
- if (hasTextAncestor) {
198
- if (isPressable) {
199
- return (
200
- <NativePressableVirtualText
201
- ref={forwardedRef}
202
- textProps={{
203
- ...restProps,
204
- accessibilityLabel: _accessibilityLabel,
205
- accessibilityState: _accessibilityState,
206
- accessibilityControls: _accessibilityControls, // Win32
207
- accessibilityDescribedBy: _accessibilityDescribedBy, // Win32
208
- accessibilityDescription: _accessibilityDescription, // Win32
209
- accessibilityLevel: _accessibilityLevel, // Win32
210
- accessibilityPositionInSet: _accessibilityPositionInSet, // Win32
211
- accessibilitySetSize: _accessibilitySetSize, // Win32
212
- nativeID: _nativeID,
213
- numberOfLines: _numberOfLines,
214
- selectable: _selectable,
215
- selectionColor: _selectionColor,
216
- style: _style,
217
- disabled: disabled,
218
- children,
219
- }}
220
- textPressabilityProps={{
221
- onLongPress,
222
- onPress,
223
- onPressIn,
224
- onPressOut,
225
- onResponderGrant,
226
- onResponderMove,
227
- onResponderRelease,
228
- onResponderTerminate,
229
- onResponderTerminationRequest,
230
- onStartShouldSetResponder,
231
- pressRetentionOffset,
232
- suppressHighlighting,
233
- }}
234
- />
235
- );
236
- }
177
+ if (processedStyle.userSelect != null) {
178
+ _selectable = userSelectToSelectableMap[processedStyle.userSelect];
179
+ overrides = overrides || ({}: {...TextStyleInternal});
180
+ overrides.userSelect = undefined;
181
+ }
237
182
 
238
- return (
239
- <NativeVirtualText
240
- {...restProps}
241
- accessibilityLabel={_accessibilityLabel}
242
- accessibilityState={_accessibilityState}
243
- accessibilityControls={_accessibilityControls} // Win32
244
- accessibilityDescribedBy={_accessibilityDescribedBy} // Win32
245
- accessibilityDescription={_accessibilityDescription} // Win32
246
- accessibilityLevel={_accessibilityLevel} // Win32
247
- accessibilityPositionInSet={_accessibilityPositionInSet} // Win32
248
- accessibilitySetSize={_accessibilitySetSize} // Win32
249
- isHighlighted={false}
250
- isPressable={false}
251
- nativeID={_nativeID}
252
- numberOfLines={_numberOfLines}
253
- ref={forwardedRef}
254
- selectable={_selectable}
255
- selectionColor={_selectionColor}
256
- style={_style}
257
- disabled={disabled}>
258
- {children}
259
- </NativeVirtualText>
260
- );
183
+ if (processedStyle.verticalAlign != null) {
184
+ overrides = overrides || ({}: {...TextStyleInternal});
185
+ overrides.textAlignVertical =
186
+ verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
187
+ overrides.verticalAlign = undefined;
261
188
  }
262
189
 
263
- // If the disabled prop and accessibilityState.disabled are out of sync but not both in
264
- // falsy states we need to update the accessibilityState object to use the disabled prop.
265
- if (
266
- _disabled !== _accessibilityStateDisabled &&
267
- ((_disabled != null && _disabled !== false) ||
268
- (_accessibilityStateDisabled != null &&
269
- _accessibilityStateDisabled !== false))
270
- ) {
271
- _accessibilityState = {..._accessibilityState, disabled: _disabled};
190
+ if (overrides != null) {
191
+ // $FlowFixMe[incompatible-type]
192
+ _style = [_style, overrides];
272
193
  }
194
+ }
273
195
 
274
- const _accessible = Platform.select({
275
- ios: accessible !== false,
276
- android:
277
- accessible == null
278
- ? onPress != null || onLongPress != null
279
- : accessible,
280
- default: accessible !== false, // Win32
281
- });
196
+ const _nativeID = id ?? nativeID;
282
197
 
283
- let nativeText = null;
198
+ const hasTextAncestor = useContext(TextAncestor);
199
+ if (hasTextAncestor) {
284
200
  if (isPressable) {
285
- nativeText = (
286
- <NativePressableText
201
+ return (
202
+ <NativePressableVirtualText
287
203
  ref={forwardedRef}
288
204
  textProps={{
289
205
  ...restProps,
@@ -295,15 +211,12 @@ const Text: React.AbstractComponent<TextProps, TextForwardRef> =
295
211
  accessibilityLevel: _accessibilityLevel, // Win32
296
212
  accessibilityPositionInSet: _accessibilityPositionInSet, // Win32
297
213
  accessibilitySetSize: _accessibilitySetSize, // Win32
298
- accessible: _accessible,
299
- allowFontScaling: allowFontScaling !== false,
300
- disabled: _disabled,
301
- ellipsizeMode: ellipsizeMode ?? 'tail',
302
214
  nativeID: _nativeID,
303
215
  numberOfLines: _numberOfLines,
304
216
  selectable: _selectable,
305
217
  selectionColor: _selectionColor,
306
218
  style: _style,
219
+ disabled: disabled,
307
220
  children,
308
221
  }}
309
222
  textPressabilityProps={{
@@ -322,64 +235,138 @@ const Text: React.AbstractComponent<TextProps, TextForwardRef> =
322
235
  }}
323
236
  />
324
237
  );
325
- } else {
326
- nativeText = (
327
- <NativeText
328
- {...restProps}
329
- accessibilityLabel={_accessibilityLabel}
330
- accessibilityState={_accessibilityState}
331
- accessibilityControls={_accessibilityControls} // Win32
332
- accessibilityDescribedBy={_accessibilityDescribedBy} // Win32
333
- accessibilityDescription={_accessibilityDescription} // Win32
334
- accessibilityLevel={_accessibilityLevel} // Win32
335
- accessibilityPositionInSet={_accessibilityPositionInSet} // Win32
336
- accessibilitySetSize={_accessibilitySetSize} // Win32
337
- accessible={_accessible}
338
- allowFontScaling={allowFontScaling !== false}
339
- disabled={_disabled}
340
- ellipsizeMode={ellipsizeMode ?? 'tail'}
341
- isHighlighted={false}
342
- nativeID={_nativeID}
343
- numberOfLines={_numberOfLines}
344
- ref={forwardedRef}
345
- selectable={_selectable}
346
- selectionColor={_selectionColor}
347
- style={_style}>
348
- {children}
349
- </NativeText>
350
- );
351
238
  }
352
239
 
353
- if (children == null) {
354
- return nativeText;
355
- }
240
+ return (
241
+ <NativeVirtualText
242
+ {...restProps}
243
+ accessibilityLabel={_accessibilityLabel}
244
+ accessibilityState={_accessibilityState}
245
+ accessibilityControls={_accessibilityControls} // Win32
246
+ accessibilityDescribedBy={_accessibilityDescribedBy} // Win32
247
+ accessibilityDescription={_accessibilityDescription} // Win32
248
+ accessibilityLevel={_accessibilityLevel} // Win32
249
+ accessibilityPositionInSet={_accessibilityPositionInSet} // Win32
250
+ accessibilitySetSize={_accessibilitySetSize} // Win32
251
+ nativeID={_nativeID}
252
+ numberOfLines={_numberOfLines}
253
+ ref={forwardedRef}
254
+ selectable={_selectable}
255
+ selectionColor={_selectionColor}
256
+ style={_style}
257
+ disabled={disabled}>
258
+ {children}
259
+ </NativeVirtualText>
260
+ );
261
+ }
356
262
 
357
- // If the children do not contain a JSX element it would not be possible to have a
358
- // nested `Text` component so we can skip adding the `TextAncestor` context wrapper
359
- // which has a performance overhead. Since we do this for performance reasons we need
360
- // to keep the check simple to avoid regressing overall perf. For this reason the
361
- // `children.length` constant is set to `3`, this should be a reasonable tradeoff
362
- // to capture the majority of `Text` uses but also not make this check too expensive.
363
- if (Array.isArray(children) && children.length <= 3) {
364
- let hasNonTextChild = false;
365
- for (let child of children) {
366
- if (child != null && typeof child === 'object') {
367
- hasNonTextChild = true;
368
- break;
369
- }
370
- }
371
- if (!hasNonTextChild) {
372
- return nativeText;
263
+ // If the disabled prop and accessibilityState.disabled are out of sync but not both in
264
+ // falsy states we need to update the accessibilityState object to use the disabled prop.
265
+ if (
266
+ _disabled !== _accessibilityStateDisabled &&
267
+ ((_disabled != null && _disabled !== false) ||
268
+ (_accessibilityStateDisabled != null &&
269
+ _accessibilityStateDisabled !== false))
270
+ ) {
271
+ _accessibilityState = {..._accessibilityState, disabled: _disabled};
272
+ }
273
+
274
+ const _accessible = Platform.select({
275
+ ios: accessible !== false,
276
+ android:
277
+ accessible == null
278
+ ? onPress != null || onLongPress != null
279
+ : accessible,
280
+ default: accessible !== false, // [Windows #13996 - default value is accessible !== false]
281
+ });
282
+
283
+ let nativeText = null;
284
+ if (isPressable) {
285
+ nativeText = (
286
+ <NativePressableText
287
+ ref={forwardedRef}
288
+ textProps={{
289
+ ...restProps,
290
+ accessibilityLabel: _accessibilityLabel,
291
+ accessibilityState: _accessibilityState,
292
+ accessible: _accessible,
293
+ allowFontScaling: allowFontScaling !== false,
294
+ disabled: _disabled,
295
+ ellipsizeMode: ellipsizeMode ?? 'tail',
296
+ nativeID: _nativeID,
297
+ numberOfLines: _numberOfLines,
298
+ selectable: _selectable,
299
+ selectionColor: _selectionColor,
300
+ style: _style,
301
+ children,
302
+ }}
303
+ textPressabilityProps={{
304
+ onLongPress,
305
+ onPress,
306
+ onPressIn,
307
+ onPressOut,
308
+ onResponderGrant,
309
+ onResponderMove,
310
+ onResponderRelease,
311
+ onResponderTerminate,
312
+ onResponderTerminationRequest,
313
+ onStartShouldSetResponder,
314
+ pressRetentionOffset,
315
+ suppressHighlighting,
316
+ }}
317
+ />
318
+ );
319
+ } else {
320
+ nativeText = (
321
+ <NativeText
322
+ {...restProps}
323
+ accessibilityLabel={_accessibilityLabel}
324
+ accessibilityState={_accessibilityState}
325
+ accessible={_accessible}
326
+ allowFontScaling={allowFontScaling !== false}
327
+ disabled={_disabled}
328
+ ellipsizeMode={ellipsizeMode ?? 'tail'}
329
+ nativeID={_nativeID}
330
+ numberOfLines={_numberOfLines}
331
+ ref={forwardedRef}
332
+ selectable={_selectable}
333
+ selectionColor={_selectionColor}
334
+ style={_style}>
335
+ {children}
336
+ </NativeText>
337
+ );
338
+ }
339
+
340
+ if (children == null) {
341
+ return nativeText;
342
+ }
343
+
344
+ // If the children do not contain a JSX element it would not be possible to have a
345
+ // nested `Text` component so we can skip adding the `TextAncestor` context wrapper
346
+ // which has a performance overhead. Since we do this for performance reasons we need
347
+ // to keep the check simple to avoid regressing overall perf. For this reason the
348
+ // `children.length` constant is set to `3`, this should be a reasonable tradeoff
349
+ // to capture the majority of `Text` uses but also not make this check too expensive.
350
+ if (Array.isArray(children) && children.length <= 3) {
351
+ let hasNonTextChild = false;
352
+ for (let child of children) {
353
+ if (child != null && typeof child === 'object') {
354
+ hasNonTextChild = true;
355
+ break;
373
356
  }
374
- } else if (typeof children !== 'object') {
357
+ }
358
+ if (!hasNonTextChild) {
375
359
  return nativeText;
376
360
  }
361
+ } else if (typeof children !== 'object') {
362
+ return nativeText;
363
+ }
377
364
 
378
- return (
379
- <TextAncestor.Provider value={true}>{nativeText}</TextAncestor.Provider>
380
- );
381
- },
382
- );
365
+ return (
366
+ <TextAncestor.Provider value={true}>{nativeText}</TextAncestor.Provider>
367
+ );
368
+ },
369
+ );
383
370
 
384
371
  Text.displayName = 'Text';
385
372
 
@@ -528,10 +515,10 @@ type NativePressableTextProps = $ReadOnly<{
528
515
  * This logic is split out from the main Text component to enable the more
529
516
  * expensive pressability logic to be only initialized when needed.
530
517
  */
531
- const NativePressableVirtualText: React.AbstractComponent<
532
- NativePressableTextProps,
533
- TextForwardRef,
534
- > = React.forwardRef(({textProps, textPressabilityProps}, forwardedRef) => {
518
+ const NativePressableVirtualText: component(
519
+ ref: React.RefSetter<TextForwardRef>,
520
+ ...props: NativePressableTextProps
521
+ ) = React.forwardRef(({textProps, textPressabilityProps}, forwardedRef) => {
535
522
  const [isHighlighted, eventHandlersForText] = useTextPressability(
536
523
  textPressabilityProps,
537
524
  );
@@ -553,10 +540,10 @@ const NativePressableVirtualText: React.AbstractComponent<
553
540
  * This logic is split out from the main Text component to enable the more
554
541
  * expensive pressability logic to be only initialized when needed.
555
542
  */
556
- const NativePressableText: React.AbstractComponent<
557
- NativePressableTextProps,
558
- TextForwardRef,
559
- > = React.forwardRef(({textProps, textPressabilityProps}, forwardedRef) => {
543
+ const NativePressableText: component(
544
+ ref: React.RefSetter<TextForwardRef>,
545
+ ...props: NativePressableTextProps
546
+ ) = React.forwardRef(({textProps, textPressabilityProps}, forwardedRef) => {
560
547
  const [isHighlighted, eventHandlersForText] = useTextPressability(
561
548
  textPressabilityProps,
562
549
  );
@@ -16,7 +16,6 @@ import type {TextProps} from './TextProps';
16
16
  import {createViewConfig} from '../NativeComponent/ViewConfig';
17
17
  import UIManager from '../ReactNative/UIManager';
18
18
  import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
19
- import Platform from '../Utilities/Platform';
20
19
 
21
20
  export type NativeTextProps = $ReadOnly<{
22
21
  ...TextProps,