react-native-windows 0.79.5 → 0.80.0-preview.10
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 +12 -3
- package/Directory.Build.props +11 -2
- package/Folly/TEMP_UntilFollyUpdate/json/json.cpp +1 -1
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Alert/Alert.windows.js +3 -0
- package/Libraries/Alert/RCTAlertManager.js +17 -0
- package/Libraries/Animated/Animated.js.flow +1 -3
- package/Libraries/Animated/AnimatedEvent.js +4 -3
- package/Libraries/Animated/AnimatedExports.js +2 -2
- package/Libraries/Animated/AnimatedExports.js.flow +140 -0
- package/Libraries/Animated/AnimatedImplementation.js +2 -123
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/animations/Animation.js +8 -4
- package/Libraries/Animated/components/AnimatedFlatList.js +7 -6
- package/Libraries/Animated/components/AnimatedScrollView.js +48 -42
- package/Libraries/Animated/components/AnimatedSectionList.js +11 -7
- package/Libraries/Animated/createAnimatedComponent.js +105 -57
- package/Libraries/Animated/nodes/AnimatedNode.js +4 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +46 -26
- package/Libraries/Animated/nodes/AnimatedValue.js +16 -7
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/AppState/AppState.js +7 -2
- package/Libraries/BatchedBridge/MessageQueue.js +2 -2
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/BlobManager.js +1 -0
- package/Libraries/Blob/FileReader.js +219 -8
- package/Libraries/Blob/URL.js +37 -12
- package/Libraries/Blob/URLSearchParams.js +106 -31
- package/Libraries/Blob/URLSearchParams.js.flow +12 -7
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -0
- package/Libraries/Components/Button.d.ts +3 -0
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.windows.js +27 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
- package/Libraries/{NewAppScreen/components/Colors.js → Components/DrawerAndroid/DrawerLayoutAndroid.ios.js} +6 -10
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
- package/Libraries/Components/Flyout/Flyout.js +11 -0
- package/Libraries/Components/Keyboard/Keyboard.js +5 -3
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/Popup/Popup.js +11 -0
- package/Libraries/Components/Pressable/Pressable.js +20 -4
- package/Libraries/Components/Pressable/Pressable.windows.js +20 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +25 -3
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/RefreshControl/RefreshControl.windows.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
- package/Libraries/Components/ScrollView/ScrollView.js +132 -122
- package/Libraries/Components/ScrollView/ScrollView.windows.js +131 -122
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/Switch/Switch.d.ts +3 -0
- package/Libraries/Components/Switch/Switch.js +8 -4
- package/Libraries/Components/Switch/Switch.windows.js +17 -4
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -4
- package/Libraries/Components/TextInput/TextInput.d.ts +70 -33
- package/Libraries/Components/TextInput/TextInput.flow.js +100 -51
- package/Libraries/Components/TextInput/TextInput.flow.windows.js +1246 -0
- package/Libraries/Components/TextInput/TextInput.js +88 -1027
- package/Libraries/Components/TextInput/TextInput.windows.js +104 -1092
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.windows.js +1 -1
- package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +2 -1
- package/Libraries/{Modal/ModalInjection.js → Components/ToastAndroid/ToastAndroid.ios.js} +3 -5
- package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
- package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
- package/Libraries/Components/Touchable/Touchable.js +5 -5
- package/Libraries/Components/Touchable/Touchable.windows.js +5 -5
- package/Libraries/Components/Touchable/TouchableBounce.js +14 -7
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +14 -7
- package/Libraries/Components/Touchable/TouchableHighlight.js +10 -7
- package/Libraries/Components/Touchable/TouchableHighlight.windows.js +10 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -6
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +6 -6
- package/Libraries/Components/Touchable/TouchableOpacity.js +13 -6
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +13 -6
- package/Libraries/Components/View/View.js +18 -21
- package/Libraries/Components/View/View.windows.js +39 -41
- package/Libraries/Components/View/ViewAccessibility.d.ts +8 -0
- package/Libraries/Components/View/ViewAccessibility.js +25 -1
- package/Libraries/Components/View/ViewAccessibility.windows.js +9 -1
- package/Libraries/Components/View/ViewPropTypes.js +49 -3
- package/Libraries/Components/View/ViewPropTypes.windows.js +50 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpReactDevTools.js +5 -5
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
- package/Libraries/EventEmitter/NativeEventEmitter.js +9 -4
- package/Libraries/Image/AssetSourceResolver.js +17 -4
- package/Libraries/Image/AssetSourceResolver.windows.js +17 -4
- package/Libraries/Image/Image.d.ts +26 -10
- package/Libraries/Image/Image.js +17 -0
- package/Libraries/Image/Image.js.flow +5 -5
- package/Libraries/Image/Image.windows.js +13 -1
- package/Libraries/Image/ImageBackground.js +2 -0
- package/Libraries/Image/ImageInjection.js +1 -1
- package/Libraries/Image/ImageProps.js +22 -17
- package/Libraries/Image/ImageSource.js +3 -1
- package/Libraries/Image/ImageSourceUtils.js +4 -2
- package/Libraries/Image/ImageTypes.flow.js +1 -1
- package/Libraries/Interaction/InteractionManager.d.ts +13 -0
- package/Libraries/Interaction/InteractionManager.js +1 -1
- package/Libraries/Interaction/PanResponder.js +3 -3
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -2
- package/Libraries/Lists/FlatList.js +8 -11
- package/Libraries/Lists/SectionList.js +39 -42
- package/Libraries/Lists/SectionListModern.js +25 -34
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +1 -0
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
- package/Libraries/Modal/Modal.js +33 -7
- package/Libraries/Modal/Modal.windows.js +33 -10
- package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
- package/Libraries/NativeModules/specs/NativeDevMenu.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js +17 -0
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworking.windows.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +781 -10
- package/Libraries/Performance/Systrace.js +7 -7
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.windows.js +1 -1
- package/Libraries/ReactNative/AppContainer-dev.js +5 -4
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/FabricUIManager.js +10 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/ReactNative/RendererImplementation.js +10 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -0
- package/Libraries/ReactNative/renderApplication.js +9 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +3 -3
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +51 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4840 -4748
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +4947 -4829
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3998 -3888
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5005 -4948
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2744 -2652
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5020 -4933
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
- package/Libraries/Settings/Settings.ios.js +1 -0
- package/Libraries/Settings/Settings.js +13 -19
- package/Libraries/Settings/SettingsFallback.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/Rect.js +1 -0
- package/Libraries/StyleSheet/StyleSheet.js +31 -200
- package/Libraries/StyleSheet/StyleSheet.js.flow +188 -0
- package/Libraries/StyleSheet/StyleSheetExports.js +210 -0
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +112 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +130 -52
- package/Libraries/StyleSheet/flattenStyle.js +14 -4
- package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
- package/Libraries/StyleSheet/processBackgroundImage.js +670 -214
- package/Libraries/Text/Text.d.ts +2 -5
- package/Libraries/Text/Text.js +3 -3
- package/Libraries/Text/Text.windows.js +3 -3
- package/Libraries/Text/TextNativeComponent.js +0 -4
- package/Libraries/Text/TextProps.js +5 -33
- package/Libraries/Text/TextProps.windows.js +5 -32
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/{Blob/__mocks__/BlobModule.js → Types/CodegenTypesNamespace.js} +4 -6
- package/Libraries/Types/CoreEventTypes.d.ts +6 -1
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.windows.js +1 -1
- package/Libraries/Utilities/Appearance.js +2 -0
- package/Libraries/Utilities/BackHandler.js +17 -0
- package/Libraries/Utilities/DeviceInfo.js +2 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Platform.js +17 -0
- package/Libraries/Utilities/PlatformTypes.js +11 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +2 -2
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/WebSocket/WebSocket.js +313 -8
- package/Libraries/vendor/core/ErrorUtils.js +28 -2
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +0 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +248 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +55 -160
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +30 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +36 -0
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +36 -33
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +22 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +46 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +11 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +37 -5
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +177 -25
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +29 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +17 -34
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +225 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +23 -0
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +9 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -0
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +16 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +1 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +9 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +1 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +4 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +64 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.h +11 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +36 -96
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +1 -1
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +29 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.h +3 -0
- package/Microsoft.ReactNative/TurboModulesProvider.h +1 -1
- package/Microsoft.ReactNative/Utils/ThemeUtils.cpp +49 -0
- package/Microsoft.ReactNative/Utils/ThemeUtils.h +31 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/React.Cpp.props +4 -0
- package/PropertySheets/Warnings.props +45 -0
- package/README.md +6 -2
- package/ReactCommon/ReactCommon.vcxproj +9 -4
- package/ReactCommon/ReactCommon.vcxproj.filters +6 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +253 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +5 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +4 -8
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +184 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +22 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +2 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleWithJSIBindings.cpp +27 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +3 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityProps.cpp +308 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/DynamicEventPayload.cpp +42 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/css/CSSTokenizer.h +7 -51
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +10 -5
- package/Scripts/creaternwapp.cmd +9 -3
- package/Scripts/rnw-dependencies.ps1 +16 -3
- package/Shared/Shared.vcxitems +3 -2
- package/Shared/Shared.vcxitems.filters +2 -1
- package/codegen/NativeAnimatedModuleSpec.g.h +2 -0
- package/codegen/NativeAnimatedTurboModuleSpec.g.h +2 -0
- package/codegen/NativePerformanceSpec.g.h +14 -0
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +151 -127
- package/codegen/NativeSampleTurboModuleSpec.g.h +14 -8
- package/codegen/react/components/rnwcore/EventEmitters.cpp +48 -48
- package/codegen/rnwcoreJSI-generated.cpp +159 -129
- package/codegen/rnwcoreJSI.h +534 -408
- package/index.js +51 -331
- package/index.windows.js +70 -352
- package/interface.js +0 -4
- package/jest/resolver.js +31 -0
- package/jest/setup.js +6 -2
- package/package.json +29 -28
- package/src/private/animated/NativeAnimatedHelper.js +21 -8
- package/src/private/animated/createAnimatedPropsHook.js +11 -16
- package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
- package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
- package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
- package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
- package/src/private/{devmenu → devsupport/devmenu}/DevMenu.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BorderBox.js +3 -3
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BoxInspector.js +6 -5
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementBox.js +8 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementProperties.js +11 -10
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/Inspector.js +14 -12
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorOverlay.js +5 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorPanel.js +9 -8
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/NetworkOverlay.js +10 -9
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ReactDevToolsOverlay.js +7 -7
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/StyleInspector.js +7 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/XHRInterceptor.js +2 -2
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/getInspectorDataForViewAtPoint.js +4 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/resolveBoxStyle.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/perfmonitor}/PerformanceOverlay.js +6 -5
- package/src/private/{specs_DEPRECATED/modules → devsupport/devmenu/specs}/NativeDevMenu.js +2 -2
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.android.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.ios.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.windows.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/setUpFuseboxReactDevToolsDispatcher.js +1 -1
- package/src/private/{fusebox → devsupport/rndevtools}/specs/NativeReactDevToolsRuntimeSettingsModule.js +2 -2
- package/src/private/{specs_DEPRECATED/modules → devsupport/rndevtools/specs}/NativeReactDevToolsSettingsManager.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +82 -80
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +12 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -13
- package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +3 -0
- package/src/private/styles/composeStyles.js +12 -5
- package/src/private/types/HostComponent.js +1 -1
- package/src/private/types/HostInstance.js +67 -1
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/private/webapis/performance/Performance.js +1 -3
- package/src/private/webapis/performance/PerformanceEntry.js +6 -1
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +10 -1
- package/src/types/globals.d.ts +42 -0
- package/stubs/double-conversion/double-conversion.h +3 -1
- package/templates/cpp-app/template.config.js +2 -1
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +4 -0
- package/templates/cpp-lib/example/metro.config.js +1 -1
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +4 -0
- package/templates/old/generateWrapper.js +1 -1
- package/templates/old/uwp-cpp-app/template.config.js +1 -1
- package/types/index.d.ts +6 -3
- package/types/public/ReactNativeTypes.d.ts +2 -2
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +0 -38
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +0 -22
- package/Libraries/Blob/FileReader_new.js +0 -231
- package/Libraries/Blob/FileReader_old.js +0 -186
- package/Libraries/Blob/__mocks__/FileReaderModule.js +0 -20
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +0 -32
- package/Libraries/Core/__mocks__/ErrorUtils.js +0 -33
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -19
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +0 -49
- package/Libraries/Events/CustomEvent.js +0 -32
- package/Libraries/Events/EventPolyfill.js +0 -239
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +0 -118
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +0 -134
- package/Libraries/Network/XMLHttpRequest_new.js +0 -794
- package/Libraries/Network/XMLHttpRequest_old.js +0 -701
- package/Libraries/NewAppScreen/components/DebugInstructions.js +0 -41
- package/Libraries/NewAppScreen/components/DebugInstructions.windows.js +0 -30
- package/Libraries/NewAppScreen/components/Header.js +0 -77
- package/Libraries/NewAppScreen/components/HermesBadge.js +0 -53
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +0 -148
- package/Libraries/NewAppScreen/components/ReloadInstructions.js +0 -39
- package/Libraries/NewAppScreen/components/ReloadInstructions.windows.js +0 -31
- package/Libraries/NewAppScreen/components/logo.png +0 -0
- package/Libraries/NewAppScreen/index.js +0 -25
- package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +0 -58
- package/Libraries/Utilities/__mocks__/BackHandler.js +0 -45
- package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +0 -16
- package/Libraries/Utilities/__mocks__/PixelRatio.js +0 -25
- package/Libraries/WebSocket/WebSocketEvent.js +0 -30
- package/Libraries/WebSocket/WebSocket_new.js +0 -325
- package/Libraries/WebSocket/WebSocket_old.js +0 -297
- package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +0 -30
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +0 -81
- package/jest/__tests__/setup-test.js +0 -18
- package/src/private/components/VScrollViewNativeComponents.js +0 -25
- package/src/private/utilities/ensureInstance.js +0 -21
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +0 -267
- package/types/modules/LaunchScreen.d.ts +0 -18
- /package/src/private/{devmenu → devsupport/devmenu}/DevMenu.d.ts +0 -0
- /package/src/private/{debugging → devsupport/rndevtools}/FuseboxSessionObserver.js +0 -0
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
#include <AutoDraw.h>
|
|
9
9
|
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
10
10
|
#include <Fabric/Composition/UiaHelpers.h>
|
|
11
|
+
#include <Fabric/platform/react/renderer/graphics/PlatformColorUtils.h>
|
|
12
|
+
#include <Utils/ThemeUtils.h>
|
|
11
13
|
#include <Utils/ValueUtils.h>
|
|
12
14
|
#include <react/renderer/components/textinput/TextInputState.h>
|
|
15
|
+
#include <react/renderer/graphics/HostPlatformColor.h>
|
|
13
16
|
#include <react/renderer/textlayoutmanager/WindowsTextLayoutManager.h>
|
|
14
17
|
#include <tom.h>
|
|
15
18
|
#include <unicode.h>
|
|
@@ -316,24 +319,39 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
316
319
|
|
|
317
320
|
switch (nIndex) {
|
|
318
321
|
case COLOR_WINDOWTEXT:
|
|
319
|
-
if (m_outer->windowsTextInputProps().textAttributes.foregroundColor)
|
|
320
|
-
|
|
322
|
+
if (m_outer->windowsTextInputProps().textAttributes.foregroundColor) {
|
|
323
|
+
auto color = m_outer->theme()->Color(*m_outer->windowsTextInputProps().textAttributes.foregroundColor);
|
|
324
|
+
return RGB(color.R, color.G, color.B);
|
|
325
|
+
}
|
|
321
326
|
// cr = 0x000000FF;
|
|
322
327
|
break;
|
|
323
|
-
|
|
324
328
|
case COLOR_WINDOW:
|
|
325
329
|
if (m_outer->viewProps()->backgroundColor)
|
|
326
330
|
return (*m_outer->viewProps()->backgroundColor).AsColorRefNoAlpha();
|
|
327
331
|
break;
|
|
328
|
-
// case COLOR_HIGHLIGHT:
|
|
329
|
-
// cr = RGB(0, 0, 255);
|
|
330
|
-
// cr = 0x0000ffFF;
|
|
331
|
-
// break;
|
|
332
332
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
333
|
+
case COLOR_HIGHLIGHT:
|
|
334
|
+
if (m_outer->windowsTextInputProps().selectionColor) {
|
|
335
|
+
auto color = m_outer->theme()->Color(*m_outer->windowsTextInputProps().selectionColor);
|
|
336
|
+
return RGB(color.R, color.G, color.B);
|
|
337
|
+
}
|
|
338
|
+
break;
|
|
339
|
+
|
|
340
|
+
case COLOR_HIGHLIGHTTEXT:
|
|
341
|
+
// For selected text color, we use the same color as the selection background
|
|
342
|
+
// or the text color if selection color is not specified
|
|
343
|
+
if (m_outer->windowsTextInputProps().selectionColor) {
|
|
344
|
+
// Calculate appropriate text color based on selection background
|
|
345
|
+
auto selectionColor = (*m_outer->windowsTextInputProps().selectionColor).AsColorRefNoAlpha();
|
|
346
|
+
// Use white text for dark selection, black text for light selection
|
|
347
|
+
int r = GetRValue(selectionColor);
|
|
348
|
+
int g = GetGValue(selectionColor);
|
|
349
|
+
int b = GetBValue(selectionColor);
|
|
350
|
+
int brightness = ::Microsoft::ReactNative::CalculateColorBrightness(r, g, b);
|
|
351
|
+
return brightness > ::Microsoft::ReactNative::kCaretSelectionBrightnessThreshold ? RGB(0, 0, 0)
|
|
352
|
+
: RGB(255, 255, 255);
|
|
353
|
+
}
|
|
354
|
+
break;
|
|
337
355
|
|
|
338
356
|
// case COLOR_GRAYTEXT:
|
|
339
357
|
// cr = RGB(128, 128, 128);
|
|
@@ -749,6 +767,24 @@ void WindowsTextInputComponentView::OnPointerReleased(
|
|
|
749
767
|
auto hr = m_textServices->TxSendMessage(msg, static_cast<WPARAM>(wParam), static_cast<LPARAM>(lParam), &lresult);
|
|
750
768
|
args.Handled(hr != S_FALSE);
|
|
751
769
|
}
|
|
770
|
+
|
|
771
|
+
// Emits the OnPressOut event
|
|
772
|
+
if (m_eventEmitter && !m_comingFromJS) {
|
|
773
|
+
auto emitter = std::static_pointer_cast<const facebook::react::WindowsTextInputEventEmitter>(m_eventEmitter);
|
|
774
|
+
float offsetX = position.X - m_layoutMetrics.frame.origin.x;
|
|
775
|
+
float offsetY = position.Y - m_layoutMetrics.frame.origin.y;
|
|
776
|
+
float neutralX = m_layoutMetrics.frame.origin.x;
|
|
777
|
+
float neutralY = m_layoutMetrics.frame.origin.y;
|
|
778
|
+
|
|
779
|
+
facebook::react::GestureResponderEvent pressOutArgs;
|
|
780
|
+
pressOutArgs.target = m_tag;
|
|
781
|
+
pressOutArgs.pagePoint = {position.X, position.Y};
|
|
782
|
+
pressOutArgs.offsetPoint = {offsetX, offsetY}; //{LocationX,LocationY}
|
|
783
|
+
pressOutArgs.timestamp = static_cast<double>(pp.Timestamp()) / 1000.0;
|
|
784
|
+
pressOutArgs.identifier = pp.PointerId();
|
|
785
|
+
|
|
786
|
+
emitter->onPressOut(pressOutArgs);
|
|
787
|
+
}
|
|
752
788
|
}
|
|
753
789
|
|
|
754
790
|
void WindowsTextInputComponentView::OnPointerMoved(
|
|
@@ -783,6 +819,29 @@ void WindowsTextInputComponentView::OnPointerMoved(
|
|
|
783
819
|
DVASPECT_CONTENT, -1, nullptr, nullptr, nullptr, nullptr, nullptr, ptContainer.x, ptContainer.y);
|
|
784
820
|
}
|
|
785
821
|
|
|
822
|
+
void WindowsTextInputComponentView::OnPointerWheelChanged(
|
|
823
|
+
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
824
|
+
if (windowsTextInputProps().scrollEnabled && windowsTextInputProps().multiline) {
|
|
825
|
+
auto pointerPointProperties = args.GetCurrentPoint(-1).Properties();
|
|
826
|
+
|
|
827
|
+
auto delta = static_cast<float>(pointerPointProperties.MouseWheelDelta());
|
|
828
|
+
|
|
829
|
+
if (m_textServices && !pointerPointProperties.IsHorizontalMouseWheel()) {
|
|
830
|
+
// Vertical scrolling
|
|
831
|
+
if (delta > 0) {
|
|
832
|
+
m_textServices->TxSendMessage(WM_VSCROLL, SB_LINEUP, 0, nullptr);
|
|
833
|
+
} else {
|
|
834
|
+
m_textServices->TxSendMessage(WM_VSCROLL, SB_LINEDOWN, 0, nullptr);
|
|
835
|
+
}
|
|
836
|
+
args.Handled(true);
|
|
837
|
+
}
|
|
838
|
+
// Emit the onScroll event
|
|
839
|
+
EmitOnScrollEvent();
|
|
840
|
+
|
|
841
|
+
// We don't support horizontal scrolling yet cause it is not implemented in Android/IOS
|
|
842
|
+
}
|
|
843
|
+
Super::OnPointerWheelChanged(args);
|
|
844
|
+
}
|
|
786
845
|
void WindowsTextInputComponentView::OnKeyDown(
|
|
787
846
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
788
847
|
// Do not forward tab keys into the TextInput, since we want that to do the tab loop instead. This aligns with WinUI
|
|
@@ -808,7 +867,6 @@ void WindowsTextInputComponentView::OnKeyDown(
|
|
|
808
867
|
args.Handled(true);
|
|
809
868
|
}
|
|
810
869
|
}
|
|
811
|
-
|
|
812
870
|
Super::OnKeyDown(args);
|
|
813
871
|
}
|
|
814
872
|
|
|
@@ -838,7 +896,6 @@ void WindowsTextInputComponentView::OnKeyUp(
|
|
|
838
896
|
args.Handled(true);
|
|
839
897
|
}
|
|
840
898
|
}
|
|
841
|
-
|
|
842
899
|
Super::OnKeyUp(args);
|
|
843
900
|
}
|
|
844
901
|
|
|
@@ -1028,13 +1085,9 @@ std::string WindowsTextInputComponentView::DefaultHelpText() const noexcept {
|
|
|
1028
1085
|
void WindowsTextInputComponentView::updateCursorColor(
|
|
1029
1086
|
const facebook::react::SharedColor &cursorColor,
|
|
1030
1087
|
const facebook::react::SharedColor &foregroundColor) noexcept {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
m_caretVisual.Brush(theme()->Brush(*foregroundColor));
|
|
1035
|
-
} else {
|
|
1036
|
-
m_caretVisual.Brush(theme()->PlatformBrush("TextControlForeground"));
|
|
1037
|
-
}
|
|
1088
|
+
const auto &props = windowsTextInputProps();
|
|
1089
|
+
auto caretColor = ::Microsoft::ReactNative::GetCaretColor(cursorColor, foregroundColor, props.backgroundColor);
|
|
1090
|
+
m_caretVisual.Brush(theme()->Brush(*caretColor));
|
|
1038
1091
|
}
|
|
1039
1092
|
|
|
1040
1093
|
void WindowsTextInputComponentView::updateProps(
|
|
@@ -1052,7 +1105,10 @@ void WindowsTextInputComponentView::updateProps(
|
|
|
1052
1105
|
oldTextInputProps.textAttributes.fontWeight != newTextInputProps.textAttributes.fontWeight ||
|
|
1053
1106
|
!facebook::react::floatEquality(
|
|
1054
1107
|
oldTextInputProps.textAttributes.letterSpacing, newTextInputProps.textAttributes.letterSpacing) ||
|
|
1055
|
-
oldTextInputProps.textAttributes.fontFamily != newTextInputProps.textAttributes.fontFamily
|
|
1108
|
+
oldTextInputProps.textAttributes.fontFamily != newTextInputProps.textAttributes.fontFamily ||
|
|
1109
|
+
!facebook::react::floatEquality(
|
|
1110
|
+
oldTextInputProps.textAttributes.maxFontSizeMultiplier,
|
|
1111
|
+
newTextInputProps.textAttributes.maxFontSizeMultiplier)) {
|
|
1056
1112
|
m_propBitsMask |= TXTBIT_CHARFORMATCHANGE;
|
|
1057
1113
|
m_propBits |= TXTBIT_CHARFORMATCHANGE;
|
|
1058
1114
|
}
|
|
@@ -1126,11 +1182,14 @@ void WindowsTextInputComponentView::updateProps(
|
|
|
1126
1182
|
bool effectiveSpellCheck = newTextInputProps.spellCheck || newTextInputProps.autoCorrect;
|
|
1127
1183
|
updateSpellCheck(effectiveSpellCheck);
|
|
1128
1184
|
}
|
|
1129
|
-
|
|
1130
1185
|
if (!oldProps || oldTextInputProps.autoCorrect != newTextInputProps.autoCorrect) {
|
|
1131
1186
|
updateAutoCorrect(newTextInputProps.autoCorrect);
|
|
1132
1187
|
}
|
|
1133
1188
|
|
|
1189
|
+
if (oldTextInputProps.selectionColor != newTextInputProps.selectionColor) {
|
|
1190
|
+
m_needsRedraw = true;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1134
1193
|
UpdatePropertyBits();
|
|
1135
1194
|
}
|
|
1136
1195
|
|
|
@@ -1216,6 +1275,49 @@ void WindowsTextInputComponentView::updateLayoutMetrics(
|
|
|
1216
1275
|
m_imgHeight = newHeight;
|
|
1217
1276
|
}
|
|
1218
1277
|
|
|
1278
|
+
std::pair<float, float> WindowsTextInputComponentView::GetContentSize() const noexcept {
|
|
1279
|
+
if (!m_textServices)
|
|
1280
|
+
return {0.0f, 0.0f};
|
|
1281
|
+
|
|
1282
|
+
// Get a device context for measurement
|
|
1283
|
+
HDC hdc = GetDC(nullptr);
|
|
1284
|
+
if (!hdc)
|
|
1285
|
+
return {0.0f, 0.0f};
|
|
1286
|
+
|
|
1287
|
+
// Use the layout width as the constraint (always multiline)
|
|
1288
|
+
float availableWidth = m_layoutMetrics.frame.size.width;
|
|
1289
|
+
float scale = m_layoutMetrics.pointScaleFactor;
|
|
1290
|
+
float dpi = m_layoutMetrics.pointScaleFactor * GetDpiForSystem();
|
|
1291
|
+
constexpr float HIMETRIC_PER_INCH = 2540.0f;
|
|
1292
|
+
|
|
1293
|
+
SIZE extentHimetric = {
|
|
1294
|
+
static_cast<LONG>(availableWidth * scale * HIMETRIC_PER_INCH / dpi),
|
|
1295
|
+
static_cast<LONG>(std::numeric_limits<LONG>::max() * HIMETRIC_PER_INCH / dpi)};
|
|
1296
|
+
|
|
1297
|
+
SIZE naturalSize = {0, 0};
|
|
1298
|
+
|
|
1299
|
+
HRESULT hr = m_textServices->TxGetNaturalSize(
|
|
1300
|
+
DVASPECT_CONTENT,
|
|
1301
|
+
hdc,
|
|
1302
|
+
nullptr,
|
|
1303
|
+
nullptr,
|
|
1304
|
+
static_cast<DWORD>(TXTNS_FITTOCONTENTWSP),
|
|
1305
|
+
reinterpret_cast<SIZEL *>(&extentHimetric),
|
|
1306
|
+
&naturalSize.cx,
|
|
1307
|
+
&naturalSize.cy);
|
|
1308
|
+
|
|
1309
|
+
ReleaseDC(nullptr, hdc);
|
|
1310
|
+
|
|
1311
|
+
if (FAILED(hr)) {
|
|
1312
|
+
return {0.0f, 0.0f};
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
float contentWidth = static_cast<float>(naturalSize.cx) / scale;
|
|
1316
|
+
float contentHeight = static_cast<float>(naturalSize.cy) / scale;
|
|
1317
|
+
|
|
1318
|
+
return {contentWidth, contentHeight};
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1219
1321
|
// When we are notified by RichEdit that the text changed, we need to notify JS
|
|
1220
1322
|
void WindowsTextInputComponentView::OnTextUpdated() noexcept {
|
|
1221
1323
|
auto data = m_state->getData();
|
|
@@ -1234,6 +1336,13 @@ void WindowsTextInputComponentView::OnTextUpdated() noexcept {
|
|
|
1234
1336
|
onChangeArgs.text = GetTextFromRichEdit();
|
|
1235
1337
|
onChangeArgs.eventCount = ++m_nativeEventCount;
|
|
1236
1338
|
emitter->onChange(onChangeArgs);
|
|
1339
|
+
if (windowsTextInputProps().multiline) {
|
|
1340
|
+
auto [contentWidth, contentHeight] = GetContentSize();
|
|
1341
|
+
facebook::react::WindowsTextInputEventEmitter::OnContentSizeChange onContentSizeChangeArgs;
|
|
1342
|
+
onContentSizeChangeArgs.contentSize.width = contentWidth;
|
|
1343
|
+
onContentSizeChangeArgs.contentSize.height = contentHeight;
|
|
1344
|
+
emitter->onContentSizeChange(onContentSizeChangeArgs);
|
|
1345
|
+
}
|
|
1237
1346
|
}
|
|
1238
1347
|
|
|
1239
1348
|
if (UiaClientsAreListening()) {
|
|
@@ -1243,6 +1352,22 @@ void WindowsTextInputComponentView::OnTextUpdated() noexcept {
|
|
|
1243
1352
|
}
|
|
1244
1353
|
}
|
|
1245
1354
|
|
|
1355
|
+
void WindowsTextInputComponentView::EmitOnScrollEvent() noexcept {
|
|
1356
|
+
if (!windowsTextInputProps().scrollEnabled || !m_eventEmitter || m_comingFromJS || !m_textServices) {
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
LONG hMin, hMax, hPos, hPage;
|
|
1360
|
+
LONG vMin, vMax, vPos, vPage;
|
|
1361
|
+
BOOL hEnabled, vEnabled;
|
|
1362
|
+
winrt::check_hresult(m_textServices->TxGetHScroll(&hMin, &hMax, &hPos, &hPage, &hEnabled));
|
|
1363
|
+
winrt::check_hresult(m_textServices->TxGetVScroll(&vMin, &vMax, &vPos, &vPage, &vEnabled));
|
|
1364
|
+
facebook::react::Point offset;
|
|
1365
|
+
offset.x = static_cast<float>(hPos);
|
|
1366
|
+
offset.y = static_cast<float>(vPos);
|
|
1367
|
+
auto emitter = std::static_pointer_cast<const facebook::react::WindowsTextInputEventEmitter>(m_eventEmitter);
|
|
1368
|
+
emitter->onScroll(offset);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1246
1371
|
void WindowsTextInputComponentView::OnSelectionChanged(LONG start, LONG end) noexcept {
|
|
1247
1372
|
if (m_eventEmitter && !m_comingFromState /* && !m_comingFromJS ?? */) {
|
|
1248
1373
|
auto emitter = std::static_pointer_cast<const facebook::react::WindowsTextInputEventEmitter>(m_eventEmitter);
|
|
@@ -1308,6 +1433,13 @@ void WindowsTextInputComponentView::onMounted() noexcept {
|
|
|
1308
1433
|
m_propBits |= TXTBIT_CHARFORMATCHANGE;
|
|
1309
1434
|
}
|
|
1310
1435
|
InternalFinalize();
|
|
1436
|
+
|
|
1437
|
+
// Handle autoFocus property - focus the component when mounted if autoFocus is true
|
|
1438
|
+
if (windowsTextInputProps().autoFocus) {
|
|
1439
|
+
if (auto root = rootComponentView()) {
|
|
1440
|
+
root->TrySetFocusedComponent(*get_strong(), winrt::Microsoft::ReactNative::FocusNavigationDirection::None);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1311
1443
|
}
|
|
1312
1444
|
|
|
1313
1445
|
std::optional<std::string> WindowsTextInputComponentView::getAccessiblityValue() noexcept {
|
|
@@ -1352,9 +1484,15 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
|
1352
1484
|
|
|
1353
1485
|
// set font size -- 15 to convert twips to pt
|
|
1354
1486
|
const auto &props = windowsTextInputProps();
|
|
1355
|
-
float fontSize =
|
|
1487
|
+
float fontSize =
|
|
1356
1488
|
(std::isnan(props.textAttributes.fontSize) ? facebook::react::TextAttributes::defaultTextAttributes().fontSize
|
|
1357
1489
|
: props.textAttributes.fontSize);
|
|
1490
|
+
|
|
1491
|
+
// Apply maxFontSizeMultiplier if specified
|
|
1492
|
+
auto maxFontSizeMultiplier = windowsTextInputProps().textAttributes.maxFontSizeMultiplier;
|
|
1493
|
+
fontSize *=
|
|
1494
|
+
(maxFontSizeMultiplier >= 1.0f) ? std::min(maxFontSizeMultiplier, m_fontSizeMultiplier) : m_fontSizeMultiplier;
|
|
1495
|
+
|
|
1358
1496
|
// TODO get fontSize from props.textAttributes, or defaultTextAttributes, or fragment?
|
|
1359
1497
|
cfNew.dwMask |= CFM_SIZE;
|
|
1360
1498
|
cfNew.yHeight = static_cast<LONG>(fontSize * 15);
|
|
@@ -1461,6 +1599,8 @@ void WindowsTextInputComponentView::ensureDrawingSurface() noexcept {
|
|
|
1461
1599
|
|
|
1462
1600
|
void WindowsTextInputComponentView::ShowCaret(bool show) noexcept {
|
|
1463
1601
|
ensureVisual();
|
|
1602
|
+
const auto &props = windowsTextInputProps();
|
|
1603
|
+
updateCursorColor(props.cursorColor, props.textAttributes.foregroundColor);
|
|
1464
1604
|
m_caretVisual.IsVisible(show);
|
|
1465
1605
|
}
|
|
1466
1606
|
|
|
@@ -1555,8 +1695,20 @@ void WindowsTextInputComponentView::DrawText() noexcept {
|
|
|
1555
1695
|
auto color = theme()->D2DColor(*props.placeholderTextColor);
|
|
1556
1696
|
winrt::check_hresult(d2dDeviceContext->CreateSolidColorBrush(color, brush.put()));
|
|
1557
1697
|
} else {
|
|
1558
|
-
|
|
1559
|
-
|
|
1698
|
+
// Use theme-aware placeholder color based on focus state and background
|
|
1699
|
+
// Color selection follows Windows 11 design system semantic colors:
|
|
1700
|
+
// - High contrast: System GrayText for accessibility
|
|
1701
|
+
// - Light backgrounds: Darker grays for better contrast
|
|
1702
|
+
// - Dark backgrounds: Lighter grays for readability
|
|
1703
|
+
winrt::Windows::UI::Color backgroundColor = {};
|
|
1704
|
+
if (facebook::react::isColorMeaningful(props.backgroundColor)) {
|
|
1705
|
+
auto bgColor = (*props.backgroundColor).AsWindowsColor();
|
|
1706
|
+
backgroundColor = bgColor;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
auto placeholderColor = facebook::react::GetTextInputPlaceholderColor(m_hasFocus, backgroundColor);
|
|
1710
|
+
auto d2dColor = theme()->D2DColor(*placeholderColor);
|
|
1711
|
+
winrt::check_hresult(d2dDeviceContext->CreateSolidColorBrush(d2dColor, brush.put()));
|
|
1560
1712
|
}
|
|
1561
1713
|
|
|
1562
1714
|
// Create placeholder text layout
|
|
@@ -60,6 +60,8 @@ struct WindowsTextInputComponentView
|
|
|
60
60
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept override;
|
|
61
61
|
void OnPointerMoved(
|
|
62
62
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept override;
|
|
63
|
+
void OnPointerWheelChanged(
|
|
64
|
+
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept override;
|
|
63
65
|
|
|
64
66
|
void OnKeyDown(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
|
|
65
67
|
void OnKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
|
|
@@ -97,7 +99,9 @@ struct WindowsTextInputComponentView
|
|
|
97
99
|
void UpdateParaFormat() noexcept;
|
|
98
100
|
void UpdateText(const std::string &str) noexcept;
|
|
99
101
|
void OnTextUpdated() noexcept;
|
|
102
|
+
void EmitOnScrollEvent() noexcept;
|
|
100
103
|
void OnSelectionChanged(LONG start, LONG end) noexcept;
|
|
104
|
+
std::pair<float, float> GetContentSize() const noexcept;
|
|
101
105
|
std::string GetTextFromRichEdit() const noexcept;
|
|
102
106
|
void updateCursorColor(
|
|
103
107
|
const facebook::react::SharedColor &cursorColor,
|
|
@@ -93,4 +93,33 @@ void WindowsTextInputEventEmitter::onEndEditing(OnEndEditing event) const {
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
void WindowsTextInputEventEmitter::onPressOut(GestureResponderEvent event) const {
|
|
97
|
+
dispatchEvent("textInputPressOut", [event = std::move(event)](jsi::Runtime &runtime) {
|
|
98
|
+
auto payload = jsi::Object(runtime);
|
|
99
|
+
auto nativeEvent = jsi::Object(runtime);
|
|
100
|
+
nativeEvent.setProperty(runtime, "target", static_cast<double>(event.target));
|
|
101
|
+
nativeEvent.setProperty(runtime, "pageX", event.pagePoint.x);
|
|
102
|
+
nativeEvent.setProperty(runtime, "pageY", event.pagePoint.y);
|
|
103
|
+
nativeEvent.setProperty(runtime, "locationX", event.offsetPoint.x);
|
|
104
|
+
nativeEvent.setProperty(runtime, "locationY", event.offsetPoint.y);
|
|
105
|
+
nativeEvent.setProperty(runtime, "timestamp", event.timestamp);
|
|
106
|
+
nativeEvent.setProperty(runtime, "identifier", static_cast<double>(event.identifier));
|
|
107
|
+
payload.setProperty(runtime, "nativeEvent", nativeEvent);
|
|
108
|
+
return payload;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
void WindowsTextInputEventEmitter::onScroll(facebook::react::Point offset) const {
|
|
113
|
+
dispatchEvent("textInputScroll", [offset = std::move(offset)](jsi::Runtime &runtime) {
|
|
114
|
+
auto payload = jsi::Object(runtime);
|
|
115
|
+
{
|
|
116
|
+
auto contentOffsetObj = jsi::Object(runtime);
|
|
117
|
+
contentOffsetObj.setProperty(runtime, "x", offset.x);
|
|
118
|
+
contentOffsetObj.setProperty(runtime, "y", offset.y);
|
|
119
|
+
payload.setProperty(runtime, "contentOffset", contentOffsetObj);
|
|
120
|
+
}
|
|
121
|
+
return payload;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
96
125
|
} // namespace facebook::react
|
|
@@ -54,6 +54,8 @@ class WindowsTextInputEventEmitter : public ViewEventEmitter {
|
|
|
54
54
|
void onContentSizeChange(OnContentSizeChange value) const;
|
|
55
55
|
void onPressIn(GestureResponderEvent event) const override;
|
|
56
56
|
void onEndEditing(OnEndEditing value) const;
|
|
57
|
+
void onPressOut(GestureResponderEvent event) const override;
|
|
58
|
+
void onScroll(facebook::react::Point offset) const;
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
} // namespace facebook::react
|
|
@@ -25,10 +25,11 @@ Size WindowsTextInputShadowNode::measureContent(
|
|
|
25
25
|
const LayoutContext &layoutContext,
|
|
26
26
|
const LayoutConstraints &layoutConstraints) const {
|
|
27
27
|
// Layout is called right after measure.
|
|
28
|
-
// Measure is marked as `const`, and `layout` is not; so State can be
|
|
29
|
-
// during layout, but not during `measure`. If State is out-of-date
|
|
30
|
-
// it's too late: measure will have already operated on old
|
|
31
|
-
// use the same value here that we *will* use in layout to
|
|
28
|
+
// Measure is marked as `const`, and `layout` is not; so State can be
|
|
29
|
+
// updated during layout, but not during `measure`. If State is out-of-date
|
|
30
|
+
// in layout, it's too late: measure will have already operated on old
|
|
31
|
+
// State. Thus, we use the same value here that we *will* use in layout to
|
|
32
|
+
// update the state.
|
|
32
33
|
AttributedString attributedString = getMostRecentAttributedString(layoutContext);
|
|
33
34
|
|
|
34
35
|
if (attributedString.isEmpty()) {
|
|
@@ -88,9 +89,8 @@ LayoutConstraints WindowsTextInputShadowNode::getTextConstraints(const LayoutCon
|
|
|
88
89
|
|
|
89
90
|
void WindowsTextInputShadowNode::updateStateIfNeeded(const LayoutContext &layoutContext) {
|
|
90
91
|
ensureUnsealed();
|
|
91
|
-
|
|
92
|
-
auto reactTreeAttributedString = getAttributedString(layoutContext);
|
|
93
92
|
const auto &stateData = getStateData();
|
|
93
|
+
auto reactTreeAttributedString = getAttributedString(layoutContext);
|
|
94
94
|
|
|
95
95
|
// Tree is often out of sync with the value of the TextInput.
|
|
96
96
|
// This is by design - don't change the value of the TextInput in the State,
|
|
@@ -124,6 +124,7 @@ void WindowsTextInputShadowNode::updateStateIfNeeded(const LayoutContext &layout
|
|
|
124
124
|
// current attributedString unchanged, and pass in zero for the "event count"
|
|
125
125
|
// so no changes are applied There's no way to prevent a state update from
|
|
126
126
|
// flowing to Java, so we just ensure it's a noop in those cases.
|
|
127
|
+
|
|
127
128
|
setStateData(facebook::react::TextInputState{
|
|
128
129
|
AttributedStringBox(newAttributedString), reactTreeAttributedString, {}, newEventCount});
|
|
129
130
|
}
|
|
@@ -133,7 +134,6 @@ AttributedString WindowsTextInputShadowNode::getAttributedString(const LayoutCon
|
|
|
133
134
|
|
|
134
135
|
auto childTextAttributes = TextAttributes::defaultTextAttributes();
|
|
135
136
|
childTextAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
136
|
-
|
|
137
137
|
childTextAttributes.apply(getConcreteProps().textAttributes);
|
|
138
138
|
// Don't propagate the background color of the TextInput onto the attributed
|
|
139
139
|
// string. Android tries to render shadow of the background alongside the
|
|
@@ -151,6 +151,7 @@ AttributedString WindowsTextInputShadowNode::getAttributedString(const LayoutCon
|
|
|
151
151
|
auto textAttributes = TextAttributes::defaultTextAttributes();
|
|
152
152
|
textAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
153
153
|
textAttributes.apply(getConcreteProps().textAttributes);
|
|
154
|
+
textAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
154
155
|
auto fragment = AttributedString::Fragment{};
|
|
155
156
|
fragment.string = getConcreteProps().text;
|
|
156
157
|
fragment.textAttributes = textAttributes;
|
|
@@ -187,36 +188,18 @@ AttributedString WindowsTextInputShadowNode::getMostRecentAttributedString(const
|
|
|
187
188
|
// TODO T67606511: We will redefine the measurement of empty strings as part
|
|
188
189
|
// of T67606511
|
|
189
190
|
AttributedString WindowsTextInputShadowNode::getPlaceholderAttributedString(const LayoutContext &layoutContext) const {
|
|
190
|
-
|
|
191
|
-
auto textAttributedString = AttributedString{};
|
|
192
|
-
auto fragment = AttributedString::Fragment{};
|
|
193
|
-
fragment.string = getConcreteProps().placeholder;
|
|
194
|
-
|
|
195
|
-
if (fragment.string.empty()) {
|
|
196
|
-
fragment.string = BaseTextShadowNode::getEmptyPlaceholder();
|
|
197
|
-
}
|
|
191
|
+
const auto &props = BaseShadowNode::getConcreteProps();
|
|
198
192
|
|
|
193
|
+
AttributedString attributedString;
|
|
194
|
+
auto placeholderString = !props.placeholder.empty() ? props.placeholder : BaseTextShadowNode::getEmptyPlaceholder();
|
|
199
195
|
auto textAttributes = TextAttributes::defaultTextAttributes();
|
|
200
196
|
textAttributes.fontSizeMultiplier = layoutContext.fontSizeMultiplier;
|
|
201
|
-
textAttributes.apply(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
textAttributedString.appendFragment(std::move(fragment));
|
|
208
|
-
|
|
209
|
-
return textAttributedString;
|
|
210
|
-
// TextLayoutContext textLayoutContext;
|
|
211
|
-
// textLayoutContext.pointScaleFactor = layoutContext.pointScaleFactor;
|
|
212
|
-
// auto textSize = textLayoutManager_
|
|
213
|
-
// ->measure(
|
|
214
|
-
// AttributedStringBox{attributedString},
|
|
215
|
-
// getConcreteProps().paragraphAttributes,
|
|
216
|
-
// textLayoutContext,
|
|
217
|
-
// textConstraints)
|
|
218
|
-
// .size;
|
|
219
|
-
// return layoutConstraints.clamp(textSize);
|
|
197
|
+
textAttributes.apply(props.textAttributes);
|
|
198
|
+
attributedString.appendFragment(
|
|
199
|
+
{.string = std::move(placeholderString),
|
|
200
|
+
.textAttributes = textAttributes,
|
|
201
|
+
.parentShadowView = ShadowView(*this)});
|
|
202
|
+
return attributedString;
|
|
220
203
|
}
|
|
221
204
|
|
|
222
205
|
#pragma mark - LayoutableShadowNode
|