react-native-windows 0.84.0 → 0.85.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 (461) hide show
  1. package/.flowconfig +1 -5
  2. package/Directory.Build.props +1 -16
  3. package/Directory.Build.targets +12 -4
  4. package/Folly/ThreadNameStub.cpp +4 -6
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +3 -3
  6. package/Libraries/Animated/Animated.d.ts +8 -1
  7. package/Libraries/Animated/AnimatedEvent.js +4 -4
  8. package/Libraries/Animated/AnimatedImplementation.js +2 -2
  9. package/Libraries/Animated/animations/Animation.js +3 -3
  10. package/Libraries/Animated/animations/DecayAnimation.js +4 -4
  11. package/Libraries/Animated/animations/SpringAnimation.js +5 -5
  12. package/Libraries/Animated/animations/TimingAnimation.js +5 -5
  13. package/Libraries/Animated/createAnimatedComponent.js +7 -7
  14. package/Libraries/Animated/nodes/AnimatedColor.js +2 -2
  15. package/Libraries/Animated/nodes/AnimatedInterpolation.js +12 -12
  16. package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
  17. package/Libraries/Animated/nodes/AnimatedObject.js +3 -3
  18. package/Libraries/Animated/nodes/AnimatedProps.js +6 -6
  19. package/Libraries/Animated/nodes/AnimatedStyle.js +7 -7
  20. package/Libraries/Animated/nodes/AnimatedTransform.js +13 -13
  21. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  22. package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
  23. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
  24. package/Libraries/Animated/useAnimatedColor.d.ts +15 -0
  25. package/Libraries/Animated/useAnimatedColor.js +25 -0
  26. package/Libraries/Animated/useAnimatedValueXY.d.ts +15 -0
  27. package/Libraries/Animated/useAnimatedValueXY.js +26 -0
  28. package/Libraries/AppState/AppState.js +1 -1
  29. package/Libraries/BatchedBridge/MessageQueue.js +3 -3
  30. package/Libraries/BatchedBridge/NativeModules.js +12 -10
  31. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +30 -26
  32. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +34 -30
  33. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +2 -2
  34. package/Libraries/Components/Button.js +2 -2
  35. package/Libraries/Components/Button.windows.js +2 -2
  36. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +2 -2
  37. package/Libraries/Components/Keyboard/Keyboard.js +6 -6
  38. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -1
  39. package/Libraries/Components/LayoutConformance/LayoutConformance.js +1 -1
  40. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  41. package/Libraries/Components/Pressable/Pressable.d.ts +5 -0
  42. package/Libraries/Components/Pressable/Pressable.js +3 -3
  43. package/Libraries/Components/Pressable/Pressable.windows.js +3 -3
  44. package/Libraries/Components/Pressable/useAndroidRippleForView.js +4 -4
  45. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +1 -1
  46. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +3 -3
  47. package/Libraries/Components/RefreshControl/RefreshControl.js +5 -5
  48. package/Libraries/Components/RefreshControl/RefreshControl.windows.js +5 -5
  49. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +8 -12
  50. package/Libraries/Components/ScrollView/ScrollView.d.ts +9 -0
  51. package/Libraries/Components/ScrollView/ScrollView.js +19 -9
  52. package/Libraries/Components/ScrollView/ScrollView.windows.js +19 -9
  53. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +8 -18
  54. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.windows.js +8 -18
  55. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +4 -3
  56. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  57. package/Libraries/Components/StaticRenderer.js +1 -1
  58. package/Libraries/Components/StatusBar/StatusBar.js +8 -8
  59. package/Libraries/Components/Switch/Switch.js +3 -3
  60. package/Libraries/Components/Switch/Switch.windows.js +3 -3
  61. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +33 -48
  62. package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
  63. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +6 -11
  64. package/Libraries/Components/TextInput/TextInput.flow.js +21 -20
  65. package/Libraries/Components/TextInput/TextInput.flow.windows.js +23 -22
  66. package/Libraries/Components/TextInput/TextInput.js +8 -4
  67. package/Libraries/Components/TextInput/TextInput.windows.js +3 -4
  68. package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +33 -48
  69. package/Libraries/Components/Touchable/PooledClass.js +1 -1
  70. package/Libraries/Components/Touchable/Touchable.js +2 -2
  71. package/Libraries/Components/Touchable/Touchable.windows.js +2 -2
  72. package/Libraries/Components/Touchable/TouchableBounce.js +4 -4
  73. package/Libraries/Components/Touchable/TouchableBounce.windows.js +4 -4
  74. package/Libraries/Components/Touchable/TouchableHighlight.js +8 -8
  75. package/Libraries/Components/Touchable/TouchableHighlight.windows.js +9 -9
  76. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +7 -7
  77. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +7 -7
  78. package/Libraries/Components/Touchable/TouchableOpacity.js +4 -4
  79. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +4 -4
  80. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -1
  81. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -1
  82. package/Libraries/Components/UnimplementedViews/UnimplementedView.js +1 -1
  83. package/Libraries/Components/View/ReactNativeStyleAttributes.js +68 -31
  84. package/Libraries/Components/View/View.windows.js +1 -1
  85. package/Libraries/Components/View/ViewAccessibility.js +7 -7
  86. package/Libraries/Components/View/ViewAccessibility.windows.js +7 -7
  87. package/Libraries/Components/View/ViewPropTypes.js +14 -14
  88. package/Libraries/Components/View/ViewPropTypes.windows.js +18 -16
  89. package/Libraries/Core/Devtools/parseHermesStack.js +8 -8
  90. package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -2
  91. package/Libraries/Core/ExceptionsManager.js +2 -2
  92. package/Libraries/Core/ExtendedError.js +3 -3
  93. package/Libraries/Core/RawEventEmitter.js +1 -1
  94. package/Libraries/Core/ReactNativeVersion.js +2 -2
  95. package/Libraries/Core/Timers/JSTimers.js +3 -2
  96. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  97. package/Libraries/Core/setUpErrorHandling.js +4 -2
  98. package/Libraries/Core/setUpReactDevTools.js +23 -6
  99. package/Libraries/Core/setUpSegmentFetcher.js +1 -1
  100. package/Libraries/Debugging/DebuggingOverlay.js +2 -2
  101. package/Libraries/EventEmitter/NativeEventEmitter.js +7 -9
  102. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +1 -1
  103. package/Libraries/Image/AssetSourceResolver.js +1 -1
  104. package/Libraries/Image/AssetSourceResolver.windows.js +1 -1
  105. package/Libraries/Image/Image.android.js +172 -306
  106. package/Libraries/Image/ImageProps.js +9 -11
  107. package/Libraries/Image/ImageSource.js +2 -2
  108. package/Libraries/Image/ImageSourceUtils.js +8 -4
  109. package/Libraries/Image/ImageTypes.flow.js +2 -2
  110. package/Libraries/Image/ImageViewNativeComponent.js +7 -16
  111. package/Libraries/Image/nativeImageSource.js +1 -1
  112. package/Libraries/Interaction/InteractionManager.js +5 -4
  113. package/Libraries/Interaction/PanResponder.js +1 -1
  114. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  115. package/Libraries/Linking/Linking.js +1 -1
  116. package/Libraries/Lists/FlatList.js +3 -3
  117. package/Libraries/Lists/SectionList.js +1 -1
  118. package/Libraries/Lists/SectionListModern.js +2 -2
  119. package/Libraries/LogBox/Data/LogBoxData.js +38 -24
  120. package/Libraries/LogBox/Data/LogBoxLog.js +43 -112
  121. package/Libraries/LogBox/Data/parseLogBoxLog.js +21 -117
  122. package/Libraries/LogBox/LogBox.js +42 -19
  123. package/Libraries/LogBox/LogBoxInspectorContainer.js +2 -2
  124. package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
  125. package/Libraries/LogBox/UI/LogBoxButton.js +14 -16
  126. package/Libraries/LogBox/UI/LogBoxInspector.js +2 -2
  127. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -9
  128. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.windows.js +6 -9
  129. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -1
  130. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +1 -1
  131. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
  132. package/Libraries/LogBox/UI/LogBoxInspectorHeader.windows.js +1 -1
  133. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +1 -1
  134. package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +10 -15
  135. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +25 -18
  136. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.windows.js +15 -16
  137. package/Libraries/LogBox/UI/LogBoxInspectorSection.js +5 -7
  138. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +8 -10
  139. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +8 -6
  140. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.windows.js +3 -5
  141. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +17 -29
  142. package/Libraries/LogBox/UI/LogBoxMessage.js +28 -37
  143. package/Libraries/LogBox/UI/LogBoxNotification.js +1 -1
  144. package/Libraries/Modal/Modal.d.ts +4 -0
  145. package/Libraries/Modal/Modal.js +3 -3
  146. package/Libraries/Modal/Modal.windows.js +7 -3
  147. package/Libraries/NativeComponent/BaseViewConfig.android.js +28 -52
  148. package/Libraries/NativeComponent/BaseViewConfig.ios.js +19 -21
  149. package/Libraries/NativeComponent/BaseViewConfig.windows.js +26 -17
  150. package/Libraries/Network/RCTNetworking.android.js +1 -1
  151. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  152. package/Libraries/Network/RCTNetworking.js.flow +1 -1
  153. package/Libraries/Network/RCTNetworking.windows.js +1 -1
  154. package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +1 -1
  155. package/Libraries/Network/XMLHttpRequest.js +1 -1
  156. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -3
  157. package/Libraries/Pressability/Pressability.js +5 -5
  158. package/Libraries/Pressability/Pressability.windows.js +5 -5
  159. package/Libraries/Pressability/PressabilityDebug.js +1 -1
  160. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
  161. package/Libraries/Pressability/usePressability.js +3 -14
  162. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
  163. package/Libraries/ReactNative/AppContainer-dev.js +18 -1
  164. package/Libraries/ReactNative/AppContainer.js +1 -1
  165. package/Libraries/ReactNative/AppRegistry.flow.js +2 -2
  166. package/Libraries/ReactNative/AppRegistryImpl.js +2 -2
  167. package/Libraries/ReactNative/FabricUIManager.js +1 -1
  168. package/Libraries/ReactNative/RendererImplementation.js +4 -4
  169. package/Libraries/ReactNative/UIManagerProperties.js +1 -1
  170. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +3 -2
  171. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -2
  172. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -2
  173. package/Libraries/Renderer/shims/ReactFabric.js +1 -3
  174. package/Libraries/Renderer/shims/ReactFeatureFlags.js +1 -3
  175. package/Libraries/Renderer/shims/ReactNative.js +3 -2
  176. package/Libraries/Renderer/shims/ReactNativeTypes.js +1 -3
  177. package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +1 -3
  178. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +1 -3
  179. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +1 -3
  180. package/Libraries/StyleSheet/PointPropType.js +1 -1
  181. package/Libraries/StyleSheet/Rect.js +1 -1
  182. package/Libraries/StyleSheet/StyleSheet.d.ts +0 -5
  183. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  184. package/Libraries/StyleSheet/StyleSheet.js.flow +1 -1
  185. package/Libraries/StyleSheet/StyleSheetExports.js +16 -25
  186. package/Libraries/StyleSheet/StyleSheetExports.js.flow +2 -7
  187. package/Libraries/StyleSheet/StyleSheetTypes.js +33 -35
  188. package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +5 -5
  189. package/Libraries/StyleSheet/private/_TransformStyle.js +7 -7
  190. package/Libraries/StyleSheet/processBackgroundImage.js +7 -7
  191. package/Libraries/StyleSheet/processBackgroundPosition.js +4 -4
  192. package/Libraries/StyleSheet/processBackgroundRepeat.js +4 -4
  193. package/Libraries/StyleSheet/processBackgroundSize.js +4 -4
  194. package/Libraries/StyleSheet/processBoxShadow.js +44 -4
  195. package/Libraries/StyleSheet/processColorArray.js +2 -2
  196. package/Libraries/StyleSheet/processFilter.js +2 -2
  197. package/Libraries/Text/Text.js +295 -627
  198. package/Libraries/Text/Text.windows.js +342 -717
  199. package/Libraries/Text/TextNativeComponent.js +14 -7
  200. package/Libraries/Text/TextProps.js +4 -4
  201. package/Libraries/Text/TextProps.windows.js +4 -4
  202. package/Libraries/Types/CodegenTypes.js +1 -1
  203. package/Libraries/Types/CoreEventTypes.js +21 -21
  204. package/Libraries/Types/CoreEventTypes.windows.js +21 -21
  205. package/Libraries/Types/ReactDevToolsTypes.js +2 -2
  206. package/Libraries/Utilities/Appearance.js +6 -1
  207. package/Libraries/Utilities/Dimensions.js +1 -1
  208. package/Libraries/Utilities/HMRClient.js +32 -5
  209. package/Libraries/Utilities/IPerformanceLogger.js +4 -4
  210. package/Libraries/Utilities/codegenNativeCommands.js +4 -4
  211. package/Libraries/Utilities/codegenNativeComponent.d.ts +2 -0
  212. package/Libraries/Utilities/codegenNativeComponent.js +2 -2
  213. package/Libraries/Utilities/logError.js +1 -1
  214. package/Libraries/Utilities/stringifySafe.js +3 -3
  215. package/Libraries/Utilities/useMergeRefs.js +2 -2
  216. package/Libraries/vendor/core/ErrorUtils.js +4 -4
  217. package/Libraries/vendor/emitter/EventEmitter.js +16 -20
  218. package/Microsoft.ReactNative/CallInvoker.cpp +14 -4
  219. package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +1 -1
  220. package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +2 -2
  221. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +1 -1
  222. package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.cpp +73 -97
  223. package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.h +4 -1
  224. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +0 -1
  225. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +4 -4
  226. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +135 -18
  227. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +10 -0
  228. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +7 -2
  229. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +2 -0
  230. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +63 -15
  231. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +3 -1
  232. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +1 -1
  233. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +1 -1
  234. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +11 -0
  235. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +1 -0
  236. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +3 -0
  237. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +0 -3
  238. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +2 -7
  239. package/Microsoft.ReactNative/IReactPackageBuilder.idl +6 -0
  240. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -61
  241. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +1 -26
  242. package/Microsoft.ReactNative/Modules/AlertModule.cpp +2 -1
  243. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +2 -17
  244. package/Microsoft.ReactNative/Modules/AppStateModule.h +0 -4
  245. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +0 -2
  246. package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +16 -15
  247. package/Microsoft.ReactNative/Modules/AppearanceModule.h +5 -1
  248. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +2 -7
  249. package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +0 -1
  250. package/Microsoft.ReactNative/Modules/I18nManagerModule.h +4 -4
  251. package/Microsoft.ReactNative/QuirkSettings.cpp +0 -133
  252. package/Microsoft.ReactNative/QuirkSettings.h +0 -43
  253. package/Microsoft.ReactNative/QuirkSettings.idl +0 -41
  254. package/Microsoft.ReactNative/ReactHost/CrashManager.cpp +0 -4
  255. package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -2
  256. package/Microsoft.ReactNative/ReactHost/React.h +0 -5
  257. package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +0 -1
  258. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +3 -26
  259. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +0 -5
  260. package/Microsoft.ReactNative/ReactHost/React_Win.h +0 -2
  261. package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +3 -0
  262. package/Microsoft.ReactNative/ReactPackageBuilder.cpp +7 -0
  263. package/Microsoft.ReactNative/ReactPackageBuilder.h +1 -0
  264. package/Microsoft.ReactNative/RedBox.cpp +0 -9
  265. package/Microsoft.ReactNative/RedBoxHandler.cpp +0 -4
  266. package/Microsoft.ReactNative/TurboModulesProvider.cpp +5 -10
  267. package/Microsoft.ReactNative/TurboModulesProvider.h +2 -0
  268. package/Microsoft.ReactNative/Utils/ValueUtils.cpp +1 -1
  269. package/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h +0 -7
  270. package/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +0 -22
  271. package/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp +8 -2
  272. package/Microsoft.ReactNative.Cxx/ModuleRegistration.h +36 -20
  273. package/Microsoft.ReactNative.Cxx/NamespaceRedirect.h +0 -3
  274. package/Microsoft.ReactNative.Cxx/NativeModules.h +8 -2
  275. package/Microsoft.ReactNative.Cxx/XamlUtils.h +0 -9
  276. package/Microsoft.ReactNative.Managed/ReactContext.cs +0 -9
  277. package/PropertySheets/Autolink.props +1 -1
  278. package/PropertySheets/Bundle.props +1 -1
  279. package/PropertySheets/Codegen.props +1 -1
  280. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  281. package/PropertySheets/NuGet.LockFile.props +8 -0
  282. package/PropertySheets/React.Cpp.props +4 -4
  283. package/PropertySheets/ReactNativeArchitecture.props +6 -24
  284. package/ReactCommon/ReactCommon.vcxproj +5 -6
  285. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +1 -1
  286. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +15 -4
  287. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +13 -0
  288. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/defaults/DefaultTurboModules.cpp +69 -0
  289. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/animationbackend/AnimatedPropSerializer.cpp +717 -0
  290. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +10 -10
  291. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +2 -21
  292. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/TouchEventEmitter.cpp +151 -0
  293. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/TouchEventEmitter.h +50 -0
  294. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mapbuffer/MapBuffer.cpp +178 -0
  295. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +69 -39
  296. package/Scripts/OfficeReact.Win32.nuspec +0 -1
  297. package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +4 -39
  298. package/Scripts/creaternwapp.cmd +1 -9
  299. package/Scripts/creaternwlib.cmd +4 -24
  300. package/Shared/DevSettings.h +0 -3
  301. package/Shared/Networking/WinRTWebSocketResource.cpp +23 -408
  302. package/Shared/Networking/WinRTWebSocketResource.h +3 -119
  303. package/Shared/Shared.vcxitems +63 -38
  304. package/Shared/Shared.vcxitems.filters +54 -0
  305. package/Shared/Utils.cpp +0 -88
  306. package/Shared/Utils.h +0 -14
  307. package/Shared/WebSocketResourceFactory.cpp +28 -0
  308. package/Shared/tracing/fbsystrace.h +1 -0
  309. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +172 -160
  310. package/codegen/react/components/rnwcore/ModalHostView.g.h +8 -0
  311. package/codegen/react/components/rnwcore/Props.cpp +17 -7
  312. package/codegen/react/components/rnwcore/Props.h +3 -1
  313. package/codegen/react/components/rnwcore/VirtualViewExperimental.g.h +4 -4
  314. package/codegen/rnwcoreJSI.h +93 -77
  315. package/index.js +9 -0
  316. package/index.windows.js +9 -0
  317. package/jest/RefreshControlMock.js +2 -2
  318. package/jest/assetFileTransformer.js +8 -3
  319. package/jest/mockComponent.js +3 -4
  320. package/jest/mockNativeComponent.js +1 -1
  321. package/jest/mocks/ActivityIndicator.js +2 -2
  322. package/jest/mocks/Image.js +2 -2
  323. package/jest/mocks/Modal.js +2 -2
  324. package/jest/mocks/RefreshControl.js +3 -3
  325. package/jest/mocks/RendererProxy.js +2 -2
  326. package/jest/mocks/ScrollView.js +5 -5
  327. package/jest/mocks/Text.js +2 -2
  328. package/jest/mocks/TextInput.js +2 -2
  329. package/jest/mocks/View.js +2 -2
  330. package/jest/mocks/ViewNativeComponent.js +1 -1
  331. package/jest/mocks/requireNativeComponent.js +1 -1
  332. package/jest/mocks/useColorScheme.js +1 -1
  333. package/jest/setup.js +68 -31
  334. package/package.json +27 -22
  335. package/src/private/animated/NativeAnimatedHelper.js +2 -2
  336. package/src/private/animated/createAnimatedPropsMemoHook.js +19 -19
  337. package/src/private/components/virtualview/VirtualView.js +14 -21
  338. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +11 -10
  339. package/src/private/components/virtualview/VirtualViewNativeComponent.js +4 -4
  340. package/src/private/devsupport/devmenu/elementinspector/BorderBox.js +2 -2
  341. package/src/private/devsupport/devmenu/elementinspector/BoxInspector.js +3 -3
  342. package/src/private/devsupport/devmenu/elementinspector/ElementBox.js +4 -4
  343. package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
  344. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +39 -17
  345. package/src/private/devsupport/devmenu/elementinspector/InspectorOverlay.js +15 -3
  346. package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +2 -2
  347. package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -8
  348. package/src/private/devsupport/devmenu/elementinspector/StyleInspector.js +1 -1
  349. package/src/private/devsupport/devmenu/elementinspector/resolveBoxStyle.js +1 -1
  350. package/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js +102 -0
  351. package/src/private/devsupport/rndevtools/FuseboxSessionObserver.js +12 -25
  352. package/src/private/devsupport/rndevtools/GlobalStateObserver.js +56 -0
  353. package/src/private/devsupport/rndevtools/TracingStateObserver.js +28 -0
  354. package/src/private/featureflags/ReactNativeFeatureFlags.js +71 -79
  355. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +2 -2
  356. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +14 -12
  357. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
  358. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  359. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +3 -3
  360. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  361. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +2 -2
  362. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +2 -2
  363. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +3 -3
  364. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  365. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  366. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  367. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +7 -3
  368. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  369. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +2 -2
  370. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  371. package/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +1 -1
  372. package/src/private/styles/composeStyles.js +1 -1
  373. package/src/private/utilities/toError.js +27 -0
  374. package/src/private/utilities/toExtendedError.js +30 -0
  375. package/src/private/webapis/dom/events/Event.js +1 -1
  376. package/src/private/webapis/dom/events/EventHandlerAttributes.js +2 -2
  377. package/src/private/webapis/dom/events/EventTarget.js +3 -3
  378. package/src/private/webapis/dom/events/internals/EventInternals.js +2 -2
  379. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  380. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +2 -2
  381. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +14 -14
  382. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +2 -2
  383. package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
  384. package/src/private/webapis/geometry/DOMRectList.js +2 -2
  385. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +8 -8
  386. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +6 -6
  387. package/src/private/webapis/mutationobserver/MutationObserver.js +2 -2
  388. package/src/private/webapis/mutationobserver/MutationRecord.js +2 -2
  389. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
  390. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +3 -3
  391. package/src/private/webapis/performance/LongTasks.js +3 -3
  392. package/src/private/webapis/performance/Performance.js +4 -4
  393. package/src/private/webapis/performance/PerformanceEntry.js +1 -1
  394. package/src/private/webapis/performance/PerformanceObserver.js +2 -2
  395. package/src/private/webapis/performance/specs/NativePerformance.js +8 -8
  396. package/src/private/webapis/structuredClone/structuredClone.js +2 -2
  397. package/src/types/globals.d.ts +4 -4
  398. package/template/cpp-lib/proj/MyLib.sln +0 -33
  399. package/template/cpp-lib/proj/MyLib.vcxproj +1 -1
  400. package/template/cs-lib/proj/MyLib.sln +0 -33
  401. package/template/metro.config.js +12 -2
  402. package/templates/cpp-app/metro.config.js +12 -2
  403. package/templates/cpp-app/windows/MyApp/MyApp.cpp +9 -6
  404. package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +1 -1
  405. package/templates/cpp-app/windows/MyApp.sln +0 -33
  406. package/templates/cpp-lib/example/metro.config.js +12 -2
  407. package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
  408. package/templates/cpp-lib/windows/MyLib.sln +0 -33
  409. package/types/index.d.ts +2 -0
  410. package/Folly/.clang-format +0 -2
  411. package/Folly/Folly.natvis +0 -25
  412. package/Folly/Folly.vcxproj +0 -378
  413. package/Folly/Folly.vcxproj.filters +0 -558
  414. package/Folly/TEMP_UntilFollyUpdate/ConstexprMath.h +0 -978
  415. package/Folly/TEMP_UntilFollyUpdate/Conv.cpp +0 -1205
  416. package/Folly/TEMP_UntilFollyUpdate/chrono/Hardware.h +0 -155
  417. package/Folly/TEMP_UntilFollyUpdate/concurrency/CacheLocality.cpp +0 -633
  418. package/Folly/TEMP_UntilFollyUpdate/json/dynamic-inl.h +0 -1438
  419. package/Folly/TEMP_UntilFollyUpdate/json/json.cpp +0 -1118
  420. package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +0 -188
  421. package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.cpp +0 -348
  422. package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +0 -182
  423. package/Folly/TEMP_UntilFollyUpdate/portability/Unistd.cpp +0 -33
  424. package/Folly/cgmanifest.json +0 -25
  425. package/Libraries/Components/View/ReactNativeViewAttributes.js +0 -60
  426. package/Libraries/Components/View/ReactNativeViewAttributes.windows.js +0 -64
  427. package/Libraries/Image/TextInlineImageNativeComponent.js +0 -49
  428. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +0 -75
  429. package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp +0 -27
  430. package/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +0 -81
  431. package/Microsoft.ReactNative/Modules/CreateModules.cpp +0 -24
  432. package/Microsoft.ReactNative/ReactSupport.cpp +0 -221
  433. package/Microsoft.ReactNative/ReactSupport.h +0 -13
  434. package/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.cpp +0 -107
  435. package/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.h +0 -62
  436. package/Microsoft.ReactNative/Utils/UwpScriptStore.cpp +0 -56
  437. package/Microsoft.ReactNative/Utils/UwpScriptStore.h +0 -23
  438. package/Microsoft.ReactNative/XamlUIService.cpp +0 -68
  439. package/Microsoft.ReactNative/XamlUIService.h +0 -37
  440. package/Microsoft.ReactNative/XamlUIService.idl +0 -53
  441. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +0 -259
  442. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/Instance.cpp +0 -381
  443. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +0 -145
  444. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/MethodCall.cpp +0 -100
  445. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ModuleRegistry.cpp +0 -256
  446. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +0 -363
  447. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/RAMBundleRegistry.cpp +0 -93
  448. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +0 -148
  449. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +0 -190
  450. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSINativeModules.cpp +0 -123
  451. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleWithJSIBindings.cpp +0 -27
  452. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/webperformance/NativePerformance.cpp +0 -414
  453. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +0 -91
  454. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +0 -80
  455. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +0 -138
  456. package/fmt/.clang-format +0 -2
  457. package/fmt/cgmanifest.json +0 -15
  458. package/fmt/fmt.vcxproj +0 -153
  459. package/fmt/fmt.vcxproj.filters +0 -59
  460. package/fmt/pch.cpp +0 -4
  461. package/fmt/pch.h +0 -2
@@ -19,9 +19,14 @@ import * as PressabilityDebug from '../Pressability/PressabilityDebug';
19
19
  import usePressability from '../Pressability/usePressability';
20
20
  import flattenStyle from '../StyleSheet/flattenStyle';
21
21
  import processColor from '../StyleSheet/processColor';
22
+ import StyleSheet from '../StyleSheet/StyleSheet';
22
23
  import Platform from '../Utilities/Platform';
23
24
  import TextAncestorContext from './TextAncestorContext';
24
- import {NativeText, NativeVirtualText} from './TextNativeComponent';
25
+ import {
26
+ NativeSelectableText,
27
+ NativeText,
28
+ NativeVirtualText,
29
+ } from './TextNativeComponent';
25
30
  import * as React from 'react';
26
31
  import {useContext, useMemo, useState} from 'react';
27
32
 
@@ -31,7 +36,7 @@ const View = require('../Components/View/View').default; // [Windows]
31
36
  import {type ViewStyleProp} from '../StyleSheet/StyleSheet'; // [Windows]
32
37
 
33
38
  type TextForwardRef = React.ElementRef<
34
- typeof NativeText | typeof NativeVirtualText,
39
+ typeof NativeText | typeof NativeVirtualText | typeof NativeSelectableText,
35
40
  >;
36
41
 
37
42
  /**
@@ -39,726 +44,350 @@ type TextForwardRef = React.ElementRef<
39
44
  *
40
45
  * @see https://reactnative.dev/docs/text
41
46
  */
42
- let _TextImpl;
43
- if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
44
- const TextImplNoDefaultProps: component(
45
- ref?: React.RefSetter<TextForwardRef>,
46
- ...props: TextProps
47
- ) = ({
48
- ref: forwardedRef,
49
- accessible,
50
- accessibilityLabel,
51
- accessibilityRole,
52
- accessibilityState,
53
- allowFontScaling,
54
- 'aria-busy': ariaBusy,
55
- 'aria-checked': ariaChecked,
56
- 'aria-disabled': ariaDisabled,
57
- 'aria-expanded': ariaExpanded,
58
- 'aria-hidden': ariaHidden,
59
- 'aria-label': ariaLabel,
47
+ const TextImpl: component(
48
+ ref?: React.RefSetter<TextForwardRef>,
49
+ ...props: TextProps
50
+ ) = ({
51
+ ref: forwardedRef,
52
+ accessible,
53
+ accessibilityLabel,
54
+ accessibilityRole,
55
+ accessibilityState,
56
+ allowFontScaling,
57
+ 'aria-busy': ariaBusy,
58
+ 'aria-checked': ariaChecked,
59
+ 'aria-disabled': ariaDisabled,
60
+ 'aria-expanded': ariaExpanded,
61
+ 'aria-hidden': ariaHidden,
62
+ 'aria-label': ariaLabel,
63
+ // #[Windows properties
64
+ 'aria-multiselectable': ariaMultiselectable,
65
+ 'aria-required': ariaRequired,
66
+ 'aria-level': ariaLevel,
67
+ 'aria-posinset': ariaPosinset,
68
+ 'aria-setsize': ariaSetsize,
69
+ 'aria-readonly': ariaReadOnly,
70
+ accessibilityLevel,
71
+ accessibilityPosInSet,
72
+ accessibilitySetSize,
73
+ // #]Windows properties
74
+ 'aria-selected': ariaSelected,
75
+ children,
76
+ ellipsizeMode,
77
+ disabled,
78
+ id,
79
+ nativeID,
80
+ numberOfLines,
81
+ onLongPress,
82
+ onPress,
83
+ onPressIn,
84
+ onPressOut,
85
+ onResponderGrant,
86
+ onResponderMove,
87
+ onResponderRelease,
88
+ onResponderTerminate,
89
+ onResponderTerminationRequest,
90
+ onStartShouldSetResponder,
91
+ pressRetentionOffset,
92
+ role,
93
+ selectable,
94
+ selectionColor,
95
+ suppressHighlighting,
96
+ style,
97
+ ...restProps
98
+ }: {
99
+ ref?: React.RefSetter<TextForwardRef>,
100
+ ...TextProps,
101
+ }) => {
102
+ const processedProps = restProps as {
103
+ ...NativeTextProps,
104
+ };
105
+ const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
106
+ // #[Windows
107
+ const _accessibilityLevel = ariaLevel ?? accessibilityLevel;
108
+ const _accessibilityPosInSet = ariaPosinset ?? accessibilityPosInSet;
109
+ const _accessibilitySetSize = ariaSetsize ?? accessibilitySetSize;
110
+ // #]Windows
111
+
112
+ let _accessibilityState: ?TextProps['accessibilityState'] =
113
+ accessibilityState;
114
+ if (
115
+ ariaBusy != null ||
116
+ ariaChecked != null ||
117
+ ariaDisabled != null ||
118
+ ariaExpanded != null ||
119
+ ariaSelected != null ||
60
120
  // #[Windows properties
61
- 'aria-multiselectable': ariaMultiselectable,
62
- 'aria-required': ariaRequired,
63
- 'aria-level': ariaLevel,
64
- 'aria-posinset': ariaPosinset,
65
- 'aria-setsize': ariaSetsize,
66
- 'aria-readonly': ariaReadOnly,
67
- accessibilityLevel,
68
- accessibilityPosInSet,
69
- accessibilitySetSize,
121
+ ariaReadOnly != null ||
122
+ ariaMultiselectable != null ||
123
+ ariaRequired != null
70
124
  // #]Windows properties
71
- 'aria-selected': ariaSelected,
72
- children,
73
- ellipsizeMode,
74
- disabled,
75
- id,
76
- nativeID,
77
- numberOfLines,
78
- onLongPress,
79
- onPress,
80
- onPressIn,
81
- onPressOut,
82
- onResponderGrant,
83
- onResponderMove,
84
- onResponderRelease,
85
- onResponderTerminate,
86
- onResponderTerminationRequest,
87
- onStartShouldSetResponder,
88
- pressRetentionOffset,
89
- role,
90
- selectable,
91
- selectionColor,
92
- suppressHighlighting,
93
- style,
94
- ...restProps
95
- }: {
96
- ref?: React.RefSetter<TextForwardRef>,
97
- ...TextProps,
98
- }) => {
99
- const processedProps = restProps as {
100
- ...NativeTextProps,
101
- };
102
- const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
103
- // #[Windows
104
- const _accessibilityLevel = ariaLevel ?? accessibilityLevel;
105
- const _accessibilityPosInSet = ariaPosinset ?? accessibilityPosInSet;
106
- const _accessibilitySetSize = ariaSetsize ?? accessibilitySetSize;
107
- // #]Windows
108
-
109
- let _accessibilityState: ?TextProps['accessibilityState'] =
110
- accessibilityState;
111
- if (
112
- ariaBusy != null ||
113
- ariaChecked != null ||
114
- ariaDisabled != null ||
115
- ariaExpanded != null ||
116
- ariaSelected != null ||
117
- // #[Windows properties
118
- ariaReadOnly != null ||
119
- ariaMultiselectable != null ||
120
- ariaRequired != null
121
- // #]Windows properties
122
- ) {
123
- if (_accessibilityState != null) {
124
- _accessibilityState = {
125
- busy: ariaBusy ?? _accessibilityState.busy,
126
- checked: ariaChecked ?? _accessibilityState.checked,
127
- disabled: ariaDisabled ?? _accessibilityState.disabled,
128
- expanded: ariaExpanded ?? _accessibilityState.expanded,
129
- selected: ariaSelected ?? _accessibilityState.selected,
130
- // #[Windows
131
- readOnly: ariaReadOnly ?? _accessibilityState.readOnly,
132
- multiselectable:
133
- ariaMultiselectable ?? _accessibilityState.multiselectable,
134
- required: ariaRequired ?? _accessibilityState.required,
135
- // #]Windows
136
- };
137
- } else {
138
- _accessibilityState = {
139
- busy: ariaBusy,
140
- checked: ariaChecked,
141
- disabled: ariaDisabled,
142
- expanded: ariaExpanded,
143
- selected: ariaSelected,
144
- // #[Windows
145
- readOnly: ariaReadOnly,
146
- multiselectable: ariaMultiselectable,
147
- required: ariaRequired,
148
- // #]Windows
149
- };
150
- }
125
+ ) {
126
+ if (_accessibilityState != null) {
127
+ _accessibilityState = {
128
+ busy: ariaBusy ?? _accessibilityState.busy,
129
+ checked: ariaChecked ?? _accessibilityState.checked,
130
+ disabled: ariaDisabled ?? _accessibilityState.disabled,
131
+ expanded: ariaExpanded ?? _accessibilityState.expanded,
132
+ selected: ariaSelected ?? _accessibilityState.selected,
133
+ // #[Windows
134
+ readOnly: ariaReadOnly ?? _accessibilityState.readOnly,
135
+ multiselectable:
136
+ ariaMultiselectable ?? _accessibilityState.multiselectable,
137
+ required: ariaRequired ?? _accessibilityState.required,
138
+ // #]Windows
139
+ };
140
+ } else {
141
+ _accessibilityState = {
142
+ busy: ariaBusy,
143
+ checked: ariaChecked,
144
+ disabled: ariaDisabled,
145
+ expanded: ariaExpanded,
146
+ selected: ariaSelected,
147
+ // #[Windows
148
+ readOnly: ariaReadOnly,
149
+ multiselectable: ariaMultiselectable,
150
+ required: ariaRequired,
151
+ // #]Windows
152
+ };
151
153
  }
152
-
153
- const _accessibilityStateDisabled = _accessibilityState?.disabled;
154
- const _disabled = disabled ?? _accessibilityStateDisabled;
155
-
156
- // If the disabled prop and accessibilityState.disabled are out of sync but not both in
157
- // falsy states we need to update the accessibilityState object to use the disabled prop.
158
- if (
159
- _accessibilityState != null &&
160
- _disabled !== _accessibilityStateDisabled &&
161
- ((_disabled != null && _disabled !== false) ||
162
- (_accessibilityStateDisabled != null &&
163
- _accessibilityStateDisabled !== false))
164
- ) {
154
+ }
155
+
156
+ const _accessibilityStateDisabled = _accessibilityState?.disabled;
157
+ const _disabled = disabled ?? _accessibilityStateDisabled;
158
+
159
+ // If the disabled prop and accessibilityState.disabled are out of sync but not both in
160
+ // falsy states we need to update the accessibilityState object to use the disabled prop.
161
+ if (
162
+ _disabled !== _accessibilityStateDisabled &&
163
+ ((_disabled != null && _disabled !== false) ||
164
+ (_accessibilityStateDisabled != null &&
165
+ _accessibilityStateDisabled !== false))
166
+ ) {
167
+ if (_accessibilityState == null) {
168
+ _accessibilityState = {disabled};
169
+ } else {
165
170
  _accessibilityState.disabled = _disabled;
166
171
  }
172
+ }
167
173
 
168
- if (ariaHidden !== undefined) {
169
- processedProps.accessibilityElementsHidden = ariaHidden;
170
- if (ariaHidden === true) {
171
- processedProps.importantForAccessibility = 'no-hide-descendants';
172
- }
174
+ if (ariaHidden !== undefined) {
175
+ processedProps.accessibilityElementsHidden = ariaHidden;
176
+ if (ariaHidden === true) {
177
+ processedProps.importantForAccessibility = 'no-hide-descendants';
173
178
  }
179
+ }
174
180
 
175
- const _accessible = Platform.select({
176
- ios: accessible !== false,
177
- android:
178
- accessible == null
179
- ? onPress != null || onLongPress != null
180
- : accessible,
181
- default: accessible !== false, // [Windows #13996 - default value is accessible !== false]
182
- });
183
-
184
- const isPressable =
185
- (onPress != null ||
186
- onLongPress != null ||
187
- onStartShouldSetResponder != null) &&
188
- _disabled !== true;
189
-
190
- const shouldUseLinkRole =
191
- ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
192
- isPressable &&
193
- accessibilityRole == null &&
194
- role == null;
195
-
196
- const _accessibilityRole =
197
- accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
198
-
199
- const _role = shouldUseLinkRole ? undefined : role;
200
-
201
- // TODO: Move this processing to the view configuration.
202
- const _selectionColor =
203
- selectionColor != null ? processColor(selectionColor) : undefined;
204
-
205
- let _style = style;
206
- if (__DEV__) {
207
- if (PressabilityDebug.isEnabled() && onPress != null) {
208
- _style = [style, {color: 'magenta'}];
209
- }
210
- }
181
+ const _accessible = Platform.select({
182
+ ios: accessible !== false,
183
+ android:
184
+ accessible == null ? onPress != null || onLongPress != null : accessible,
185
+ default: accessible !== false, // [Windows #13996 - default value is accessible !== false]
186
+ });
211
187
 
212
- let _numberOfLines = numberOfLines;
213
- if (_numberOfLines != null && !(_numberOfLines >= 0)) {
214
- if (__DEV__) {
215
- console.error(
216
- `'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
217
- );
218
- }
219
- _numberOfLines = 0;
220
- }
188
+ const isPressable =
189
+ (onPress != null ||
190
+ onLongPress != null ||
191
+ onStartShouldSetResponder != null) &&
192
+ _disabled !== true;
221
193
 
222
- let _selectable = selectable;
194
+ const shouldUseLinkRole =
195
+ isPressable && accessibilityRole == null && role == null;
223
196
 
224
- let processedStyle = flattenStyle<TextStyleProp>(_style);
225
- if (processedStyle != null) {
226
- let overrides: ?{...TextStyleInternal} = null;
227
- if (typeof processedStyle.fontWeight === 'number') {
228
- overrides = overrides || ({}: {...TextStyleInternal});
229
- overrides.fontWeight =
230
- // $FlowFixMe[incompatible-type]
231
- (String(processedStyle.fontWeight): TextStyleInternal['fontWeight']);
232
- }
197
+ const _accessibilityRole =
198
+ accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
233
199
 
234
- if (processedStyle.userSelect != null) {
235
- _selectable = userSelectToSelectableMap[processedStyle.userSelect];
236
- overrides = overrides || ({}: {...TextStyleInternal});
237
- overrides.userSelect = undefined;
238
- }
200
+ const _role = shouldUseLinkRole ? undefined : role;
239
201
 
240
- if (processedStyle.verticalAlign != null) {
241
- overrides = overrides || ({}: {...TextStyleInternal});
242
- overrides.textAlignVertical =
243
- verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
244
- overrides.verticalAlign = undefined;
245
- }
202
+ // TODO: Move this processing to the view configuration.
203
+ const _selectionColor =
204
+ selectionColor != null ? processColor(selectionColor) : undefined;
246
205
 
247
- if (overrides != null) {
248
- // $FlowFixMe[incompatible-type]
249
- _style = [_style, overrides];
250
- }
251
- }
252
-
253
- const _nativeID = id ?? nativeID;
254
-
255
- if (_accessibilityLabel !== undefined) {
256
- processedProps.accessibilityLabel = _accessibilityLabel;
257
- }
258
- if (_accessibilityRole !== undefined) {
259
- processedProps.accessibilityRole = _accessibilityRole;
260
- }
261
- if (_accessibilityState !== undefined) {
262
- processedProps.accessibilityState = _accessibilityState;
263
- }
264
- if (_nativeID !== undefined) {
265
- processedProps.nativeID = _nativeID;
266
- }
267
- if (_numberOfLines !== undefined) {
268
- processedProps.numberOfLines = _numberOfLines;
269
- }
270
- if (_selectable !== undefined) {
271
- processedProps.selectable = _selectable;
272
- }
273
- if (_style !== undefined) {
274
- processedProps.style = _style;
275
- }
276
- if (_selectionColor !== undefined) {
277
- processedProps.selectionColor = _selectionColor;
206
+ let _style = style;
207
+ if (__DEV__) {
208
+ if (PressabilityDebug.isEnabled() && onPress != null) {
209
+ _style = [style, {color: 'magenta'}];
278
210
  }
279
- if (_role !== undefined) {
280
- processedProps.role = _role;
281
- }
282
-
283
- // [Windows accessibility properties
284
- if (ariaLevel !== undefined) {
285
- processedProps.accessibilityLevel = ariaLevel;
286
- }
287
- if (ariaPosinset !== undefined) {
288
- processedProps.accessibilityPosInSet = ariaPosinset;
289
- }
290
- if (ariaSetsize !== undefined) {
291
- processedProps.accessibilitySetSize = ariaSetsize;
292
- }
293
- // ]
211
+ }
294
212
 
295
- let textPressabilityProps: ?TextPressabilityProps;
296
- if (isPressable) {
297
- textPressabilityProps = {
298
- onLongPress,
299
- onPress,
300
- onPressIn,
301
- onPressOut,
302
- onResponderGrant,
303
- onResponderMove,
304
- onResponderRelease,
305
- onResponderTerminate,
306
- onResponderTerminationRequest,
307
- onStartShouldSetResponder,
308
- pressRetentionOffset,
309
- suppressHighlighting,
310
- };
213
+ let _numberOfLines = numberOfLines;
214
+ if (_numberOfLines != null && !(_numberOfLines >= 0)) {
215
+ if (__DEV__) {
216
+ console.error(
217
+ `'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
218
+ );
311
219
  }
220
+ _numberOfLines = 0;
221
+ }
312
222
 
313
- const hasTextAncestor = useContext(TextAncestorContext);
314
- if (hasTextAncestor) {
315
- processedProps.disabled = disabled;
316
- processedProps.children = children;
317
- if (isPressable) {
318
- return (
319
- <NativePressableVirtualText
320
- ref={forwardedRef}
321
- textProps={processedProps}
322
- textPressabilityProps={textPressabilityProps ?? {}}
323
- />
324
- );
325
- }
326
- return <NativeVirtualText {...processedProps} ref={forwardedRef} />;
327
- }
223
+ let _selectable = selectable;
328
224
 
329
- let nativeText = null;
225
+ let processedStyle = flattenStyle<TextStyleProp>(_style);
226
+ if (processedStyle != null) {
227
+ let overrides: ?{...TextStyleInternal} = null;
228
+ if (typeof processedStyle.fontWeight === 'number') {
229
+ overrides = overrides || ({}: {...TextStyleInternal});
230
+ overrides.fontWeight =
231
+ // $FlowFixMe[incompatible-type]
232
+ (String(processedStyle.fontWeight): TextStyleInternal['fontWeight']);
233
+ }
234
+
235
+ if (processedStyle.userSelect != null) {
236
+ _selectable = userSelectToSelectableMap[processedStyle.userSelect];
237
+ overrides = overrides || ({}: {...TextStyleInternal});
238
+ overrides.userSelect = undefined;
239
+ }
240
+
241
+ if (processedStyle.verticalAlign != null) {
242
+ overrides = overrides || ({}: {...TextStyleInternal});
243
+ overrides.textAlignVertical =
244
+ verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
245
+ overrides.verticalAlign = undefined;
246
+ }
247
+
248
+ if (overrides != null) {
249
+ // $FlowFixMe[incompatible-type]
250
+ _style = [_style, overrides];
251
+ }
252
+ }
253
+
254
+ if (ReactNativeFeatureFlags.defaultTextToOverflowHidden()) {
255
+ _style = [styles.default, _style];
256
+ }
257
+
258
+ const _nativeID = id ?? nativeID;
259
+
260
+ if (_accessibilityLabel !== undefined) {
261
+ processedProps.accessibilityLabel = _accessibilityLabel;
262
+ }
263
+ if (_accessibilityRole !== undefined) {
264
+ processedProps.accessibilityRole = _accessibilityRole;
265
+ }
266
+ if (_accessibilityState !== undefined) {
267
+ processedProps.accessibilityState = _accessibilityState;
268
+ }
269
+ if (_nativeID !== undefined) {
270
+ processedProps.nativeID = _nativeID;
271
+ }
272
+ if (_numberOfLines !== undefined) {
273
+ processedProps.numberOfLines = _numberOfLines;
274
+ }
275
+ if (_selectable !== undefined) {
276
+ processedProps.selectable = _selectable;
277
+ }
278
+ if (_style !== undefined) {
279
+ processedProps.style = _style;
280
+ }
281
+ if (_selectionColor !== undefined) {
282
+ processedProps.selectionColor = _selectionColor;
283
+ }
284
+ if (_role !== undefined) {
285
+ processedProps.role = _role;
286
+ }
287
+
288
+ // [Windows accessibility properties
289
+ if (_accessibilityLevel !== undefined) {
290
+ processedProps.accessibilityLevel = _accessibilityLevel;
291
+ }
292
+ if (_accessibilityPosInSet !== undefined) {
293
+ processedProps.accessibilityPosInSet = _accessibilityPosInSet;
294
+ }
295
+ if (_accessibilitySetSize !== undefined) {
296
+ processedProps.accessibilitySetSize = _accessibilitySetSize;
297
+ }
298
+ // ]
299
+
300
+ let textPressabilityProps: ?TextPressabilityProps;
301
+ if (isPressable) {
302
+ textPressabilityProps = {
303
+ onLongPress,
304
+ onPress,
305
+ onPressIn,
306
+ onPressOut,
307
+ onResponderGrant,
308
+ onResponderMove,
309
+ onResponderRelease,
310
+ onResponderTerminate,
311
+ onResponderTerminationRequest,
312
+ onStartShouldSetResponder,
313
+ pressRetentionOffset,
314
+ suppressHighlighting,
315
+ };
316
+ }
330
317
 
331
- processedProps.accessible = _accessible;
332
- processedProps.allowFontScaling = allowFontScaling !== false;
333
- processedProps.disabled = _disabled;
334
- processedProps.ellipsizeMode = ellipsizeMode ?? 'tail';
318
+ const hasTextAncestor = useContext(TextAncestorContext);
319
+ if (hasTextAncestor) {
320
+ processedProps.disabled = disabled;
335
321
  processedProps.children = children;
336
-
337
322
  if (isPressable) {
338
- nativeText = (
339
- <NativePressableText
323
+ return (
324
+ <PressableVirtualText
340
325
  ref={forwardedRef}
341
326
  textProps={processedProps}
342
327
  textPressabilityProps={textPressabilityProps ?? {}}
343
328
  />
344
329
  );
345
- } else {
346
- nativeText = <NativeText {...processedProps} ref={forwardedRef} />;
347
- }
348
-
349
- if (children == null) {
350
- return nativeText;
351
- }
352
-
353
- // If the children do not contain a JSX element it would not be possible to have a
354
- // nested `Text` component so we can skip adding the `TextAncestorContext` context wrapper
355
- // which has a performance overhead. Since we do this for performance reasons we need
356
- // to keep the check simple to avoid regressing overall perf. For this reason the
357
- // `children.length` constant is set to `3`, this should be a reasonable tradeoff
358
- // to capture the majority of `Text` uses but also not make this check too expensive.
359
- if (Array.isArray(children) && children.length <= 3) {
360
- let hasNonTextChild = false;
361
- for (let child of children) {
362
- if (child != null && typeof child === 'object') {
363
- hasNonTextChild = true;
364
- break;
365
- }
366
- }
367
- if (!hasNonTextChild) {
368
- return nativeText;
369
- }
370
- } else if (typeof children !== 'object') {
371
- return nativeText;
372
- }
373
-
374
- return <TextAncestorContext value={true}>{nativeText}</TextAncestorContext>;
375
- };
376
- _TextImpl = TextImplNoDefaultProps;
377
- } else {
378
- const TextImplLegacy: component(
379
- ref?: React.RefSetter<TextForwardRef>,
380
- ...props: TextProps
381
- ) = ({
382
- ref: forwardedRef,
383
- accessible,
384
- accessibilityElementsHidden,
385
- importantForAccessibility,
386
- accessibilityLabel,
387
- accessibilityRole,
388
- accessibilityState,
389
- allowFontScaling,
390
- 'aria-busy': ariaBusy,
391
- 'aria-checked': ariaChecked,
392
- 'aria-disabled': ariaDisabled,
393
- 'aria-expanded': ariaExpanded,
394
- 'aria-hidden': ariaHidden,
395
- 'aria-label': ariaLabel,
396
- // #[Windows
397
- 'aria-multiselectable': ariaMultiselectable, // Windows
398
- 'aria-required': ariaRequired, // Windows
399
- 'aria-level': ariaLevel, // Windows
400
- 'aria-posinset': ariaPosinset, // Windows
401
- 'aria-setsize': ariaSetsize, // Windows
402
- 'aria-readonly': ariaReadOnly, //Windows
403
- accessibilityLevel, // Windows
404
- accessibilityPosInSet, // Windows
405
- accessibilitySetSize, // Windows
406
- // #]Windows
407
- 'aria-selected': ariaSelected,
408
- children,
409
- ellipsizeMode,
410
- disabled,
411
- id,
412
- nativeID,
413
- numberOfLines,
414
- onLongPress,
415
- onPress,
416
- onPressIn,
417
- onPressOut,
418
- onResponderGrant,
419
- onResponderMove,
420
- onResponderRelease,
421
- onResponderTerminate,
422
- onResponderTerminationRequest,
423
- onStartShouldSetResponder,
424
- pressRetentionOffset,
425
- role,
426
- selectable,
427
- selectionColor,
428
- suppressHighlighting,
429
- style,
430
- ...restProps
431
- }: {
432
- ref?: React.RefSetter<TextForwardRef>,
433
- ...TextProps,
434
- }) => {
435
- const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
436
- // [# Windows
437
- const _accessibilityLevel = ariaLevel ?? accessibilityLevel;
438
- const _accessibilityPosInSet = ariaPosinset ?? accessibilityPosInSet;
439
- const _accessibilitySetSize = ariaSetsize ?? accessibilitySetSize;
440
- // ]# Windows
441
-
442
- let _accessibilityState: ?TextProps['accessibilityState'] =
443
- accessibilityState;
444
- if (
445
- ariaBusy != null ||
446
- ariaChecked != null ||
447
- ariaDisabled != null ||
448
- ariaExpanded != null ||
449
- ariaSelected != null ||
450
- // #[Windows
451
- ariaReadOnly != null || // Windows
452
- ariaMultiselectable != null || // Windows
453
- ariaRequired != null // Windows
454
- // #]Windows
455
- ) {
456
- if (_accessibilityState != null) {
457
- _accessibilityState = {
458
- busy: ariaBusy ?? _accessibilityState.busy,
459
- checked: ariaChecked ?? _accessibilityState.checked,
460
- disabled: ariaDisabled ?? _accessibilityState.disabled,
461
- expanded: ariaExpanded ?? _accessibilityState.expanded,
462
- selected: ariaSelected ?? _accessibilityState.selected,
463
- // #[Windows
464
- readOnly: ariaReadOnly ?? _accessibilityState.readOnly, // Windows
465
- multiselectable:
466
- ariaMultiselectable ?? _accessibilityState.multiselectable, // Windows
467
- required: ariaRequired ?? _accessibilityState.required, // Windows
468
- // #]Windows
469
- };
470
- } else {
471
- _accessibilityState = {
472
- busy: ariaBusy,
473
- checked: ariaChecked,
474
- disabled: ariaDisabled,
475
- expanded: ariaExpanded,
476
- selected: ariaSelected,
477
- // #[Windows
478
- readOnly: ariaReadOnly, // Windows
479
- multiselectable: ariaMultiselectable, // Windows
480
- required: ariaRequired, // Windows
481
- // #]Windows
482
- };
483
- }
484
- }
485
-
486
- const _accessibilityStateDisabled = _accessibilityState?.disabled;
487
- const _disabled = disabled ?? _accessibilityStateDisabled;
488
-
489
- let _accessibilityElementsHidden =
490
- ariaHidden ?? accessibilityElementsHidden;
491
- let _importantForAccessibility = importantForAccessibility;
492
- if (ariaHidden === true) {
493
- _importantForAccessibility = 'no-hide-descendants';
494
- }
495
-
496
- const isPressable =
497
- (onPress != null ||
498
- onLongPress != null ||
499
- onStartShouldSetResponder != null) &&
500
- _disabled !== true;
501
-
502
- const shouldUseLinkRole =
503
- ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
504
- isPressable &&
505
- accessibilityRole == null &&
506
- role == null;
507
-
508
- const _accessibilityRole =
509
- accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
510
-
511
- const _role = shouldUseLinkRole ? undefined : role;
512
-
513
- // TODO: Move this processing to the view configuration.
514
- const _selectionColor =
515
- selectionColor != null ? processColor(selectionColor) : undefined;
516
-
517
- let _style = style;
518
- if (__DEV__) {
519
- if (PressabilityDebug.isEnabled() && onPress != null) {
520
- _style = [style, {color: 'magenta'}];
521
- }
522
- }
523
-
524
- let _numberOfLines = numberOfLines;
525
- if (_numberOfLines != null && !(_numberOfLines >= 0)) {
526
- if (__DEV__) {
527
- console.error(
528
- `'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
529
- );
530
- }
531
- _numberOfLines = 0;
532
- }
533
-
534
- let _selectable = selectable;
535
-
536
- let processedStyle = flattenStyle<TextStyleProp>(_style);
537
- if (processedStyle != null) {
538
- let overrides: ?{...TextStyleInternal} = null;
539
- if (typeof processedStyle.fontWeight === 'number') {
540
- overrides = overrides || ({}: {...TextStyleInternal});
541
- overrides.fontWeight =
542
- // $FlowFixMe[incompatible-type]
543
- (processedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']);
544
- }
545
-
546
- if (processedStyle.userSelect != null) {
547
- _selectable = userSelectToSelectableMap[processedStyle.userSelect];
548
- overrides = overrides || ({}: {...TextStyleInternal});
549
- overrides.userSelect = undefined;
550
- }
551
-
552
- if (processedStyle.verticalAlign != null) {
553
- overrides = overrides || ({}: {...TextStyleInternal});
554
- overrides.textAlignVertical =
555
- verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
556
- overrides.verticalAlign = undefined;
557
- }
558
-
559
- if (overrides != null) {
560
- // $FlowFixMe[incompatible-type]
561
- _style = [_style, overrides];
562
- }
563
- }
564
-
565
- const _nativeID = id ?? nativeID;
566
-
567
- const hasTextAncestor = useContext(TextAncestorContext);
568
- if (hasTextAncestor) {
569
- if (isPressable) {
570
- return (
571
- <NativePressableVirtualText
572
- ref={forwardedRef}
573
- textProps={{
574
- ...restProps,
575
- accessibilityElementsHidden: _accessibilityElementsHidden,
576
- accessibilityLabel: _accessibilityLabel,
577
- accessibilityRole: _accessibilityRole,
578
- accessibilityState: _accessibilityState,
579
- importantForAccessibility: _importantForAccessibility,
580
- // #[Windows
581
- accessibilityLevel: _accessibilityLevel, // Windows
582
- accessibilityPosInSet: _accessibilityPosInSet, // Windows
583
- accessibilitySetSize: _accessibilitySetSize, // Windows
584
- ellipsizeMode: ellipsizeMode ?? 'tail', // Windows
585
- // #]Windows
586
- nativeID: _nativeID,
587
- numberOfLines: _numberOfLines,
588
- selectable: _selectable,
589
- selectionColor: _selectionColor,
590
- style: _style,
591
- disabled: disabled,
592
- role: _role,
593
- children,
594
- }}
595
- textPressabilityProps={{
596
- onLongPress,
597
- onPress,
598
- onPressIn,
599
- onPressOut,
600
- onResponderGrant,
601
- onResponderMove,
602
- onResponderRelease,
603
- onResponderTerminate,
604
- onResponderTerminationRequest,
605
- onStartShouldSetResponder,
606
- pressRetentionOffset,
607
- suppressHighlighting,
608
- }}
609
- />
610
- );
611
- }
612
-
613
- return (
614
- <NativeVirtualText
615
- {...restProps}
616
- accessibilityElementsHidden={_accessibilityElementsHidden}
617
- accessibilityLabel={_accessibilityLabel}
618
- accessibilityRole={_accessibilityRole}
619
- accessibilityState={_accessibilityState}
620
- importantForAccessibility={_importantForAccessibility}
621
- nativeID={_nativeID}
622
- numberOfLines={_numberOfLines}
623
- ref={forwardedRef}
624
- selectable={_selectable}
625
- selectionColor={_selectionColor}
626
- style={_style}
627
- disabled={disabled}
628
- role={_role}>
629
- {children}
630
- </NativeVirtualText>
631
- );
632
- }
633
-
634
- // If the disabled prop and accessibilityState.disabled are out of sync but not both in
635
- // falsy states we need to update the accessibilityState object to use the disabled prop.
636
- if (
637
- _disabled !== _accessibilityStateDisabled &&
638
- ((_disabled != null && _disabled !== false) ||
639
- (_accessibilityStateDisabled != null &&
640
- _accessibilityStateDisabled !== false))
641
- ) {
642
- _accessibilityState = {..._accessibilityState, disabled: _disabled};
643
330
  }
644
-
645
- const _accessible = Platform.select({
646
- ios: accessible !== false,
647
- android:
648
- accessible == null
649
- ? onPress != null || onLongPress != null
650
- : accessible,
651
- default: accessible !== false, // [Windows #13996 - default value is accessible !== false]
652
- });
653
-
654
- let nativeText = null;
655
- if (isPressable) {
656
- nativeText = (
657
- <NativePressableText
658
- ref={forwardedRef}
659
- textProps={{
660
- ...restProps,
661
- accessibilityElementsHidden: _accessibilityElementsHidden,
662
- accessibilityLabel: _accessibilityLabel,
663
- accessibilityRole: _accessibilityRole,
664
- accessibilityState: _accessibilityState,
665
- accessible: _accessible,
666
- allowFontScaling: allowFontScaling !== false,
667
- disabled: _disabled,
668
- ellipsizeMode: ellipsizeMode ?? 'tail',
669
- importantForAccessibility: _importantForAccessibility,
670
- nativeID: _nativeID,
671
- numberOfLines: _numberOfLines,
672
- selectable: _selectable,
673
- selectionColor: _selectionColor,
674
- style: _style,
675
- role: _role,
676
- children,
677
- }}
678
- textPressabilityProps={{
679
- onLongPress,
680
- onPress,
681
- onPressIn,
682
- onPressOut,
683
- onResponderGrant,
684
- onResponderMove,
685
- onResponderRelease,
686
- onResponderTerminate,
687
- onResponderTerminationRequest,
688
- onStartShouldSetResponder,
689
- pressRetentionOffset,
690
- suppressHighlighting,
691
- }}
692
- />
331
+ return <NativeVirtualText {...processedProps} ref={forwardedRef} />;
332
+ }
333
+
334
+ let nativeText = null;
335
+
336
+ processedProps.accessible = _accessible;
337
+ processedProps.allowFontScaling = allowFontScaling !== false;
338
+ processedProps.disabled = _disabled;
339
+ processedProps.ellipsizeMode = ellipsizeMode ?? 'tail';
340
+ processedProps.children = children;
341
+
342
+ if (isPressable) {
343
+ nativeText = (
344
+ <PressableText
345
+ ref={forwardedRef}
346
+ selectable={_selectable}
347
+ textProps={processedProps}
348
+ textPressabilityProps={textPressabilityProps ?? {}}
349
+ />
350
+ );
351
+ } else {
352
+ nativeText =
353
+ _selectable === true ? (
354
+ <NativeSelectableText {...processedProps} ref={forwardedRef} />
355
+ ) : (
356
+ <NativeText {...processedProps} ref={forwardedRef} />
693
357
  );
694
- } else {
695
- nativeText = (
696
- <NativeText
697
- {...restProps}
698
- accessibilityElementsHidden={_accessibilityElementsHidden}
699
- accessibilityLabel={_accessibilityLabel}
700
- accessibilityRole={_accessibilityRole}
701
- accessibilityState={_accessibilityState}
702
- // #[Windows
703
- accessibilityLevel={_accessibilityLevel} // Windows
704
- accessibilityPosInSet={_accessibilityPosInSet} // Windows
705
- accessibilitySetSize={_accessibilitySetSize} // Windows
706
- // #]Windows
707
- accessible={_accessible}
708
- allowFontScaling={allowFontScaling !== false}
709
- disabled={_disabled}
710
- ellipsizeMode={ellipsizeMode ?? 'tail'}
711
- importantForAccessibility={_importantForAccessibility}
712
- nativeID={_nativeID}
713
- numberOfLines={_numberOfLines}
714
- ref={forwardedRef}
715
- selectable={_selectable}
716
- selectionColor={_selectionColor}
717
- style={_style}
718
- role={_role}>
719
- {children}
720
- </NativeText>
721
- );
722
- }
723
-
724
- if (children == null) {
725
- return nativeText;
726
- }
727
-
728
- // If the children do not contain a JSX element it would not be possible to have a
729
- // nested `Text` component so we can skip adding the `TextAncestorContext` context wrapper
730
- // which has a performance overhead. Since we do this for performance reasons we need
731
- // to keep the check simple to avoid regressing overall perf. For this reason the
732
- // `children.length` constant is set to `3`, this should be a reasonable tradeoff
733
- // to capture the majority of `Text` uses but also not make this check too expensive.
734
- if (Array.isArray(children) && children.length <= 3) {
735
- let hasNonTextChild = false;
736
- for (let child of children) {
737
- if (child != null && typeof child === 'object') {
738
- hasNonTextChild = true;
739
- break;
740
- }
741
- }
742
- if (!hasNonTextChild) {
743
- return nativeText;
358
+ }
359
+
360
+ if (children == null) {
361
+ return nativeText;
362
+ }
363
+
364
+ // If the children do not contain a JSX element it would not be possible to have a
365
+ // nested `Text` component so we can skip adding the `TextAncestorContext` context wrapper
366
+ // which has a performance overhead. Since we do this for performance reasons we need
367
+ // to keep the check simple to avoid regressing overall perf. For this reason the
368
+ // `children.length` constant is set to `3`, this should be a reasonable tradeoff
369
+ // to capture the majority of `Text` uses but also not make this check too expensive.
370
+ if (Array.isArray(children) && children.length <= 3) {
371
+ let hasNonTextChild = false;
372
+ for (let child of children) {
373
+ if (child != null && typeof child === 'object') {
374
+ hasNonTextChild = true;
375
+ break;
744
376
  }
745
- } else if (typeof children !== 'object') {
377
+ }
378
+ if (!hasNonTextChild) {
746
379
  return nativeText;
747
380
  }
381
+ } else if (typeof children !== 'object') {
382
+ return nativeText;
383
+ }
748
384
 
749
- return <TextAncestorContext value={true}>{nativeText}</TextAncestorContext>;
750
- };
751
- _TextImpl = TextImplLegacy;
752
- }
753
-
754
- const TextImpl: component(
755
- ref?: React.RefSetter<TextForwardRef>,
756
- ...props: TextProps
757
- ) = _TextImpl;
385
+ return <TextAncestorContext value={true}>{nativeText}</TextAncestorContext>;
386
+ };
758
387
 
759
388
  TextImpl.displayName = 'Text';
760
389
 
761
- type TextPressabilityProps = $ReadOnly<{
390
+ type TextPressabilityProps = Readonly<{
762
391
  onLongPress?: ?(event: GestureResponderEvent) => unknown,
763
392
  onPress?: ?(event: GestureResponderEvent) => unknown,
764
393
  onPressIn?: ?(event: GestureResponderEvent) => unknown,
@@ -892,28 +521,17 @@ function useTextPressability({
892
521
  );
893
522
  }
894
523
 
895
- type NativePressableTextProps = $ReadOnly<{
896
- textProps: NativeTextProps,
897
- textPressabilityProps: TextPressabilityProps,
898
- }>;
899
-
900
524
  /**
901
525
  * Wrap the NativeVirtualText component and initialize pressability.
902
526
  *
903
527
  * This logic is split out from the main Text component to enable the more
904
528
  * expensive pressability logic to be only initialized when needed.
905
529
  */
906
- const NativePressableVirtualText: component(
907
- ref: React.RefSetter<TextForwardRef>,
908
- ...props: NativePressableTextProps
909
- ) = ({
910
- ref: forwardedRef,
911
- textProps,
912
- textPressabilityProps,
913
- }: {
530
+ component PressableVirtualText(
914
531
  ref?: React.RefSetter<TextForwardRef>,
915
- ...NativePressableTextProps,
916
- }) => {
532
+ textProps: NativeTextProps,
533
+ textPressabilityProps: TextPressabilityProps,
534
+ ) {
917
535
  const [isHighlighted, eventHandlersForText] = useTextPressability(
918
536
  textPressabilityProps,
919
537
  );
@@ -924,42 +542,40 @@ const NativePressableVirtualText: component(
924
542
  {...eventHandlersForText}
925
543
  isHighlighted={isHighlighted}
926
544
  isPressable={true}
927
- ref={forwardedRef}
545
+ ref={ref}
928
546
  />
929
547
  );
930
- };
548
+ }
931
549
 
932
550
  /**
933
- * Wrap the NativeText component and initialize pressability.
551
+ * Wrap a NativeText component and initialize pressability.
934
552
  *
935
553
  * This logic is split out from the main Text component to enable the more
936
554
  * expensive pressability logic to be only initialized when needed.
937
555
  */
938
- const NativePressableText: component(
939
- ref: React.RefSetter<TextForwardRef>,
940
- ...props: NativePressableTextProps
941
- ) = ({
942
- ref: forwardedRef,
943
- textProps,
944
- textPressabilityProps,
945
- }: {
556
+ component PressableText(
946
557
  ref?: React.RefSetter<TextForwardRef>,
947
- ...NativePressableTextProps,
948
- }) => {
558
+ selectable?: ?boolean,
559
+ textProps: NativeTextProps,
560
+ textPressabilityProps: TextPressabilityProps,
561
+ ) {
949
562
  const [isHighlighted, eventHandlersForText] = useTextPressability(
950
563
  textPressabilityProps,
951
564
  );
952
565
 
566
+ const NativeComponent =
567
+ selectable === true ? NativeSelectableText : NativeText;
568
+
953
569
  return (
954
- <NativeText
570
+ <NativeComponent
955
571
  {...textProps}
956
572
  {...eventHandlersForText}
957
573
  isHighlighted={isHighlighted}
958
574
  isPressable={true}
959
- ref={forwardedRef}
575
+ ref={ref}
960
576
  />
961
577
  );
962
- };
578
+ }
963
579
 
964
580
  const userSelectToSelectableMap = {
965
581
  auto: true,
@@ -976,4 +592,13 @@ const verticalAlignToTextAlignVerticalMap = {
976
592
  middle: 'center',
977
593
  } as const;
978
594
 
595
+ const styles = StyleSheet.create({
596
+ // Native components have historically acted like overflow: 'hidden'. We set
597
+ // this, as part of the default style, to let client differentiate with
598
+ // overflow: 'visible'.
599
+ default: {
600
+ overflow: 'hidden',
601
+ },
602
+ });
603
+
979
604
  export default TextImpl;