react-native-windows 0.82.1 → 0.83.0-preview.0
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 +2 -7
- package/Libraries/Animated/components/AnimatedFlatList.js +5 -3
- package/Libraries/Animated/components/AnimatedImage.js +4 -3
- package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
- package/Libraries/Animated/components/AnimatedText.js +7 -3
- package/Libraries/Animated/components/AnimatedView.js +3 -2
- package/Libraries/Animated/createAnimatedComponent.js +24 -12
- package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +43 -15
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +43 -15
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +2 -2
- package/Libraries/Components/Glyph/Glyph.js +4 -1
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +2 -2
- package/Libraries/Components/RefreshControl/RefreshControl.d.ts +3 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +1 -0
- package/Libraries/Components/ScrollView/ScrollView.windows.js +1 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -6
- package/Libraries/Components/Switch/Switch.d.ts +2 -2
- package/Libraries/Components/Switch/Switch.windows.js +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +2 -5
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +6 -0
- package/Libraries/Components/Touchable/TouchableBounce.js +7 -7
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +7 -7
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +19 -1
- package/Libraries/Components/View/View.d.ts +2 -2
- package/Libraries/Components/View/View.windows.js +0 -1
- package/Libraries/Components/View/ViewNativeComponent.js +13 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpPerformance.js +2 -0
- package/Libraries/Debugging/DebuggingOverlay.js +14 -14
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +8 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -2
- package/Libraries/Image/Image.d.ts +3 -3
- package/Libraries/Image/ImageInjection.js +3 -6
- package/Libraries/Image/ImageTypes.flow.js +3 -7
- package/Libraries/Lists/FlatList.js +8 -8
- package/Libraries/Lists/SectionList.d.ts +5 -1
- package/Libraries/Lists/ViewabilityHelper.js +1 -1
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/LogBox/UI/AnsiHighlight.js +4 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +11 -2
- package/Libraries/NativeComponent/NativeComponentRegistry.d.ts +98 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -0
- package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +3 -1
- package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +45 -0
- package/Libraries/Network/RCTNetworking.android.js +3 -1
- package/Libraries/Network/RCTNetworking.ios.js +3 -0
- package/Libraries/Network/RCTNetworking.windows.js +3 -0
- package/Libraries/Network/XMLHttpRequest.js +1 -41
- package/Libraries/Pressability/usePressability.js +14 -3
- package/Libraries/ReactNative/PaperUIManager.windows.js +3 -3
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +20 -82
- package/Libraries/ReactNative/getNativeComponentAttributes.js +12 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +6759 -4478
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3169 -3119
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4732 -3535
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +6646 -4070
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3136 -2825
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4761 -3312
- package/Libraries/Renderer/shims/ReactNative.js +3 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +2 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +44 -0
- package/Libraries/StyleSheet/processBackgroundPosition.js +284 -0
- package/Libraries/StyleSheet/processBackgroundRepeat.js +105 -0
- package/Libraries/StyleSheet/processBackgroundSize.js +104 -0
- package/Libraries/Text/Text.d.ts +2 -2
- package/Libraries/Text/TextNativeComponent.js +10 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +3 -9
- package/Libraries/Utilities/DevLoadingView.js +14 -6
- package/Libraries/Utilities/HMRClient.js +13 -5
- package/Microsoft.ReactNative/Base/CxxReactIncludes.h +11 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +2 -0
- package/Microsoft.ReactNative/CompositionHwndHost.idl +1 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +10 -40
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +3 -80
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +45 -12
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +8 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +61 -74
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +4 -3
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.cpp +245 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.h +80 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +20 -36
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +70 -49
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +7 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +1 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +20 -94
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -3
- package/Microsoft.ReactNative/Pch/pch.h +2 -0
- package/Microsoft.ReactNative/ReactHost/CrashManager.cpp +5 -0
- package/Microsoft.ReactNative/ReactHost/ReactNativeHeaders.h +1 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +0 -41
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +0 -11
- package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -3
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +31 -101
- package/Microsoft.ReactNative/ReactNativeWin32App.h +2 -13
- package/Microsoft.ReactNative/ReactNativeWindow.idl +44 -0
- package/Microsoft.ReactNative.Cxx/AutoDraw.h +9 -1
- package/Microsoft.ReactNative.Cxx/ReactCommon/CallInvoker.h +13 -16
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +24 -36
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModuleUtils.h +5 -8
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/AString.h +8 -6
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Array.h +32 -49
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Base.h +27 -76
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bool.h +4 -2
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/CallbackWrapper.h +19 -18
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Class.h +25 -48
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Convert.h +38 -31
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Error.h +11 -6
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/EventEmitter.h +47 -45
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Function.h +69 -89
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/HighResTimeStamp.h +8 -8
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/LongLivedObject.h +6 -6
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Number.h +16 -8
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Object.h +17 -24
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Promise.h +17 -17
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Value.h +20 -29
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/debug/react_native_assert.h +2 -7
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/timing/primitives.h +127 -115
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.props +10 -0
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.props +10 -0
- package/PropertySheets/Generated/PackageVersion.g.props +5 -5
- package/PropertySheets/Warnings.props +2 -1
- package/ReactCommon/ReactCommon.vcxproj +21 -12
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/Instance.cpp +381 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +49 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +145 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/MethodCall.cpp +100 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ModuleRegistry.cpp +256 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +13 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/RAMBundleRegistry.cpp +93 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +149 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +25 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +86 -67
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +629 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSINativeModules.cpp +123 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +84 -68
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +31 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/Utf8.h +4 -5
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/network/HttpUtils.cpp +2 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +24 -36
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.h +28 -66
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/webperformance/NativePerformance.cpp +414 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +8 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +19 -16
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +8 -9
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +25 -95
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +85 -42
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +81 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +140 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +25 -31
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +746 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +702 -0
- package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +1 -15
- package/Scripts/creaternwapp.cmd +1 -1
- package/Scripts/perf/compare-results.js +357 -0
- package/Scripts/perf/create-perf-test.js +343 -0
- package/Scripts/perf/post-pr-comment.js +210 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +8 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.h +3 -0
- package/Shared/Shared.vcxitems +24 -12
- package/Shared/Shared.vcxitems.filters +11 -3
- package/codegen/NativeIntersectionObserverSpec.g.h +2 -0
- package/codegen/NativeNetworkingIOSSpec.g.h +2 -0
- package/codegen/NativePerformanceSpec.g.h +6 -0
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +229 -139
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +2 -1
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +42 -25
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +2 -1
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +2 -1
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +11 -6
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +11 -6
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +1 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +2 -1
- package/codegen/react/components/rnwcore/ModalHostView.g.h +40 -23
- package/codegen/react/components/rnwcore/Props.cpp +6 -1
- package/codegen/react/components/rnwcore/Props.h +1 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +11 -6
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +1 -0
- package/codegen/react/components/rnwcore/Switch.g.h +11 -6
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +2 -1
- package/codegen/react/components/rnwcore/VirtualView.g.h +41 -8
- package/codegen/react/components/rnwcore/VirtualViewExperimental.g.h +45 -8
- package/codegen/rnwcoreJSI.h +3973 -6059
- package/index.js +6 -0
- package/index.windows.js +6 -0
- package/jest/mockComponent.js +6 -6
- package/jest/setup.js +15 -10
- package/package.json +27 -27
- package/src/private/components/virtualview/VirtualView.js +22 -27
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +6 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +100 -19
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +18 -3
- package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +12 -2
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +76 -15
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/ResourceTiming.js +31 -4
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +4 -1
- package/src/private/webapis/performance/specs/NativePerformance.js +3 -0
- package/stubs/double-conversion/double-conversion.h +5 -0
- package/templates/cpp-app/template.config.js +1 -1
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +3 -1
- package/templates/cpp-lib/template.config.js +1 -1
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
- package/types/index.d.ts +1 -0
- package/types/public/ReactNativeTypes.d.ts +115 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +0 -152
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +0 -1574
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ShadowNode.cpp +0 -528
- package/Scripts/OpenSSL.nuspec +0 -39
- package/Scripts/OpenSSL.targets +0 -36
- package/codegen/rnwcoreJSI-generated.cpp +0 -3470
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h
CHANGED
|
@@ -32,36 +32,29 @@ virtual State::Shared createInitialState(
|
|
|
32
32
|
|
|
33
33
|
ThemePadding theme;
|
|
34
34
|
// TODO: figure out RTL/start/end/left/right stuff here
|
|
35
|
-
if (surfaceIdToThemePaddingMap_.find(surfaceId) !=
|
|
36
|
-
surfaceIdToThemePaddingMap_.end()) {
|
|
35
|
+
if (surfaceIdToThemePaddingMap_.find(surfaceId) != surfaceIdToThemePaddingMap_.end()) {
|
|
37
36
|
theme = surfaceIdToThemePaddingMap_[surfaceId];
|
|
38
37
|
} else {
|
|
39
|
-
const jni::global_ref<jobject
|
|
38
|
+
const jni::global_ref<jobject> &fabricUIManager =
|
|
40
39
|
contextContainer_->at<jni::global_ref<jobject>>("FabricUIManager");
|
|
41
40
|
|
|
42
41
|
auto env = jni::Environment::current();
|
|
43
42
|
auto defaultTextInputPaddingArray = env->NewFloatArray(4);
|
|
44
43
|
static auto getThemeData =
|
|
45
|
-
jni::findClassStatic(UIManagerJavaDescriptor)
|
|
46
|
-
->getMethod<jboolean(jint, jfloatArray)>("getThemeData");
|
|
44
|
+
jni::findClassStatic(UIManagerJavaDescriptor)->getMethod<jboolean(jint, jfloatArray)>("getThemeData");
|
|
47
45
|
|
|
48
|
-
if (getThemeData(
|
|
49
|
-
|
|
50
|
-
jfloat* defaultTextInputPadding =
|
|
51
|
-
env->GetFloatArrayElements(defaultTextInputPaddingArray, nullptr);
|
|
46
|
+
if (getThemeData(fabricUIManager, surfaceId, defaultTextInputPaddingArray) != 0u) {
|
|
47
|
+
jfloat *defaultTextInputPadding = env->GetFloatArrayElements(defaultTextInputPaddingArray, nullptr);
|
|
52
48
|
theme.start = defaultTextInputPadding[0];
|
|
53
49
|
theme.end = defaultTextInputPadding[1];
|
|
54
50
|
theme.top = defaultTextInputPadding[2];
|
|
55
51
|
theme.bottom = defaultTextInputPadding[3];
|
|
56
52
|
surfaceIdToThemePaddingMap_.emplace(std::make_pair(surfaceId, theme));
|
|
57
|
-
env->ReleaseFloatArrayElements(
|
|
58
|
-
defaultTextInputPaddingArray, defaultTextInputPadding, JNI_ABORT);
|
|
53
|
+
env->ReleaseFloatArrayElements(defaultTextInputPaddingArray, defaultTextInputPadding, JNI_ABORT);
|
|
59
54
|
}
|
|
60
55
|
|
|
61
56
|
return std::make_shared<AndroidTextInputShadowNode::ConcreteState>(
|
|
62
|
-
std::make_shared<const AndroidTextInputState>(
|
|
63
|
-
AndroidTextInputState({}, {}, {}, 0)),
|
|
64
|
-
family);
|
|
57
|
+
std::make_shared<const AndroidTextInputState>(AndroidTextInputState({}, {}, {}, 0)), family);
|
|
65
58
|
}
|
|
66
59
|
*/
|
|
67
60
|
|
|
@@ -74,43 +67,36 @@ virtual State::Shared createInitialState(
|
|
|
74
67
|
textInputShadowNode.setTextLayoutManager(textLayoutManager_);
|
|
75
68
|
|
|
76
69
|
/*
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
surfaceIdToThemePaddingMap_
|
|
80
|
-
const auto& theme = surfaceIdToThemePaddingMap_[surfaceId];
|
|
70
|
+
int surfaceId = textInputShadowNode.getSurfaceId();
|
|
71
|
+
if (surfaceIdToThemePaddingMap_.find(surfaceId) != surfaceIdToThemePaddingMap_.end()) {
|
|
72
|
+
const auto &theme = surfaceIdToThemePaddingMap_[surfaceId];
|
|
81
73
|
|
|
82
|
-
auto&
|
|
74
|
+
auto &textInputProps = textInputShadowNode.getConcreteProps();
|
|
83
75
|
|
|
84
76
|
// Override padding
|
|
85
77
|
// Node is still unsealed during adoption, before layout is complete
|
|
86
78
|
// TODO: T62959168 account for RTL and paddingLeft when setting default
|
|
87
79
|
// paddingStart, and vice-versa with paddingRight/paddingEnd.
|
|
88
80
|
// For now this assumes no RTL.
|
|
89
|
-
auto&
|
|
81
|
+
auto &style = const_cast<yoga::Style &>(textInputProps.yogaStyle);
|
|
90
82
|
bool changedPadding = false;
|
|
91
|
-
if (!textInputProps.hasPadding && !textInputProps.hasPaddingStart &&
|
|
92
|
-
!textInputProps.hasPaddingLeft &&
|
|
83
|
+
if (!textInputProps.hasPadding && !textInputProps.hasPaddingStart && !textInputProps.hasPaddingLeft &&
|
|
93
84
|
!textInputProps.hasPaddingHorizontal) {
|
|
94
85
|
changedPadding = true;
|
|
95
|
-
style.setPadding(
|
|
96
|
-
yoga::Edge::Start, yoga::StyleLength::points(theme.start));
|
|
86
|
+
style.setPadding(yoga::Edge::Start, yoga::StyleLength::points(theme.start));
|
|
97
87
|
}
|
|
98
|
-
if (!textInputProps.hasPadding && !textInputProps.hasPaddingEnd &&
|
|
99
|
-
!textInputProps.hasPaddingRight &&
|
|
88
|
+
if (!textInputProps.hasPadding && !textInputProps.hasPaddingEnd && !textInputProps.hasPaddingRight &&
|
|
100
89
|
!textInputProps.hasPaddingHorizontal) {
|
|
101
90
|
changedPadding = true;
|
|
102
91
|
style.setPadding(yoga::Edge::End, yoga::StyleLength::points(theme.end));
|
|
103
92
|
}
|
|
104
|
-
if (!textInputProps.hasPadding && !textInputProps.hasPaddingTop &&
|
|
105
|
-
!textInputProps.hasPaddingVertical) {
|
|
93
|
+
if (!textInputProps.hasPadding && !textInputProps.hasPaddingTop && !textInputProps.hasPaddingVertical) {
|
|
106
94
|
changedPadding = true;
|
|
107
95
|
style.setPadding(yoga::Edge::Top, yoga::StyleLength::points(theme.top));
|
|
108
96
|
}
|
|
109
|
-
if (!textInputProps.hasPadding && !textInputProps.hasPaddingBottom &&
|
|
110
|
-
!textInputProps.hasPaddingVertical) {
|
|
97
|
+
if (!textInputProps.hasPadding && !textInputProps.hasPaddingBottom && !textInputProps.hasPaddingVertical) {
|
|
111
98
|
changedPadding = true;
|
|
112
|
-
style.setPadding(
|
|
113
|
-
yoga::Edge::Bottom, yoga::StyleLength::points(theme.bottom));
|
|
99
|
+
style.setPadding(yoga::Edge::Bottom, yoga::StyleLength::points(theme.bottom));
|
|
114
100
|
}
|
|
115
101
|
|
|
116
102
|
// If the TextInput initially does not have paddingLeft or paddingStart, a
|
|
@@ -118,13 +104,11 @@ virtual State::Shared createInitialState(
|
|
|
118
104
|
// paddingLeft update, we must explicitly unset paddingStart... (same with
|
|
119
105
|
// paddingEnd)
|
|
120
106
|
// TODO: support RTL
|
|
121
|
-
if ((textInputProps.hasPadding || textInputProps.hasPaddingLeft ||
|
|
122
|
-
textInputProps.hasPaddingHorizontal) &&
|
|
107
|
+
if ((textInputProps.hasPadding || textInputProps.hasPaddingLeft || textInputProps.hasPaddingHorizontal) &&
|
|
123
108
|
!textInputProps.hasPaddingStart) {
|
|
124
109
|
style.setPadding(yoga::Edge::Start, yoga::StyleLength::undefined());
|
|
125
110
|
}
|
|
126
|
-
if ((textInputProps.hasPadding || textInputProps.hasPaddingRight ||
|
|
127
|
-
textInputProps.hasPaddingHorizontal) &&
|
|
111
|
+
if ((textInputProps.hasPadding || textInputProps.hasPaddingRight || textInputProps.hasPaddingHorizontal) &&
|
|
128
112
|
!textInputProps.hasPaddingEnd) {
|
|
129
113
|
style.setPadding(yoga::Edge::End, yoga::StyleLength::undefined());
|
|
130
114
|
}
|
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -246,6 +246,8 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
246
246
|
//@cmember Converts screen coordinates of a specified point to the client coordinates
|
|
247
247
|
BOOL TxScreenToClient(LPPOINT lppt) override {
|
|
248
248
|
winrt::Windows::Foundation::Point pt{static_cast<float>(lppt->x), static_cast<float>(lppt->y)};
|
|
249
|
+
pt.X -= m_outer->m_contentOffsetPx.x;
|
|
250
|
+
pt.Y -= m_outer->m_contentOffsetPx.y;
|
|
249
251
|
auto localpt = m_outer->ScreenToLocal(pt);
|
|
250
252
|
lppt->x = static_cast<LONG>(localpt.X);
|
|
251
253
|
lppt->y = static_cast<LONG>(localpt.Y);
|
|
@@ -255,9 +257,14 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
255
257
|
//@cmember Converts the client coordinates of a specified point to screen coordinates
|
|
256
258
|
BOOL TxClientToScreen(LPPOINT lppt) override {
|
|
257
259
|
winrt::Windows::Foundation::Point pt{static_cast<float>(lppt->x), static_cast<float>(lppt->y)};
|
|
260
|
+
|
|
261
|
+
if (!m_outer->m_parent) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
|
|
258
265
|
auto screenpt = m_outer->LocalToScreen(pt);
|
|
259
|
-
lppt->x = static_cast<LONG>(screenpt.X);
|
|
260
|
-
lppt->y = static_cast<LONG>(screenpt.Y);
|
|
266
|
+
lppt->x = static_cast<LONG>(screenpt.X) + m_outer->m_contentOffsetPx.x;
|
|
267
|
+
lppt->y = static_cast<LONG>(screenpt.Y) + m_outer->m_contentOffsetPx.y;
|
|
261
268
|
return true;
|
|
262
269
|
}
|
|
263
270
|
|
|
@@ -276,20 +283,25 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
|
|
|
276
283
|
//@cmember Retrieves the coordinates of a window's client area
|
|
277
284
|
HRESULT TxGetClientRect(LPRECT prc) override {
|
|
278
285
|
*prc = m_outer->getClientRect();
|
|
286
|
+
|
|
287
|
+
prc->top += m_outer->m_contentOffsetPx.y;
|
|
288
|
+
prc->bottom += m_outer->m_contentOffsetPx.y -
|
|
289
|
+
static_cast<LONG>(m_outer->m_layoutMetrics.contentInsets.bottom * m_outer->m_layoutMetrics.pointScaleFactor);
|
|
290
|
+
prc->left += m_outer->m_contentOffsetPx.x;
|
|
291
|
+
prc->right += m_outer->m_contentOffsetPx.x -
|
|
292
|
+
static_cast<LONG>(m_outer->m_layoutMetrics.contentInsets.right * m_outer->m_layoutMetrics.pointScaleFactor);
|
|
293
|
+
|
|
279
294
|
return S_OK;
|
|
280
295
|
}
|
|
281
296
|
|
|
282
297
|
//@cmember Get the view rectangle relative to the inset
|
|
283
298
|
HRESULT TxGetViewInset(LPRECT prc) override {
|
|
284
299
|
// Inset is in HIMETRIC
|
|
285
|
-
constexpr float HmPerInchF = 2540.0f;
|
|
286
|
-
constexpr float PointsPerInch = 96.0f;
|
|
287
|
-
constexpr float dipToHm = HmPerInchF / PointsPerInch;
|
|
288
300
|
|
|
289
|
-
prc->left =
|
|
290
|
-
prc->top =
|
|
291
|
-
prc->bottom =
|
|
292
|
-
prc->right =
|
|
301
|
+
prc->left = 0;
|
|
302
|
+
prc->top = 0;
|
|
303
|
+
prc->bottom = 0;
|
|
304
|
+
prc->right = 0;
|
|
293
305
|
|
|
294
306
|
return NOERROR;
|
|
295
307
|
}
|
|
@@ -492,11 +504,6 @@ AutoCorrectOffCallback(LANGID langid, const WCHAR *pszBefore, WCHAR *pszAfter, L
|
|
|
492
504
|
facebook::react::AttributedString WindowsTextInputComponentView::getAttributedString() const {
|
|
493
505
|
// Use BaseTextShadowNode to get attributed string from children
|
|
494
506
|
|
|
495
|
-
auto childTextAttributes = facebook::react::TextAttributes::defaultTextAttributes();
|
|
496
|
-
childTextAttributes.fontSizeMultiplier = m_fontSizeMultiplier;
|
|
497
|
-
|
|
498
|
-
childTextAttributes.apply(windowsTextInputProps().textAttributes);
|
|
499
|
-
|
|
500
507
|
auto attributedString = facebook::react::AttributedString{};
|
|
501
508
|
// auto attachments = facebook::react::BaseTextShadowNode::Attachments{};
|
|
502
509
|
|
|
@@ -1114,6 +1121,9 @@ void WindowsTextInputComponentView::updateProps(
|
|
|
1114
1121
|
!facebook::react::floatEquality(
|
|
1115
1122
|
oldTextInputProps.textAttributes.letterSpacing, newTextInputProps.textAttributes.letterSpacing) ||
|
|
1116
1123
|
oldTextInputProps.textAttributes.fontFamily != newTextInputProps.textAttributes.fontFamily ||
|
|
1124
|
+
oldTextInputProps.textAttributes.fontStyle != newTextInputProps.textAttributes.fontStyle ||
|
|
1125
|
+
oldTextInputProps.textAttributes.textDecorationLineType !=
|
|
1126
|
+
newTextInputProps.textAttributes.textDecorationLineType ||
|
|
1117
1127
|
!facebook::react::floatEquality(
|
|
1118
1128
|
oldTextInputProps.textAttributes.maxFontSizeMultiplier,
|
|
1119
1129
|
newTextInputProps.textAttributes.maxFontSizeMultiplier)) {
|
|
@@ -1129,6 +1139,7 @@ void WindowsTextInputComponentView::updateProps(
|
|
|
1129
1139
|
}
|
|
1130
1140
|
|
|
1131
1141
|
if (oldTextInputProps.multiline != newTextInputProps.multiline) {
|
|
1142
|
+
m_recalculateContentVerticalOffset = true;
|
|
1132
1143
|
m_multiline = newTextInputProps.multiline;
|
|
1133
1144
|
m_propBitsMask |= TXTBIT_MULTILINE | TXTBIT_WORDWRAP;
|
|
1134
1145
|
if (newTextInputProps.multiline) {
|
|
@@ -1278,6 +1289,10 @@ void WindowsTextInputComponentView::updateLayoutMetrics(
|
|
|
1278
1289
|
unsigned int newWidth = static_cast<unsigned int>(layoutMetrics.frame.size.width * layoutMetrics.pointScaleFactor);
|
|
1279
1290
|
unsigned int newHeight = static_cast<unsigned int>(layoutMetrics.frame.size.height * layoutMetrics.pointScaleFactor);
|
|
1280
1291
|
|
|
1292
|
+
if (newHeight != m_imgHeight || oldLayoutMetrics.pointScaleFactor != layoutMetrics.pointScaleFactor) {
|
|
1293
|
+
m_recalculateContentVerticalOffset = true;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1281
1296
|
if (newWidth != m_imgWidth || newHeight != m_imgHeight) {
|
|
1282
1297
|
m_drawingSurface = nullptr; // Invalidate surface if we get a size change
|
|
1283
1298
|
}
|
|
@@ -1416,6 +1431,8 @@ void WindowsTextInputComponentView::FinalizeUpdates(
|
|
|
1416
1431
|
|
|
1417
1432
|
void WindowsTextInputComponentView::UpdatePropertyBits() noexcept {
|
|
1418
1433
|
if (m_propBitsMask != 0) {
|
|
1434
|
+
if ((m_propBits & TXTBIT_CHARFORMATCHANGE) == TXTBIT_CHARFORMATCHANGE)
|
|
1435
|
+
m_recalculateContentVerticalOffset = true;
|
|
1419
1436
|
DrawBlock db(*this);
|
|
1420
1437
|
winrt::check_hresult(m_textServices->OnTxPropertyBitsChange(m_propBitsMask, m_propBits));
|
|
1421
1438
|
m_propBitsMask = 0;
|
|
@@ -1427,6 +1444,10 @@ void WindowsTextInputComponentView::InternalFinalize() noexcept {
|
|
|
1427
1444
|
if (m_mounted) {
|
|
1428
1445
|
UpdatePropertyBits();
|
|
1429
1446
|
|
|
1447
|
+
if (m_recalculateContentVerticalOffset) {
|
|
1448
|
+
calculateContentVerticalOffset();
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1430
1451
|
ensureDrawingSurface();
|
|
1431
1452
|
if (m_needsRedraw) {
|
|
1432
1453
|
DrawText();
|
|
@@ -1488,12 +1509,6 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
|
1488
1509
|
// m_crText = RemoveAlpha(fontDetails.FontColor);
|
|
1489
1510
|
// }
|
|
1490
1511
|
|
|
1491
|
-
// set font face
|
|
1492
|
-
// cfNew.dwMask |= CFM_FACE;
|
|
1493
|
-
// NetUIWzCchCopy(cfNew.szFaceName, _countof(cfNew.szFaceName), fontDetails.FontName.c_str());
|
|
1494
|
-
// cfNew.bPitchAndFamily = FF_DONTCARE;
|
|
1495
|
-
|
|
1496
|
-
// set font size -- 15 to convert twips to pt
|
|
1497
1512
|
const auto &props = windowsTextInputProps();
|
|
1498
1513
|
float fontSize =
|
|
1499
1514
|
(std::isnan(props.textAttributes.fontSize) ? facebook::react::TextAttributes::defaultTextAttributes().fontSize
|
|
@@ -1504,8 +1519,8 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
|
1504
1519
|
fontSize *=
|
|
1505
1520
|
(maxFontSizeMultiplier >= 1.0f) ? std::min(maxFontSizeMultiplier, m_fontSizeMultiplier) : m_fontSizeMultiplier;
|
|
1506
1521
|
|
|
1507
|
-
// TODO get fontSize from props.textAttributes, or defaultTextAttributes, or fragment?
|
|
1508
1522
|
cfNew.dwMask |= CFM_SIZE;
|
|
1523
|
+
// set font size -- 15 to convert twips to pt
|
|
1509
1524
|
cfNew.yHeight = static_cast<LONG>(fontSize * 15);
|
|
1510
1525
|
|
|
1511
1526
|
// set bold
|
|
@@ -1540,7 +1555,11 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
|
1540
1555
|
std::wstring fontFamily =
|
|
1541
1556
|
std::wstring(props.textAttributes.fontFamily.begin(), props.textAttributes.fontFamily.end());
|
|
1542
1557
|
wcsncpy_s(cfNew.szFaceName, fontFamily.c_str(), LF_FACESIZE);
|
|
1558
|
+
} else {
|
|
1559
|
+
cfNew.dwMask |= CFM_FACE;
|
|
1560
|
+
wcsncpy_s(cfNew.szFaceName, L"Segoe UI\0", LF_FACESIZE);
|
|
1543
1561
|
}
|
|
1562
|
+
cfNew.bPitchAndFamily = FF_DONTCARE;
|
|
1544
1563
|
|
|
1545
1564
|
// set char offset
|
|
1546
1565
|
cfNew.dwMask |= CFM_OFFSET;
|
|
@@ -1549,7 +1568,8 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
|
|
|
1549
1568
|
// set letter spacing
|
|
1550
1569
|
float letterSpacing = props.textAttributes.letterSpacing;
|
|
1551
1570
|
if (!std::isnan(letterSpacing)) {
|
|
1552
|
-
|
|
1571
|
+
cfNew.dwMask |= CFM_SPACING;
|
|
1572
|
+
cfNew.sSpacing = static_cast<SHORT>(letterSpacing * 20); // Convert to TWIPS
|
|
1553
1573
|
}
|
|
1554
1574
|
|
|
1555
1575
|
// set charset
|
|
@@ -1665,7 +1685,7 @@ winrt::com_ptr<::IDWriteTextLayout> WindowsTextInputComponentView::CreatePlaceho
|
|
|
1665
1685
|
const auto &props = windowsTextInputProps();
|
|
1666
1686
|
facebook::react::TextAttributes textAttributes = props.textAttributes;
|
|
1667
1687
|
if (std::isnan(props.textAttributes.fontSize)) {
|
|
1668
|
-
|
|
1688
|
+
facebook::react::TextAttributes::defaultTextAttributes().fontSize;
|
|
1669
1689
|
}
|
|
1670
1690
|
textAttributes.fontSizeMultiplier = m_fontSizeMultiplier;
|
|
1671
1691
|
fragment1.string = props.placeholder;
|
|
@@ -1682,6 +1702,26 @@ winrt::com_ptr<::IDWriteTextLayout> WindowsTextInputComponentView::CreatePlaceho
|
|
|
1682
1702
|
return textLayout;
|
|
1683
1703
|
}
|
|
1684
1704
|
|
|
1705
|
+
void WindowsTextInputComponentView::calculateContentVerticalOffset() noexcept {
|
|
1706
|
+
m_recalculateContentVerticalOffset = false;
|
|
1707
|
+
|
|
1708
|
+
const auto &props = windowsTextInputProps();
|
|
1709
|
+
|
|
1710
|
+
m_contentOffsetPx = {
|
|
1711
|
+
static_cast<LONG>(m_layoutMetrics.contentInsets.left * m_layoutMetrics.pointScaleFactor),
|
|
1712
|
+
static_cast<LONG>(m_layoutMetrics.contentInsets.top * m_layoutMetrics.pointScaleFactor)};
|
|
1713
|
+
|
|
1714
|
+
if (props.multiline) {
|
|
1715
|
+
// Align to the top for multiline
|
|
1716
|
+
return;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
auto [contentWidth, contentHeight] = GetContentSize();
|
|
1720
|
+
|
|
1721
|
+
m_contentOffsetPx.y += static_cast<LONG>(std::round(
|
|
1722
|
+
((m_layoutMetrics.getContentFrame().size.height - contentHeight) / 2) * m_layoutMetrics.pointScaleFactor));
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1685
1725
|
void WindowsTextInputComponentView::DrawText() noexcept {
|
|
1686
1726
|
m_needsRedraw = true;
|
|
1687
1727
|
if (m_cDrawBlock || theme()->IsEmpty() || !m_textServices) {
|
|
@@ -1707,16 +1747,13 @@ void WindowsTextInputComponentView::DrawText() noexcept {
|
|
|
1707
1747
|
assert(d2dDeviceContext->GetUnitMode() == D2D1_UNIT_MODE_DIPS);
|
|
1708
1748
|
|
|
1709
1749
|
RECTL rc{
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1750
|
+
offset.x + m_contentOffsetPx.x,
|
|
1751
|
+
offset.y + m_contentOffsetPx.y,
|
|
1752
|
+
offset.x + m_contentOffsetPx.x + static_cast<LONG>(m_imgWidth),
|
|
1753
|
+
offset.y + m_contentOffsetPx.y + static_cast<LONG>(m_imgHeight)};
|
|
1714
1754
|
|
|
1715
1755
|
RECT rcClient{
|
|
1716
|
-
static_cast<LONG>(offset.
|
|
1717
|
-
static_cast<LONG>(offset.y),
|
|
1718
|
-
static_cast<LONG>(offset.x) + static_cast<LONG>(m_imgWidth),
|
|
1719
|
-
static_cast<LONG>(offset.y) + static_cast<LONG>(m_imgHeight)};
|
|
1756
|
+
offset.x, offset.y, offset.x + static_cast<LONG>(m_imgWidth), offset.y + static_cast<LONG>(m_imgHeight)};
|
|
1720
1757
|
|
|
1721
1758
|
{
|
|
1722
1759
|
m_cDrawBlock++; // Dont use AutoDrawBlock as we are already in draw, and dont need to draw again.
|
|
@@ -1771,8 +1808,8 @@ void WindowsTextInputComponentView::DrawText() noexcept {
|
|
|
1771
1808
|
// draw text
|
|
1772
1809
|
d2dDeviceContext->DrawTextLayout(
|
|
1773
1810
|
D2D1::Point2F(
|
|
1774
|
-
static_cast<FLOAT>(
|
|
1775
|
-
static_cast<FLOAT>(
|
|
1811
|
+
static_cast<FLOAT>(offset.x + m_contentOffsetPx.x) / m_layoutMetrics.pointScaleFactor,
|
|
1812
|
+
static_cast<FLOAT>(offset.y + m_contentOffsetPx.y) / m_layoutMetrics.pointScaleFactor),
|
|
1776
1813
|
textLayout.get(),
|
|
1777
1814
|
brush.get(),
|
|
1778
1815
|
D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT);
|
|
@@ -1848,22 +1885,6 @@ void WindowsTextInputComponentView::autoCapitalizeOnUpdateProps(
|
|
|
1848
1885
|
}
|
|
1849
1886
|
}
|
|
1850
1887
|
|
|
1851
|
-
void WindowsTextInputComponentView::updateLetterSpacing(float letterSpacing) noexcept {
|
|
1852
|
-
CHARFORMAT2W cf = {};
|
|
1853
|
-
cf.cbSize = sizeof(CHARFORMAT2W);
|
|
1854
|
-
cf.dwMask = CFM_SPACING;
|
|
1855
|
-
cf.sSpacing = static_cast<SHORT>(letterSpacing * 20); // Convert to TWIPS
|
|
1856
|
-
|
|
1857
|
-
LRESULT res;
|
|
1858
|
-
|
|
1859
|
-
// Apply to all existing text like placeholder
|
|
1860
|
-
winrt::check_hresult(m_textServices->TxSendMessage(EM_SETCHARFORMAT, SCF_ALL, reinterpret_cast<LPARAM>(&cf), &res));
|
|
1861
|
-
|
|
1862
|
-
// Apply to future text input
|
|
1863
|
-
winrt::check_hresult(
|
|
1864
|
-
m_textServices->TxSendMessage(EM_SETCHARFORMAT, SCF_SELECTION, reinterpret_cast<LPARAM>(&cf), &res));
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
1888
|
void WindowsTextInputComponentView::updateAutoCorrect(bool enable) noexcept {
|
|
1868
1889
|
LRESULT lresult;
|
|
1869
1890
|
winrt::check_hresult(m_textServices->TxSendMessage(
|
|
@@ -117,10 +117,10 @@ struct WindowsTextInputComponentView
|
|
|
117
117
|
const std::string &previousCapitalizationType,
|
|
118
118
|
const std::string &newcapitalizationType) noexcept;
|
|
119
119
|
|
|
120
|
-
void updateLetterSpacing(float letterSpacing) noexcept;
|
|
121
120
|
void updateAutoCorrect(bool value) noexcept;
|
|
122
121
|
void updateSpellCheck(bool value) noexcept;
|
|
123
122
|
void ShowContextMenu(const winrt::Windows::Foundation::Point &position) noexcept;
|
|
123
|
+
void calculateContentVerticalOffset() noexcept;
|
|
124
124
|
|
|
125
125
|
winrt::Windows::UI::Composition::CompositionSurfaceBrush m_brush{nullptr};
|
|
126
126
|
winrt::Microsoft::ReactNative::Composition::Experimental::ICaretVisual m_caretVisual{nullptr};
|
|
@@ -145,6 +145,9 @@ struct WindowsTextInputComponentView
|
|
|
145
145
|
bool m_hasFocus{false};
|
|
146
146
|
bool m_clearTextOnSubmit{false};
|
|
147
147
|
bool m_multiline{false};
|
|
148
|
+
LONG m_contentVerticalOffsetPx{0}; // Used to center single line text within the client rect
|
|
149
|
+
bool m_recalculateContentVerticalOffset{true};
|
|
150
|
+
POINT m_contentOffsetPx{0, 0};
|
|
148
151
|
DWORD m_propBitsMask{0};
|
|
149
152
|
DWORD m_propBits{0};
|
|
150
153
|
HCURSOR m_hcursor{nullptr};
|
|
@@ -104,6 +104,11 @@ struct SvgDataImageHandler
|
|
|
104
104
|
::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(drawingBrush, 1.0, &pt);
|
|
105
105
|
auto renderTarget = autoDraw.GetRenderTarget();
|
|
106
106
|
|
|
107
|
+
// Defensive check: ensure device context is valid before D2D operations
|
|
108
|
+
if (!renderTarget) {
|
|
109
|
+
return nullptr;
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
winrt::com_ptr<ID2D1DeviceContext5> deviceContext5;
|
|
108
113
|
winrt::check_hresult(renderTarget->QueryInterface(IID_ID2D1DeviceContext5, deviceContext5.put_void()));
|
|
109
114
|
|
|
@@ -96,7 +96,10 @@ void WindowsTextLayoutManager::GetTextLayout(
|
|
|
96
96
|
|
|
97
97
|
winrt::com_ptr<IDWriteTextFormat> spTextFormat;
|
|
98
98
|
|
|
99
|
-
float fontSizeText =
|
|
99
|
+
float fontSizeText =
|
|
100
|
+
(std::isnan(outerFragment.textAttributes.fontSize)
|
|
101
|
+
? facebook::react::TextAttributes::defaultTextAttributes().fontSize
|
|
102
|
+
: outerFragment.textAttributes.fontSize);
|
|
100
103
|
if (outerFragment.textAttributes.allowFontScaling.value_or(true) &&
|
|
101
104
|
!std::isnan(outerFragment.textAttributes.fontSizeMultiplier)) {
|
|
102
105
|
float maxFontSizeMultiplierText = cDefaultMaxFontSizeMultiplier;
|
|
@@ -287,7 +290,9 @@ void WindowsTextLayoutManager::GetTextLayout(
|
|
|
287
290
|
maxFontSizeMultiplier =
|
|
288
291
|
(!std::isnan(attributes.maxFontSizeMultiplier) ? attributes.maxFontSizeMultiplier
|
|
289
292
|
: cDefaultMaxFontSizeMultiplier);
|
|
290
|
-
float fontSize =
|
|
293
|
+
float fontSize =
|
|
294
|
+
(std::isnan(attributes.fontSize) ? facebook::react::TextAttributes::defaultTextAttributes().fontSize
|
|
295
|
+
: attributes.fontSize);
|
|
291
296
|
if (attributes.allowFontScaling.value_or(true) && (!std::isnan(attributes.fontSizeMultiplier))) {
|
|
292
297
|
fontSize *= (maxFontSizeMultiplier >= 1.0f) ? std::min(maxFontSizeMultiplier, attributes.fontSizeMultiplier)
|
|
293
298
|
: attributes.fontSizeMultiplier;
|
|
@@ -21,6 +21,7 @@ namespace Microsoft.ReactNative.Composition
|
|
|
21
21
|
[experimental]
|
|
22
22
|
delegate void ComponentIslandComponentViewInitializer(ContentIslandComponentView view);
|
|
23
23
|
|
|
24
|
+
|
|
24
25
|
[webhosthidden]
|
|
25
26
|
[experimental]
|
|
26
27
|
delegate void PortalComponentViewInitializer(PortalComponentView view);
|
|
@@ -365,7 +365,7 @@
|
|
|
365
365
|
<ClCompile Include="Modules\I18nManagerModule.cpp" />
|
|
366
366
|
<ClCompile Include="Modules\ImageViewManagerModule.cpp" />
|
|
367
367
|
<ClCompile Include="Modules\LinkingManagerModule.cpp" />
|
|
368
|
-
<ClCompile Include="Modules\LogBoxModule.cpp"
|
|
368
|
+
<ClCompile Include="Modules\LogBoxModule.cpp" />
|
|
369
369
|
<ClCompile Include="Pch\pch.cpp">
|
|
370
370
|
<PrecompiledHeader>Create</PrecompiledHeader>
|
|
371
371
|
</ClCompile>
|
|
@@ -11,19 +11,18 @@
|
|
|
11
11
|
|
|
12
12
|
#include <Fabric/Composition/CompositionContextHelper.h>
|
|
13
13
|
#include <Fabric/Composition/CompositionUIService.h>
|
|
14
|
+
#include <winrt/Microsoft.UI.Windowing.h>
|
|
14
15
|
#include <winrt/Windows.UI.Composition.h>
|
|
15
16
|
|
|
16
17
|
namespace Microsoft::ReactNative {
|
|
17
18
|
|
|
18
19
|
LogBox::~LogBox() {
|
|
19
|
-
if (
|
|
20
|
-
m_context.UIDispatcher().Post([
|
|
21
|
-
|
|
20
|
+
if (m_rnWindow) {
|
|
21
|
+
m_context.UIDispatcher().Post([rnWindow = m_rnWindow]() { rnWindow.Close(); });
|
|
22
|
+
m_rnWindow = nullptr;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
constexpr PCWSTR c_logBoxWindowClassName = L"MS_REACTNATIVE_LOGBOX";
|
|
26
|
-
constexpr auto CompHostProperty = L"CompHost";
|
|
27
26
|
const int LOGBOX_DEFAULT_WIDTH = 700;
|
|
28
27
|
const int LOGBOX_DEFAULT_HEIGHT = 1000;
|
|
29
28
|
|
|
@@ -47,108 +46,35 @@ void LogBox::Hide() noexcept {
|
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
LRESULT CALLBACK LogBoxWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) noexcept {
|
|
51
|
-
auto data = reinterpret_cast<::IUnknown *>(GetProp(hwnd, CompHostProperty));
|
|
52
|
-
winrt::com_ptr<winrt::IUnknown> spunk;
|
|
53
|
-
React::CompositionHwndHost host{nullptr};
|
|
54
|
-
|
|
55
|
-
if (data) {
|
|
56
|
-
winrt::check_hresult(data->QueryInterface(winrt::guid_of<React::CompositionHwndHost>(), winrt::put_abi(host)));
|
|
57
|
-
auto result = static_cast<LRESULT>(host.TranslateMessage(message, wparam, lparam));
|
|
58
|
-
if (result)
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
switch (message) {
|
|
63
|
-
case WM_NCCREATE: {
|
|
64
|
-
auto cs = reinterpret_cast<CREATESTRUCT *>(lparam);
|
|
65
|
-
auto windowData = static_cast<::IUnknown *>(cs->lpCreateParams);
|
|
66
|
-
SetProp(hwnd, CompHostProperty, reinterpret_cast<::IUnknown *>(windowData));
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case WM_CREATE: {
|
|
70
|
-
host.Initialize((uint64_t)hwnd);
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
case WM_CLOSE: {
|
|
74
|
-
// Just hide the window instead of destroying it
|
|
75
|
-
::ShowWindow(hwnd, SW_HIDE);
|
|
76
|
-
return 0;
|
|
77
|
-
}
|
|
78
|
-
case WM_DESTROY: {
|
|
79
|
-
data->Release();
|
|
80
|
-
SetProp(hwnd, CompHostProperty, nullptr);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return DefWindowProc(hwnd, message, wparam, lparam);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
void LogBox::RegisterWndClass() noexcept {
|
|
88
|
-
static bool registered = false;
|
|
89
|
-
if (registered)
|
|
90
|
-
return;
|
|
91
|
-
|
|
92
|
-
HINSTANCE hInstance = GetModuleHandle(NULL);
|
|
93
|
-
|
|
94
|
-
WNDCLASSEXW wcex = {};
|
|
95
|
-
wcex.cbSize = sizeof(WNDCLASSEX);
|
|
96
|
-
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
|
97
|
-
wcex.lpfnWndProc = &LogBoxWndProc;
|
|
98
|
-
wcex.cbClsExtra = DLGWINDOWEXTRA;
|
|
99
|
-
wcex.cbWndExtra = sizeof(winrt::impl::abi<winrt::Microsoft::ReactNative::ICompositionHwndHost>::type *);
|
|
100
|
-
wcex.hInstance = hInstance;
|
|
101
|
-
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
|
102
|
-
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
103
|
-
wcex.lpszClassName = c_logBoxWindowClassName;
|
|
104
|
-
ATOM classId = RegisterClassEx(&wcex);
|
|
105
|
-
WINRT_VERIFY(classId);
|
|
106
|
-
winrt::check_win32(!classId);
|
|
107
|
-
|
|
108
|
-
registered = true;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
49
|
void LogBox::ShowOnUIThread() noexcept {
|
|
112
50
|
auto host = React::implementation::ReactNativeHost::GetReactNativeHost(m_context.Properties());
|
|
113
51
|
if (!host)
|
|
114
52
|
return;
|
|
115
53
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
54
|
+
if (!m_rnWindow) {
|
|
55
|
+
m_rnWindow = winrt::Microsoft::ReactNative::ReactNativeWindow::CreateFromCompositor(
|
|
56
|
+
winrt::Microsoft::ReactNative::Composition::CompositionUIService::GetCompositor(
|
|
57
|
+
host.InstanceSettings().Properties()));
|
|
120
58
|
winrt::Microsoft::ReactNative::ReactViewOptions viewOptions;
|
|
121
59
|
viewOptions.ComponentName(L"LogBox");
|
|
122
|
-
|
|
60
|
+
m_rnWindow.AppWindow().Title(L"LogBox");
|
|
61
|
+
m_rnWindow.AppWindow().Closing([](winrt::Microsoft::UI::Windowing::AppWindow const & /*appWindow*/,
|
|
62
|
+
winrt::Microsoft::UI::Windowing::AppWindowClosingEventArgs const &args) {
|
|
63
|
+
// Prevent default close behavior - as JS will never try to show the logbox again if it isn't hidden through JS
|
|
64
|
+
args.Cancel(true);
|
|
65
|
+
});
|
|
66
|
+
m_rnWindow.ReactNativeIsland().ReactViewHost(
|
|
123
67
|
winrt::Microsoft::ReactNative::ReactCoreInjection::MakeViewHost(host, viewOptions));
|
|
124
|
-
|
|
125
|
-
winrt::impl::abi<winrt::Microsoft::ReactNative::ICompositionHwndHost>::type *pHost{nullptr};
|
|
126
|
-
winrt::com_ptr<::IUnknown> spunk;
|
|
127
|
-
CompositionHwndHost.as(spunk);
|
|
128
|
-
spunk->AddRef(); // Will be stored in windowData
|
|
129
|
-
|
|
130
|
-
m_hwnd = CreateWindow(
|
|
131
|
-
c_logBoxWindowClassName,
|
|
132
|
-
L"React-Native LogBox",
|
|
133
|
-
WS_OVERLAPPEDWINDOW,
|
|
134
|
-
CW_USEDEFAULT,
|
|
135
|
-
CW_USEDEFAULT,
|
|
136
|
-
LOGBOX_DEFAULT_WIDTH,
|
|
137
|
-
LOGBOX_DEFAULT_HEIGHT,
|
|
138
|
-
nullptr,
|
|
139
|
-
nullptr,
|
|
140
|
-
hInstance,
|
|
141
|
-
spunk.get());
|
|
68
|
+
m_rnWindow.AppWindow().ResizeClient({LOGBOX_DEFAULT_WIDTH, LOGBOX_DEFAULT_HEIGHT});
|
|
142
69
|
}
|
|
143
70
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
SetFocus(m_hwnd);
|
|
71
|
+
m_rnWindow.AppWindow().Show(true);
|
|
72
|
+
m_rnWindow.AppWindow().MoveInZOrderAtTop();
|
|
147
73
|
}
|
|
148
74
|
|
|
149
75
|
void LogBox::HideOnUIThread() noexcept {
|
|
150
|
-
if (
|
|
151
|
-
|
|
76
|
+
if (m_rnWindow) {
|
|
77
|
+
m_rnWindow.AppWindow().Hide();
|
|
152
78
|
}
|
|
153
79
|
}
|
|
154
80
|
|
|
@@ -28,9 +28,7 @@ struct LogBox : public std::enable_shared_from_this<LogBox> {
|
|
|
28
28
|
void HideOnUIThread() noexcept;
|
|
29
29
|
|
|
30
30
|
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
31
|
-
|
|
32
|
-
xaml::FrameworkElement::SizeChanged_revoker m_sizeChangedRevoker;
|
|
33
|
-
winrt::event_token m_tokenClosed;
|
|
31
|
+
winrt::Microsoft::ReactNative::ReactNativeWindow m_rnWindow{nullptr};
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
} // namespace Microsoft::ReactNative
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
#include <WerApi.h>
|
|
11
11
|
|
|
12
|
+
#pragma warning(push)
|
|
13
|
+
#pragma warning(disable : 4996) // signal, _wfopen_s, _fileno, tmpfile_s, fread — CRT deprecated warnings
|
|
14
|
+
|
|
12
15
|
namespace Mso::React {
|
|
13
16
|
|
|
14
17
|
// When calling SetUnhandledExceptionFilter the previous filter is returned.
|
|
@@ -123,3 +126,5 @@ void InternalUnregisterCustomHandler() noexcept {
|
|
|
123
126
|
#endif
|
|
124
127
|
|
|
125
128
|
} // namespace Mso::React
|
|
129
|
+
|
|
130
|
+
#pragma warning(pop)
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#pragma warning(disable : 4068)
|
|
13
13
|
#pragma warning(disable : 4100)
|
|
14
14
|
#pragma warning(disable : 4324) // structure was padded due to alignment specifier
|
|
15
|
+
#pragma warning(disable : 4996) // deprecated APIs in cxxreact headers
|
|
15
16
|
|
|
16
17
|
#pragma push_macro("ERROR")
|
|
17
18
|
#pragma push_macro("Check")
|