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.
- package/.flowconfig +1 -5
- package/Directory.Build.props +1 -16
- package/Directory.Build.targets +12 -4
- package/Folly/ThreadNameStub.cpp +4 -6
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +3 -3
- package/Libraries/Animated/Animated.d.ts +8 -1
- package/Libraries/Animated/AnimatedEvent.js +4 -4
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/animations/Animation.js +3 -3
- package/Libraries/Animated/animations/DecayAnimation.js +4 -4
- package/Libraries/Animated/animations/SpringAnimation.js +5 -5
- package/Libraries/Animated/animations/TimingAnimation.js +5 -5
- package/Libraries/Animated/createAnimatedComponent.js +7 -7
- package/Libraries/Animated/nodes/AnimatedColor.js +2 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +12 -12
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
- package/Libraries/Animated/nodes/AnimatedObject.js +3 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +6 -6
- package/Libraries/Animated/nodes/AnimatedStyle.js +7 -7
- package/Libraries/Animated/nodes/AnimatedTransform.js +13 -13
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
- package/Libraries/Animated/useAnimatedColor.d.ts +15 -0
- package/Libraries/Animated/useAnimatedColor.js +25 -0
- package/Libraries/Animated/useAnimatedValueXY.d.ts +15 -0
- package/Libraries/Animated/useAnimatedValueXY.js +26 -0
- package/Libraries/AppState/AppState.js +1 -1
- package/Libraries/BatchedBridge/MessageQueue.js +3 -3
- package/Libraries/BatchedBridge/NativeModules.js +12 -10
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +30 -26
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +34 -30
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +2 -2
- package/Libraries/Components/Button.js +2 -2
- package/Libraries/Components/Button.windows.js +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +2 -2
- package/Libraries/Components/Keyboard/Keyboard.js +6 -6
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +1 -1
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
- package/Libraries/Components/Pressable/Pressable.d.ts +5 -0
- package/Libraries/Components/Pressable/Pressable.js +3 -3
- package/Libraries/Components/Pressable/Pressable.windows.js +3 -3
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +4 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +1 -1
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +3 -3
- package/Libraries/Components/RefreshControl/RefreshControl.js +5 -5
- package/Libraries/Components/RefreshControl/RefreshControl.windows.js +5 -5
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +8 -12
- package/Libraries/Components/ScrollView/ScrollView.d.ts +9 -0
- package/Libraries/Components/ScrollView/ScrollView.js +19 -9
- package/Libraries/Components/ScrollView/ScrollView.windows.js +19 -9
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +8 -18
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.windows.js +8 -18
- package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +4 -3
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +8 -8
- package/Libraries/Components/Switch/Switch.js +3 -3
- package/Libraries/Components/Switch/Switch.windows.js +3 -3
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +33 -48
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +6 -11
- package/Libraries/Components/TextInput/TextInput.flow.js +21 -20
- package/Libraries/Components/TextInput/TextInput.flow.windows.js +23 -22
- package/Libraries/Components/TextInput/TextInput.js +8 -4
- package/Libraries/Components/TextInput/TextInput.windows.js +3 -4
- package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +33 -48
- package/Libraries/Components/Touchable/PooledClass.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +2 -2
- package/Libraries/Components/Touchable/Touchable.windows.js +2 -2
- package/Libraries/Components/Touchable/TouchableBounce.js +4 -4
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +4 -4
- package/Libraries/Components/Touchable/TouchableHighlight.js +8 -8
- package/Libraries/Components/Touchable/TouchableHighlight.windows.js +9 -9
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +7 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +7 -7
- package/Libraries/Components/Touchable/TouchableOpacity.js +4 -4
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +4 -4
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -1
- package/Libraries/Components/UnimplementedViews/UnimplementedView.js +1 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +68 -31
- package/Libraries/Components/View/View.windows.js +1 -1
- package/Libraries/Components/View/ViewAccessibility.js +7 -7
- package/Libraries/Components/View/ViewAccessibility.windows.js +7 -7
- package/Libraries/Components/View/ViewPropTypes.js +14 -14
- package/Libraries/Components/View/ViewPropTypes.windows.js +18 -16
- package/Libraries/Core/Devtools/parseHermesStack.js +8 -8
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -2
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/ExtendedError.js +3 -3
- package/Libraries/Core/RawEventEmitter.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/Timers/JSTimers.js +3 -2
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +4 -2
- package/Libraries/Core/setUpReactDevTools.js +23 -6
- package/Libraries/Core/setUpSegmentFetcher.js +1 -1
- package/Libraries/Debugging/DebuggingOverlay.js +2 -2
- package/Libraries/EventEmitter/NativeEventEmitter.js +7 -9
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +1 -1
- package/Libraries/Image/AssetSourceResolver.js +1 -1
- package/Libraries/Image/AssetSourceResolver.windows.js +1 -1
- package/Libraries/Image/Image.android.js +172 -306
- package/Libraries/Image/ImageProps.js +9 -11
- package/Libraries/Image/ImageSource.js +2 -2
- package/Libraries/Image/ImageSourceUtils.js +8 -4
- package/Libraries/Image/ImageTypes.flow.js +2 -2
- package/Libraries/Image/ImageViewNativeComponent.js +7 -16
- package/Libraries/Image/nativeImageSource.js +1 -1
- package/Libraries/Interaction/InteractionManager.js +5 -4
- package/Libraries/Interaction/PanResponder.js +1 -1
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.js +3 -3
- package/Libraries/Lists/SectionList.js +1 -1
- package/Libraries/Lists/SectionListModern.js +2 -2
- package/Libraries/LogBox/Data/LogBoxData.js +38 -24
- package/Libraries/LogBox/Data/LogBoxLog.js +43 -112
- package/Libraries/LogBox/Data/parseLogBoxLog.js +21 -117
- package/Libraries/LogBox/LogBox.js +42 -19
- package/Libraries/LogBox/LogBoxInspectorContainer.js +2 -2
- package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
- package/Libraries/LogBox/UI/LogBoxButton.js +14 -16
- package/Libraries/LogBox/UI/LogBoxInspector.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -9
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.windows.js +6 -9
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.windows.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +10 -15
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +25 -18
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.windows.js +15 -16
- package/Libraries/LogBox/UI/LogBoxInspectorSection.js +5 -7
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +8 -10
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +8 -6
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.windows.js +3 -5
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +17 -29
- package/Libraries/LogBox/UI/LogBoxMessage.js +28 -37
- package/Libraries/LogBox/UI/LogBoxNotification.js +1 -1
- package/Libraries/Modal/Modal.d.ts +4 -0
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/Modal/Modal.windows.js +7 -3
- package/Libraries/NativeComponent/BaseViewConfig.android.js +28 -52
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +19 -21
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +26 -17
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworking.windows.js +1 -1
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -3
- package/Libraries/Pressability/Pressability.js +5 -5
- package/Libraries/Pressability/Pressability.windows.js +5 -5
- package/Libraries/Pressability/PressabilityDebug.js +1 -1
- package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
- package/Libraries/Pressability/usePressability.js +3 -14
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
- package/Libraries/ReactNative/AppContainer-dev.js +18 -1
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/AppRegistry.flow.js +2 -2
- package/Libraries/ReactNative/AppRegistryImpl.js +2 -2
- package/Libraries/ReactNative/FabricUIManager.js +1 -1
- package/Libraries/ReactNative/RendererImplementation.js +4 -4
- package/Libraries/ReactNative/UIManagerProperties.js +1 -1
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +3 -2
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -2
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -2
- package/Libraries/Renderer/shims/ReactFabric.js +1 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +1 -3
- package/Libraries/Renderer/shims/ReactNative.js +3 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +1 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +1 -3
- package/Libraries/StyleSheet/PointPropType.js +1 -1
- package/Libraries/StyleSheet/Rect.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +0 -5
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.js.flow +1 -1
- package/Libraries/StyleSheet/StyleSheetExports.js +16 -25
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +2 -7
- package/Libraries/StyleSheet/StyleSheetTypes.js +33 -35
- package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +5 -5
- package/Libraries/StyleSheet/private/_TransformStyle.js +7 -7
- package/Libraries/StyleSheet/processBackgroundImage.js +7 -7
- package/Libraries/StyleSheet/processBackgroundPosition.js +4 -4
- package/Libraries/StyleSheet/processBackgroundRepeat.js +4 -4
- package/Libraries/StyleSheet/processBackgroundSize.js +4 -4
- package/Libraries/StyleSheet/processBoxShadow.js +44 -4
- package/Libraries/StyleSheet/processColorArray.js +2 -2
- package/Libraries/StyleSheet/processFilter.js +2 -2
- package/Libraries/Text/Text.js +295 -627
- package/Libraries/Text/Text.windows.js +342 -717
- package/Libraries/Text/TextNativeComponent.js +14 -7
- package/Libraries/Text/TextProps.js +4 -4
- package/Libraries/Text/TextProps.windows.js +4 -4
- package/Libraries/Types/CodegenTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.js +21 -21
- package/Libraries/Types/CoreEventTypes.windows.js +21 -21
- package/Libraries/Types/ReactDevToolsTypes.js +2 -2
- package/Libraries/Utilities/Appearance.js +6 -1
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/HMRClient.js +32 -5
- package/Libraries/Utilities/IPerformanceLogger.js +4 -4
- package/Libraries/Utilities/codegenNativeCommands.js +4 -4
- package/Libraries/Utilities/codegenNativeComponent.d.ts +2 -0
- package/Libraries/Utilities/codegenNativeComponent.js +2 -2
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/stringifySafe.js +3 -3
- package/Libraries/Utilities/useMergeRefs.js +2 -2
- package/Libraries/vendor/core/ErrorUtils.js +4 -4
- package/Libraries/vendor/emitter/EventEmitter.js +16 -20
- package/Microsoft.ReactNative/CallInvoker.cpp +14 -4
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.cpp +73 -97
- package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +135 -18
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +10 -0
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +7 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +63 -15
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +3 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +11 -0
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +1 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +3 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +0 -3
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +2 -7
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +6 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -61
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +1 -26
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +2 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +2 -17
- package/Microsoft.ReactNative/Modules/AppStateModule.h +0 -4
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +0 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +16 -15
- package/Microsoft.ReactNative/Modules/AppearanceModule.h +5 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +2 -7
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +0 -1
- package/Microsoft.ReactNative/Modules/I18nManagerModule.h +4 -4
- package/Microsoft.ReactNative/QuirkSettings.cpp +0 -133
- package/Microsoft.ReactNative/QuirkSettings.h +0 -43
- package/Microsoft.ReactNative/QuirkSettings.idl +0 -41
- package/Microsoft.ReactNative/ReactHost/CrashManager.cpp +0 -4
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -2
- package/Microsoft.ReactNative/ReactHost/React.h +0 -5
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +0 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +3 -26
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +0 -5
- package/Microsoft.ReactNative/ReactHost/React_Win.h +0 -2
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +3 -0
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +7 -0
- package/Microsoft.ReactNative/ReactPackageBuilder.h +1 -0
- package/Microsoft.ReactNative/RedBox.cpp +0 -9
- package/Microsoft.ReactNative/RedBoxHandler.cpp +0 -4
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +5 -10
- package/Microsoft.ReactNative/TurboModulesProvider.h +2 -0
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h +0 -7
- package/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +0 -22
- package/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp +8 -2
- package/Microsoft.ReactNative.Cxx/ModuleRegistration.h +36 -20
- package/Microsoft.ReactNative.Cxx/NamespaceRedirect.h +0 -3
- package/Microsoft.ReactNative.Cxx/NativeModules.h +8 -2
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +0 -9
- package/Microsoft.ReactNative.Managed/ReactContext.cs +0 -9
- package/PropertySheets/Autolink.props +1 -1
- package/PropertySheets/Bundle.props +1 -1
- package/PropertySheets/Codegen.props +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/NuGet.LockFile.props +8 -0
- package/PropertySheets/React.Cpp.props +4 -4
- package/PropertySheets/ReactNativeArchitecture.props +6 -24
- package/ReactCommon/ReactCommon.vcxproj +5 -6
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +15 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +13 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/defaults/DefaultTurboModules.cpp +69 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/animationbackend/AnimatedPropSerializer.cpp +717 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +10 -10
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +2 -21
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/TouchEventEmitter.cpp +151 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/TouchEventEmitter.h +50 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mapbuffer/MapBuffer.cpp +178 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +69 -39
- package/Scripts/OfficeReact.Win32.nuspec +0 -1
- package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +4 -39
- package/Scripts/creaternwapp.cmd +1 -9
- package/Scripts/creaternwlib.cmd +4 -24
- package/Shared/DevSettings.h +0 -3
- package/Shared/Networking/WinRTWebSocketResource.cpp +23 -408
- package/Shared/Networking/WinRTWebSocketResource.h +3 -119
- package/Shared/Shared.vcxitems +63 -38
- package/Shared/Shared.vcxitems.filters +54 -0
- package/Shared/Utils.cpp +0 -88
- package/Shared/Utils.h +0 -14
- package/Shared/WebSocketResourceFactory.cpp +28 -0
- package/Shared/tracing/fbsystrace.h +1 -0
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +172 -160
- package/codegen/react/components/rnwcore/ModalHostView.g.h +8 -0
- package/codegen/react/components/rnwcore/Props.cpp +17 -7
- package/codegen/react/components/rnwcore/Props.h +3 -1
- package/codegen/react/components/rnwcore/VirtualViewExperimental.g.h +4 -4
- package/codegen/rnwcoreJSI.h +93 -77
- package/index.js +9 -0
- package/index.windows.js +9 -0
- package/jest/RefreshControlMock.js +2 -2
- package/jest/assetFileTransformer.js +8 -3
- package/jest/mockComponent.js +3 -4
- package/jest/mockNativeComponent.js +1 -1
- package/jest/mocks/ActivityIndicator.js +2 -2
- package/jest/mocks/Image.js +2 -2
- package/jest/mocks/Modal.js +2 -2
- package/jest/mocks/RefreshControl.js +3 -3
- package/jest/mocks/RendererProxy.js +2 -2
- package/jest/mocks/ScrollView.js +5 -5
- package/jest/mocks/Text.js +2 -2
- package/jest/mocks/TextInput.js +2 -2
- package/jest/mocks/View.js +2 -2
- package/jest/mocks/ViewNativeComponent.js +1 -1
- package/jest/mocks/requireNativeComponent.js +1 -1
- package/jest/mocks/useColorScheme.js +1 -1
- package/jest/setup.js +68 -31
- package/package.json +27 -22
- package/src/private/animated/NativeAnimatedHelper.js +2 -2
- package/src/private/animated/createAnimatedPropsMemoHook.js +19 -19
- package/src/private/components/virtualview/VirtualView.js +14 -21
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +11 -10
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +4 -4
- package/src/private/devsupport/devmenu/elementinspector/BorderBox.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/BoxInspector.js +3 -3
- package/src/private/devsupport/devmenu/elementinspector/ElementBox.js +4 -4
- package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +39 -17
- package/src/private/devsupport/devmenu/elementinspector/InspectorOverlay.js +15 -3
- package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -8
- package/src/private/devsupport/devmenu/elementinspector/StyleInspector.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/resolveBoxStyle.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js +102 -0
- package/src/private/devsupport/rndevtools/FuseboxSessionObserver.js +12 -25
- package/src/private/devsupport/rndevtools/GlobalStateObserver.js +56 -0
- package/src/private/devsupport/rndevtools/TracingStateObserver.js +28 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +71 -79
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +2 -2
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +14 -12
- package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
- package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +7 -3
- package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +1 -1
- package/src/private/styles/composeStyles.js +1 -1
- package/src/private/utilities/toError.js +27 -0
- package/src/private/utilities/toExtendedError.js +30 -0
- package/src/private/webapis/dom/events/Event.js +1 -1
- package/src/private/webapis/dom/events/EventHandlerAttributes.js +2 -2
- package/src/private/webapis/dom/events/EventTarget.js +3 -3
- package/src/private/webapis/dom/events/internals/EventInternals.js +2 -2
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +2 -2
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +14 -14
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +2 -2
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
- package/src/private/webapis/geometry/DOMRectList.js +2 -2
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +8 -8
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +6 -6
- package/src/private/webapis/mutationobserver/MutationObserver.js +2 -2
- package/src/private/webapis/mutationobserver/MutationRecord.js +2 -2
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +3 -3
- package/src/private/webapis/performance/LongTasks.js +3 -3
- package/src/private/webapis/performance/Performance.js +4 -4
- package/src/private/webapis/performance/PerformanceEntry.js +1 -1
- package/src/private/webapis/performance/PerformanceObserver.js +2 -2
- package/src/private/webapis/performance/specs/NativePerformance.js +8 -8
- package/src/private/webapis/structuredClone/structuredClone.js +2 -2
- package/src/types/globals.d.ts +4 -4
- package/template/cpp-lib/proj/MyLib.sln +0 -33
- package/template/cpp-lib/proj/MyLib.vcxproj +1 -1
- package/template/cs-lib/proj/MyLib.sln +0 -33
- package/template/metro.config.js +12 -2
- package/templates/cpp-app/metro.config.js +12 -2
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +9 -6
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +1 -1
- package/templates/cpp-app/windows/MyApp.sln +0 -33
- package/templates/cpp-lib/example/metro.config.js +12 -2
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
- package/templates/cpp-lib/windows/MyLib.sln +0 -33
- package/types/index.d.ts +2 -0
- package/Folly/.clang-format +0 -2
- package/Folly/Folly.natvis +0 -25
- package/Folly/Folly.vcxproj +0 -378
- package/Folly/Folly.vcxproj.filters +0 -558
- package/Folly/TEMP_UntilFollyUpdate/ConstexprMath.h +0 -978
- package/Folly/TEMP_UntilFollyUpdate/Conv.cpp +0 -1205
- package/Folly/TEMP_UntilFollyUpdate/chrono/Hardware.h +0 -155
- package/Folly/TEMP_UntilFollyUpdate/concurrency/CacheLocality.cpp +0 -633
- package/Folly/TEMP_UntilFollyUpdate/json/dynamic-inl.h +0 -1438
- package/Folly/TEMP_UntilFollyUpdate/json/json.cpp +0 -1118
- package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +0 -188
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.cpp +0 -348
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +0 -182
- package/Folly/TEMP_UntilFollyUpdate/portability/Unistd.cpp +0 -33
- package/Folly/cgmanifest.json +0 -25
- package/Libraries/Components/View/ReactNativeViewAttributes.js +0 -60
- package/Libraries/Components/View/ReactNativeViewAttributes.windows.js +0 -64
- package/Libraries/Image/TextInlineImageNativeComponent.js +0 -49
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +0 -75
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp +0 -27
- package/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +0 -81
- package/Microsoft.ReactNative/Modules/CreateModules.cpp +0 -24
- package/Microsoft.ReactNative/ReactSupport.cpp +0 -221
- package/Microsoft.ReactNative/ReactSupport.h +0 -13
- package/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.cpp +0 -107
- package/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.h +0 -62
- package/Microsoft.ReactNative/Utils/UwpScriptStore.cpp +0 -56
- package/Microsoft.ReactNative/Utils/UwpScriptStore.h +0 -23
- package/Microsoft.ReactNative/XamlUIService.cpp +0 -68
- package/Microsoft.ReactNative/XamlUIService.h +0 -37
- package/Microsoft.ReactNative/XamlUIService.idl +0 -53
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +0 -259
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/Instance.cpp +0 -381
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +0 -145
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/MethodCall.cpp +0 -100
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ModuleRegistry.cpp +0 -256
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +0 -363
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/RAMBundleRegistry.cpp +0 -93
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +0 -148
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +0 -190
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSINativeModules.cpp +0 -123
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleWithJSIBindings.cpp +0 -27
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/webperformance/NativePerformance.cpp +0 -414
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +0 -91
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +0 -80
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +0 -138
- package/fmt/.clang-format +0 -2
- package/fmt/cgmanifest.json +0 -15
- package/fmt/fmt.vcxproj +0 -153
- package/fmt/fmt.vcxproj.filters +0 -59
- package/fmt/pch.cpp +0 -4
- 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 {
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
_numberOfLines = 0;
|
|
220
|
-
}
|
|
188
|
+
const isPressable =
|
|
189
|
+
(onPress != null ||
|
|
190
|
+
onLongPress != null ||
|
|
191
|
+
onStartShouldSetResponder != null) &&
|
|
192
|
+
_disabled !== true;
|
|
221
193
|
|
|
222
|
-
|
|
194
|
+
const shouldUseLinkRole =
|
|
195
|
+
isPressable && accessibilityRole == null && role == null;
|
|
223
196
|
|
|
224
|
-
|
|
225
|
-
|
|
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
|
-
|
|
235
|
-
_selectable = userSelectToSelectableMap[processedStyle.userSelect];
|
|
236
|
-
overrides = overrides || ({}: {...TextStyleInternal});
|
|
237
|
-
overrides.userSelect = undefined;
|
|
238
|
-
}
|
|
200
|
+
const _role = shouldUseLinkRole ? undefined : role;
|
|
239
201
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
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
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
332
|
-
|
|
333
|
-
processedProps.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
|
-
|
|
339
|
-
<
|
|
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
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
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
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
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
|
-
}
|
|
377
|
+
}
|
|
378
|
+
if (!hasNonTextChild) {
|
|
746
379
|
return nativeText;
|
|
747
380
|
}
|
|
381
|
+
} else if (typeof children !== 'object') {
|
|
382
|
+
return nativeText;
|
|
383
|
+
}
|
|
748
384
|
|
|
749
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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={
|
|
545
|
+
ref={ref}
|
|
928
546
|
/>
|
|
929
547
|
);
|
|
930
|
-
}
|
|
548
|
+
}
|
|
931
549
|
|
|
932
550
|
/**
|
|
933
|
-
* Wrap
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
<
|
|
570
|
+
<NativeComponent
|
|
955
571
|
{...textProps}
|
|
956
572
|
{...eventHandlersForText}
|
|
957
573
|
isHighlighted={isHighlighted}
|
|
958
574
|
isPressable={true}
|
|
959
|
-
ref={
|
|
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;
|