react-native-windows 0.78.5 → 0.78.7
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/Directory.Build.props +6 -4
- package/Folly/Folly.vcxproj +46 -6
- package/Folly/Folly.vcxproj.filters +16 -4
- package/Folly/TEMP_UntilFollyUpdate/ConstexprMath.h +26 -18
- package/Folly/TEMP_UntilFollyUpdate/Conv.cpp +1205 -0
- package/Folly/TEMP_UntilFollyUpdate/chrono/Hardware.h +155 -0
- package/Folly/TEMP_UntilFollyUpdate/concurrency/CacheLocality.cpp +633 -0
- package/Folly/TEMP_UntilFollyUpdate/{dynamic-inl.h → json/dynamic-inl.h} +3 -4
- package/Folly/TEMP_UntilFollyUpdate/{json.cpp → json/json.cpp} +14 -10
- package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +7 -14
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +6 -6
- package/Folly/ThreadNameStub.cpp +10 -0
- package/Folly/cgmanifest.json +11 -1
- package/Libraries/Components/View/View.windows.js +107 -56
- package/Libraries/Components/View/ViewAccessibility.d.ts +60 -1
- package/Libraries/Image/Image.windows.js +42 -21
- package/Libraries/Modal/Modal.d.ts +7 -0
- package/Libraries/Modal/Modal.windows.js +7 -1
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
- package/Libraries/Text/Text.d.ts +18 -0
- package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +4 -25
- package/Microsoft.ReactNative/AsynchronousEventBeat.h +0 -3
- package/Microsoft.ReactNative/Base/FollyIncludes.h +1 -0
- package/Microsoft.ReactNative/CallInvoker.cpp +42 -0
- package/Microsoft.ReactNative/CallInvoker.h +34 -0
- package/Microsoft.ReactNative/{JSDispatcherWriter.cpp → CallInvokerWriter.cpp} +35 -47
- package/Microsoft.ReactNative/CallInvokerWriter.h +74 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +0 -5
- package/Microsoft.ReactNative/CompositionSwitcher.idl +7 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +12 -2
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +100 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +31 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +77 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +7 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +86 -56
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +118 -63
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -8
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +16 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +34 -11
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +133 -135
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +9 -6
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +46 -49
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +13 -8
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +146 -25
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +14 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +160 -12
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +47 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +15 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.cpp +6 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +7 -9
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +5 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +40 -36
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +68 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +11 -0
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +70 -13
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +10 -2
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +5 -5
- package/Microsoft.ReactNative/Fabric/ImageRequestParams.cpp +26 -0
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +47 -8
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +10 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/CompositionAccessibilityProps.h +67 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +22 -4
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +15 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +5 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/MouseEvent.h +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +247 -45
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +15 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.cpp +39 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.h +54 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +126 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +73 -0
- package/Microsoft.ReactNative/IReactContext.cpp +17 -0
- package/Microsoft.ReactNative/IReactContext.h +1 -0
- package/Microsoft.ReactNative/IReactContext.idl +18 -1
- package/Microsoft.ReactNative/IReactDispatcher.idl +1 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.cpp +12 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.h +2 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.idl +8 -0
- package/Microsoft.ReactNative/JsiApi.cpp +10 -2
- package/Microsoft.ReactNative/JsiApi.h +1 -0
- package/Microsoft.ReactNative/JsiApi.idl +1 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +0 -3
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +2 -3
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +7 -12
- package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.cpp +2 -1
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedModule.cpp +4 -8
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +6 -8
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +6 -15
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +13 -24
- package/Microsoft.ReactNative/QuirkSettings.cpp +0 -16
- package/Microsoft.ReactNative/QuirkSettings.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +11 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +78 -68
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -2
- package/Microsoft.ReactNative/ReactInstanceSettings.cpp +12 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.h +2 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +6 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
- package/Microsoft.ReactNative/ReactSupport.cpp +44 -11
- package/Microsoft.ReactNative/RedBox.cpp +30 -1
- package/Microsoft.ReactNative/SchedulerSettings.cpp +4 -4
- package/Microsoft.ReactNative/SchedulerSettings.h +1 -1
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +30 -12
- package/Microsoft.ReactNative/Utils/ImageUtils.h +1 -0
- package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +37 -31
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +1 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +2 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +94 -27
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +27 -6
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.cpp +45 -11
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +6 -0
- package/Microsoft.ReactNative.Cxx/JSI/decorator.h +220 -0
- package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +28 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +6 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +241 -4
- package/Microsoft.ReactNative.Cxx/JSI/jsi.h +207 -19
- package/Microsoft.ReactNative.Cxx/JSValue.cpp +19 -3
- package/Microsoft.ReactNative.Cxx/JSValue.h +15 -7
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +2 -2
- package/Microsoft.ReactNative.Cxx/NativeModules.h +60 -2
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +1267 -614
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +4 -2
- package/Microsoft.ReactNative.Cxx/ReactContext.h +7 -0
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.cpp +11 -13
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.h +2 -3
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +81 -20
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +47 -2
- package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +13 -0
- package/Microsoft.ReactNative.Cxx/stubs/glog/logging.h +1 -1
- package/Microsoft.ReactNative.Managed/ReactContext.cs +3 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/React.Cpp.props +2 -1
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +429 -0
- package/ReactCommon/cgmanifest.json +1 -1
- package/Shared/HermesRuntimeHolder.cpp +6 -0
- package/Shared/JSI/ChakraRuntime.cpp +4 -0
- package/Shared/JSI/ChakraRuntime.h +2 -0
- package/Shared/Modules/BlobModule.cpp +14 -16
- package/Shared/Modules/BlobModule.h +3 -1
- package/Shared/Shared.vcxitems +11 -7
- package/Shared/Shared.vcxitems.filters +6 -1
- package/Shared/TurboModuleManager.cpp +0 -15
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +6 -6
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +6 -6
- package/codegen/react/components/rnwcore/InputAccessory.g.h +6 -6
- package/codegen/react/components/rnwcore/ModalHostView.g.h +11 -7
- package/codegen/react/components/rnwcore/Props.cpp +2 -1
- package/codegen/react/components/rnwcore/Props.h +1 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +6 -6
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +6 -6
- package/codegen/react/components/rnwcore/Switch.g.h +6 -6
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +6 -6
- package/index.windows.js +4 -2
- package/package.json +3 -4
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/stubs/glog/logging.h +1 -1
- package/Microsoft.ReactNative/JSDispatcherWriter.h +0 -47
- package/Microsoft.ReactNative/SynchronousEventBeat.cpp +0 -51
- package/Microsoft.ReactNative/SynchronousEventBeat.h +0 -31
|
@@ -31,24 +31,29 @@ extern "C" HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICIma
|
|
|
31
31
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
32
32
|
|
|
33
33
|
ImageComponentView::WindowsImageResponseObserver::WindowsImageResponseObserver(
|
|
34
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
34
35
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> wkImage)
|
|
35
|
-
: m_wkImage(std::move(wkImage)) {}
|
|
36
|
+
: m_reactContext(reactContext), m_wkImage(std::move(wkImage)) {}
|
|
36
37
|
|
|
37
38
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveProgress(float progress, int64_t loaded, int64_t total)
|
|
38
39
|
const {
|
|
39
|
-
|
|
40
|
+
int loadedInt = static_cast<int>(loaded);
|
|
41
|
+
int totalInt = static_cast<int>(total);
|
|
42
|
+
m_reactContext.UIDispatcher().Post([progress, wkImage = m_wkImage, loadedInt, totalInt]() {
|
|
43
|
+
if (auto image = wkImage.get()) {
|
|
44
|
+
image->didReceiveProgress(progress, loadedInt, totalInt);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveImage(
|
|
43
50
|
facebook::react::ImageResponse const &imageResponse) const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}
|
|
51
|
+
auto imageResponseImage = std::static_pointer_cast<ImageResponseImage>(imageResponse.getImage());
|
|
52
|
+
m_reactContext.UIDispatcher().Post([imageResponseImage, wkImage = m_wkImage]() {
|
|
53
|
+
if (auto image{wkImage.get()}) {
|
|
54
|
+
image->didReceiveImage(imageResponseImage);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveFailure(
|
|
@@ -95,6 +100,21 @@ void ImageComponentView::ImageLoadStart() noexcept {
|
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
|
|
103
|
+
void ImageComponentView::ImageLoaded() noexcept {
|
|
104
|
+
auto imageEventEmitter = std::static_pointer_cast<facebook::react::ImageEventEmitter const>(m_eventEmitter);
|
|
105
|
+
if (imageEventEmitter) {
|
|
106
|
+
imageEventEmitter->onLoadEnd();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
void ImageComponentView::didReceiveProgress(float progress, int loaded, int total) noexcept {
|
|
111
|
+
auto imageEventEmitter = std::static_pointer_cast<facebook::react::ImageEventEmitter const>(m_eventEmitter);
|
|
112
|
+
if (imageEventEmitter) {
|
|
113
|
+
imageEventEmitter->onProgress(progress, loaded, total);
|
|
114
|
+
}
|
|
115
|
+
ensureDrawingSurface();
|
|
116
|
+
}
|
|
117
|
+
|
|
98
118
|
void ImageComponentView::didReceiveImage(const std::shared_ptr<ImageResponseImage> &imageResponseImage) noexcept {
|
|
99
119
|
// TODO check for recycled?
|
|
100
120
|
|
|
@@ -152,7 +172,7 @@ void ImageComponentView::updateState(
|
|
|
152
172
|
auto newImageState = std::static_pointer_cast<facebook::react::ImageShadowNode::ConcreteState const>(state);
|
|
153
173
|
|
|
154
174
|
if (!m_imageResponseObserver) {
|
|
155
|
-
m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(get_weak());
|
|
175
|
+
m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(this->m_reactContext, get_weak());
|
|
156
176
|
}
|
|
157
177
|
|
|
158
178
|
setStateAndResubscribeImageResponseObserver(newImageState);
|
|
@@ -281,6 +301,9 @@ void ImageComponentView::ensureDrawingSurface() noexcept {
|
|
|
281
301
|
: winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::Uniform);
|
|
282
302
|
break;
|
|
283
303
|
}
|
|
304
|
+
case facebook::react::ImageResizeMode::None:
|
|
305
|
+
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None);
|
|
306
|
+
break;
|
|
284
307
|
default:
|
|
285
308
|
assert(false);
|
|
286
309
|
}
|
|
@@ -71,6 +71,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
71
71
|
struct WindowsImageResponseObserver : facebook::react::ImageResponseObserver {
|
|
72
72
|
public:
|
|
73
73
|
WindowsImageResponseObserver(
|
|
74
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
74
75
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> wkImage);
|
|
75
76
|
void didReceiveProgress(float progress, int64_t loaded, int64_t total) const override;
|
|
76
77
|
void didReceiveImage(const facebook::react::ImageResponse &imageResponse) const override;
|
|
@@ -78,6 +79,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
78
79
|
|
|
79
80
|
private:
|
|
80
81
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> m_wkImage;
|
|
82
|
+
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
void ensureDrawingSurface() noexcept;
|
|
@@ -85,6 +87,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
85
87
|
|
|
86
88
|
void ImageLoadStart() noexcept;
|
|
87
89
|
void ImageLoaded() noexcept;
|
|
90
|
+
void didReceiveProgress(float progress, int loaded, int total) noexcept;
|
|
88
91
|
void didReceiveImage(const std::shared_ptr<ImageResponseImage> &wicbmp) noexcept;
|
|
89
92
|
void didReceiveFailureFromObserver(const facebook::react::ImageLoadError &error) noexcept;
|
|
90
93
|
void setStateAndResubscribeImageResponseObserver(
|
package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp
CHANGED
|
@@ -35,33 +35,29 @@ struct ModalHostState
|
|
|
35
35
|
struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::Foundation::IInspectable>,
|
|
36
36
|
::Microsoft::ReactNativeSpecs::BaseModalHostView<ModalHostView> {
|
|
37
37
|
~ModalHostView() {
|
|
38
|
-
if (m_window && m_window.IsVisible()) {
|
|
39
|
-
CloseWindow();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
38
|
if (m_reactNativeIsland) {
|
|
43
39
|
m_reactNativeIsland.Island().Close();
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
m_bridge.Close();
|
|
42
|
+
// Add AppWindow closing token cleanup
|
|
43
|
+
if (m_appWindow && m_appWindowClosingToken) {
|
|
44
|
+
m_appWindow.Closing(m_appWindowClosingToken);
|
|
45
|
+
m_appWindowClosingToken.value = 0;
|
|
52
46
|
}
|
|
53
47
|
|
|
54
|
-
if (m_window) {
|
|
55
|
-
m_window.Destroy();
|
|
56
|
-
m_window = nullptr;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
60
48
|
if (m_popUp) {
|
|
49
|
+
if (m_departFocusToken && !m_popUp.IsClosed()) {
|
|
50
|
+
// WASDK BUG: InputFocusNavigationHost::GetForSiteBridge fails on a DesktopPopupSiteBridge
|
|
51
|
+
// https://github.com/microsoft/react-native-windows/issues/14604
|
|
52
|
+
/*
|
|
53
|
+
auto navHost =
|
|
54
|
+
winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(m_popUp.as<winrt::Microsoft::UI::Content::IContentSiteBridge>());
|
|
55
|
+
navHost.DepartFocusRequested(m_departFocusToken);
|
|
56
|
+
*/
|
|
57
|
+
}
|
|
61
58
|
m_popUp.Close();
|
|
62
59
|
m_popUp = nullptr;
|
|
63
60
|
}
|
|
64
|
-
#endif
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
void InitializePortalViewComponent(
|
|
@@ -78,18 +74,54 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
78
74
|
const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
79
75
|
const winrt::com_ptr<::Microsoft::ReactNativeSpecs::ModalHostViewProps> &newProps,
|
|
80
76
|
const winrt::com_ptr<::Microsoft::ReactNativeSpecs::ModalHostViewProps> &oldProps) noexcept override {
|
|
81
|
-
|
|
77
|
+
// Store the props locally
|
|
78
|
+
m_localProps = newProps;
|
|
79
|
+
|
|
80
|
+
const auto &oldViewProps = *oldProps;
|
|
81
|
+
const auto &newViewProps = *newProps;
|
|
82
|
+
|
|
83
|
+
if (!oldProps || newViewProps.visible != oldViewProps.visible) {
|
|
82
84
|
if (newProps->visible.value_or(true)) {
|
|
85
|
+
m_visible = true;
|
|
83
86
|
// We do not immediately show the window, since we want to resize/position
|
|
84
87
|
// the window based on the layout metrics before we show it
|
|
85
|
-
|
|
88
|
+
QueueShow(view);
|
|
86
89
|
} else {
|
|
90
|
+
m_visible = false;
|
|
87
91
|
CloseWindow();
|
|
88
92
|
}
|
|
89
93
|
}
|
|
94
|
+
|
|
95
|
+
// Update Title if changed and AppWindow exists
|
|
96
|
+
if (m_appWindow && (!oldProps || newViewProps.title != oldViewProps.title)) {
|
|
97
|
+
// Use empty string if title is not set
|
|
98
|
+
winrt::hstring titleValue =
|
|
99
|
+
newViewProps.title.has_value() ? winrt::to_hstring(newViewProps.title.value()) : winrt::hstring();
|
|
100
|
+
m_appWindow.Title(titleValue);
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
::Microsoft::ReactNativeSpecs::BaseModalHostView<ModalHostView>::UpdateProps(view, newProps, oldProps);
|
|
91
104
|
}
|
|
92
105
|
|
|
106
|
+
void QueueShow(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
107
|
+
if (m_showQueued)
|
|
108
|
+
return;
|
|
109
|
+
m_showQueued = true;
|
|
110
|
+
|
|
111
|
+
m_reactContext.UIDispatcher().Post([wkThis = get_weak(), wkView = winrt::weak_ref(view)]() {
|
|
112
|
+
if (auto strongThis = wkThis.get()) {
|
|
113
|
+
strongThis->m_showQueued = false;
|
|
114
|
+
|
|
115
|
+
if (!strongThis->m_visible) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (auto v = wkView.get()) {
|
|
119
|
+
strongThis->ShowOnUIThread(v);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
93
125
|
void UpdateState(
|
|
94
126
|
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
|
95
127
|
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept override {
|
|
@@ -118,19 +150,11 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
118
150
|
m_childLayoutMetricsToken.value = 0;
|
|
119
151
|
}
|
|
120
152
|
|
|
121
|
-
void FinalizeUpdate(
|
|
122
|
-
const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
123
|
-
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept override {
|
|
124
|
-
if (m_showQueued) {
|
|
125
|
-
ShowOnUIThread(view);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
153
|
private:
|
|
130
154
|
void OnMounted(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
131
155
|
m_mounted = true;
|
|
132
|
-
if (
|
|
133
|
-
|
|
156
|
+
if (m_visible) {
|
|
157
|
+
QueueShow(view);
|
|
134
158
|
}
|
|
135
159
|
}
|
|
136
160
|
|
|
@@ -139,11 +163,7 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
139
163
|
}
|
|
140
164
|
|
|
141
165
|
void AdjustWindowSize(const winrt::Microsoft::ReactNative::LayoutMetrics &layoutMetrics) noexcept {
|
|
142
|
-
|
|
143
|
-
if (!m_popUp) {
|
|
144
|
-
#else
|
|
145
|
-
if (!m_window) {
|
|
146
|
-
#endif
|
|
166
|
+
if (!m_appWindow) {
|
|
147
167
|
return;
|
|
148
168
|
}
|
|
149
169
|
|
|
@@ -151,65 +171,45 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
151
171
|
return;
|
|
152
172
|
}
|
|
153
173
|
|
|
154
|
-
//
|
|
174
|
+
// Calculate physical pixels from DIPs
|
|
175
|
+
int32_t clientWidthPx = static_cast<int32_t>(layoutMetrics.Frame.Width * layoutMetrics.PointScaleFactor);
|
|
176
|
+
int32_t clientHeightPx = static_cast<int32_t>(layoutMetrics.Frame.Height * layoutMetrics.PointScaleFactor);
|
|
177
|
+
|
|
178
|
+
// Ensure minimum size for the window
|
|
179
|
+
clientWidthPx = std::max(100, clientWidthPx);
|
|
180
|
+
clientHeightPx = std::max(100, clientHeightPx);
|
|
181
|
+
|
|
182
|
+
// Size the client area directly
|
|
183
|
+
m_appWindow.ResizeClient({clientWidthPx, clientHeightPx});
|
|
184
|
+
|
|
185
|
+
// Center the window on its parent
|
|
155
186
|
RECT parentRC;
|
|
156
187
|
GetWindowRect(m_parentHwnd, &parentRC);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
int32_t
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
winrt::Windows::Graphics::RectInt32 rect2{
|
|
164
|
-
(int)xCor,
|
|
165
|
-
(int)yCor,
|
|
166
|
-
static_cast<int32_t>(layoutMetrics.Frame.Width * (layoutMetrics.PointScaleFactor)),
|
|
167
|
-
static_cast<int32_t>(layoutMetrics.Frame.Height * (layoutMetrics.PointScaleFactor))};
|
|
168
|
-
m_popUp.MoveAndResize(rect2);
|
|
169
|
-
#else
|
|
170
|
-
// Fix for https://github.com/microsoft/microsoft-ui-xaml/issues/9529
|
|
171
|
-
auto titleBarHeight = m_window.TitleBar().Height();
|
|
172
|
-
|
|
173
|
-
// Adjust window position and size
|
|
174
|
-
m_window.ResizeClient(
|
|
175
|
-
{static_cast<int32_t>(layoutMetrics.Frame.Width * (layoutMetrics.PointScaleFactor)),
|
|
176
|
-
static_cast<int32_t>(layoutMetrics.Frame.Height * (layoutMetrics.PointScaleFactor)) - titleBarHeight});
|
|
177
|
-
m_window.Move({xCor, yCor});
|
|
178
|
-
#endif
|
|
188
|
+
auto outerSize = m_appWindow.Size();
|
|
189
|
+
|
|
190
|
+
int32_t xCor = parentRC.left + (parentRC.right - parentRC.left - outerSize.Width) / 2;
|
|
191
|
+
int32_t yCor = parentRC.top + (parentRC.bottom - parentRC.top - outerSize.Height) / 2;
|
|
192
|
+
|
|
193
|
+
m_appWindow.Move({xCor, yCor});
|
|
179
194
|
};
|
|
180
195
|
|
|
181
196
|
void ShowOnUIThread(const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
182
197
|
if (!m_mounted)
|
|
183
198
|
return;
|
|
184
199
|
|
|
185
|
-
m_showQueued = false;
|
|
186
200
|
EnsureModalCreated(view);
|
|
187
201
|
|
|
188
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
189
202
|
if (m_popUp) {
|
|
190
|
-
m_bridge.Enable();
|
|
191
203
|
m_popUp.Show();
|
|
192
204
|
|
|
205
|
+
// WASDK BUG: InputFocusNavigationHost::GetForSiteBridge fails on a DesktopPopupSiteBridge
|
|
206
|
+
// https://github.com/microsoft/react-native-windows/issues/14604
|
|
207
|
+
/*
|
|
193
208
|
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(
|
|
194
209
|
m_popUp.as<winrt::Microsoft::UI::Content::IContentSiteBridge>());
|
|
195
210
|
auto result = navHost.NavigateFocus(winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(
|
|
196
211
|
winrt::Microsoft::UI::Input::FocusNavigationReason::First));
|
|
197
|
-
|
|
198
|
-
// dispatch onShow event
|
|
199
|
-
if (auto eventEmitter = EventEmitter()) {
|
|
200
|
-
::Microsoft::ReactNativeSpecs::ModalHostViewEventEmitter::OnShow eventArgs;
|
|
201
|
-
eventEmitter->onShow(eventArgs);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
#endif
|
|
205
|
-
|
|
206
|
-
if (m_window && !m_window.IsVisible()) {
|
|
207
|
-
m_bridge.Enable();
|
|
208
|
-
m_window.Show(true);
|
|
209
|
-
|
|
210
|
-
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(m_bridge);
|
|
211
|
-
auto result = navHost.NavigateFocus(winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(
|
|
212
|
-
winrt::Microsoft::UI::Input::FocusNavigationReason::First));
|
|
212
|
+
*/
|
|
213
213
|
|
|
214
214
|
// dispatch onShow event
|
|
215
215
|
if (auto eventEmitter = EventEmitter()) {
|
|
@@ -222,16 +222,15 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
222
222
|
void CloseWindow() noexcept {
|
|
223
223
|
// enable input to parent before closing the modal window, so focus can return back to the parent window
|
|
224
224
|
EnableWindow(m_parentHwnd, true);
|
|
225
|
-
|
|
226
|
-
if (m_window) {
|
|
227
|
-
m_window.Hide();
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
231
225
|
if (m_popUp) {
|
|
232
226
|
m_popUp.Hide();
|
|
233
227
|
}
|
|
234
|
-
|
|
228
|
+
|
|
229
|
+
// Unregister closing event handler
|
|
230
|
+
if (m_appWindow && m_appWindowClosingToken) {
|
|
231
|
+
m_appWindow.Closing(m_appWindowClosingToken);
|
|
232
|
+
m_appWindowClosingToken.value = 0;
|
|
233
|
+
}
|
|
235
234
|
|
|
236
235
|
// dispatch onDismiss event
|
|
237
236
|
if (auto eventEmitter = EventEmitter()) {
|
|
@@ -245,21 +244,13 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
245
244
|
m_reactContext.Properties().Handle(), m_prevWindowID);
|
|
246
245
|
m_prevWindowID = 0;
|
|
247
246
|
}
|
|
248
|
-
|
|
249
|
-
m_bridge.Disable();
|
|
250
247
|
}
|
|
251
248
|
|
|
252
249
|
// creates a new modal window
|
|
253
250
|
void EnsureModalCreated(const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
254
|
-
if (m_window) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
259
251
|
if (m_popUp) {
|
|
260
252
|
return;
|
|
261
253
|
}
|
|
262
|
-
#endif
|
|
263
254
|
// get the root hwnd
|
|
264
255
|
m_prevWindowID =
|
|
265
256
|
winrt::Microsoft::ReactNative::ReactCoreInjection::GetTopLevelWindowId(view.ReactContext().Properties());
|
|
@@ -268,52 +259,63 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
268
259
|
view.as<::Microsoft::ReactNative::Composition::Experimental::IComponentViewInterop>()->GetHwndForParenting();
|
|
269
260
|
|
|
270
261
|
auto portal = view.as<winrt::Microsoft::ReactNative::Composition::PortalComponentView>();
|
|
271
|
-
|
|
272
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
273
|
-
m_bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
|
|
274
|
-
view.Parent().as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor(),
|
|
275
|
-
winrt::Microsoft::UI::GetWindowIdFromWindow(m_parentHwnd));
|
|
276
262
|
m_reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland::CreatePortal(portal);
|
|
277
263
|
auto contentIsland = m_reactNativeIsland.Island();
|
|
278
264
|
|
|
279
|
-
m_popUp =
|
|
265
|
+
m_popUp = winrt::Microsoft::UI::Content::DesktopPopupSiteBridge::Create(
|
|
266
|
+
portal.Parent()
|
|
267
|
+
.as<winrt::Microsoft::ReactNative::Composition::ComponentView>()
|
|
268
|
+
.Root()
|
|
269
|
+
.ReactNativeIsland()
|
|
270
|
+
.Island());
|
|
280
271
|
m_popUp.Connect(contentIsland);
|
|
281
272
|
|
|
282
|
-
//
|
|
283
|
-
winrt::Microsoft::
|
|
284
|
-
|
|
285
|
-
|
|
273
|
+
// Get AppWindow and configure presenter
|
|
274
|
+
m_appWindow = winrt::Microsoft::UI::Windowing::AppWindow::GetFromWindowId(m_popUp.WindowId());
|
|
275
|
+
if (m_appWindow) {
|
|
276
|
+
auto overlappedPresenter = winrt::Microsoft::UI::Windowing::OverlappedPresenter::Create();
|
|
286
277
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
[wkView = winrt::make_weak(view)](
|
|
291
|
-
const auto &sender, const winrt::Microsoft::UI::Input::FocusNavigationRequestEventArgs &args) {
|
|
292
|
-
if (auto strongView = wkView.get()) {
|
|
293
|
-
TrySetFocus(strongView.Parent());
|
|
294
|
-
}
|
|
295
|
-
});
|
|
278
|
+
// Configure presenter for modal behavior
|
|
279
|
+
overlappedPresenter.IsModal(true);
|
|
280
|
+
overlappedPresenter.SetBorderAndTitleBar(true, true);
|
|
296
281
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
presenter.SetBorderAndTitleBar(true, false);
|
|
300
|
-
presenter.IsModal(true);
|
|
282
|
+
// Apply the presenter to the window
|
|
283
|
+
m_appWindow.SetPresenter(overlappedPresenter);
|
|
301
284
|
|
|
302
|
-
|
|
303
|
-
|
|
285
|
+
// Set initial title using the stored local props
|
|
286
|
+
if (m_localProps && m_localProps->title.has_value()) {
|
|
287
|
+
winrt::hstring titleValue = winrt::to_hstring(m_localProps->title.value());
|
|
288
|
+
m_appWindow.Title(titleValue);
|
|
289
|
+
} else {
|
|
290
|
+
m_appWindow.Title(L""); // Empty title if not provided
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Handle close request ('X' button)
|
|
294
|
+
m_appWindowClosingToken =
|
|
295
|
+
m_appWindow.Closing([wkThis = get_weak()](
|
|
296
|
+
const winrt::Microsoft::UI::Windowing::AppWindow & /*sender*/,
|
|
297
|
+
const winrt::Microsoft::UI::Windowing::AppWindowClosingEventArgs &args) {
|
|
298
|
+
args.Cancel(true); // Prevent default close
|
|
299
|
+
if (auto strongThis = wkThis.get()) {
|
|
300
|
+
// Dispatch onRequestClose event
|
|
301
|
+
if (auto eventEmitter = strongThis->EventEmitter()) {
|
|
302
|
+
::Microsoft::ReactNativeSpecs::ModalHostViewEventEmitter::OnRequestClose eventArgs;
|
|
303
|
+
eventEmitter->onRequestClose(eventArgs);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
304
308
|
|
|
305
309
|
// set the top-level windows as the new hwnd
|
|
306
310
|
winrt::Microsoft::ReactNative::ReactCoreInjection::SetTopLevelWindowId(
|
|
307
311
|
view.ReactContext().Properties(),
|
|
308
|
-
reinterpret_cast<uint64_t>(winrt::Microsoft::UI::GetWindowFromWindowId(
|
|
309
|
-
|
|
310
|
-
// create a react native island - code taken from CompositionHwndHost
|
|
311
|
-
m_bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
|
|
312
|
-
view.Parent().as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor(), m_window.Id());
|
|
313
|
-
m_reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland::CreatePortal(portal);
|
|
314
|
-
auto contentIsland = m_reactNativeIsland.Island();
|
|
312
|
+
reinterpret_cast<uint64_t>(winrt::Microsoft::UI::GetWindowFromWindowId(m_popUp.WindowId())));
|
|
315
313
|
|
|
316
|
-
|
|
314
|
+
// WASDK BUG: InputFocusNavigationHost::GetForSiteBridge fails on a DesktopPopupSiteBridge
|
|
315
|
+
// https://github.com/microsoft/react-native-windows/issues/14604
|
|
316
|
+
/*
|
|
317
|
+
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(
|
|
318
|
+
m_popUp.as<winrt::Microsoft::UI::Content::IContentSiteBridge>());
|
|
317
319
|
m_departFocusToken = navHost.DepartFocusRequested(
|
|
318
320
|
[wkView = winrt::make_weak(view)](
|
|
319
321
|
const auto &sender, const winrt::Microsoft::UI::Input::FocusNavigationRequestEventArgs &args) {
|
|
@@ -321,9 +323,7 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
321
323
|
TrySetFocus(strongView.Parent());
|
|
322
324
|
}
|
|
323
325
|
});
|
|
324
|
-
|
|
325
|
-
#endif
|
|
326
|
-
m_bridge.ResizePolicy(winrt::Microsoft::UI::Content::ContentSizePolicy::ResizeContentToParentWindow);
|
|
326
|
+
*/
|
|
327
327
|
|
|
328
328
|
m_islandStateChangedToken =
|
|
329
329
|
contentIsland.StateChanged([weakThis = get_weak()](
|
|
@@ -341,12 +341,11 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
341
341
|
if (portal.ContentRoot().Children().Size()) {
|
|
342
342
|
AdjustWindowSize(portal.ContentRoot().Children().GetAt(0).LayoutMetrics());
|
|
343
343
|
}
|
|
344
|
-
m_bridge.Show();
|
|
345
344
|
}
|
|
346
345
|
|
|
347
346
|
void UpdateConstraints() noexcept {
|
|
348
347
|
auto displayArea = winrt::Microsoft::UI::Windowing::DisplayArea::GetFromDisplayId(
|
|
349
|
-
|
|
348
|
+
m_popUp.SiteView().EnvironmentView().DisplayId());
|
|
350
349
|
auto workArea = displayArea.WorkArea();
|
|
351
350
|
|
|
352
351
|
float scale = m_reactNativeIsland.Island().RasterizationScale();
|
|
@@ -379,21 +378,20 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
379
378
|
|
|
380
379
|
ReactContext m_reactContext{nullptr};
|
|
381
380
|
HWND m_parentHwnd{nullptr};
|
|
382
|
-
winrt::Microsoft::UI::Windowing::AppWindow m_window{nullptr};
|
|
383
381
|
uint64_t m_prevWindowID;
|
|
384
|
-
bool m_showTitleBar{false};
|
|
385
382
|
bool m_showQueued{false};
|
|
383
|
+
bool m_visible{false};
|
|
386
384
|
bool m_mounted{false};
|
|
387
385
|
winrt::event_token m_islandStateChangedToken;
|
|
388
386
|
winrt::Microsoft::UI::Input::InputFocusNavigationHost::DepartFocusRequested_revoker m_departFocusRevoker;
|
|
389
387
|
winrt::event_token m_departFocusToken;
|
|
390
388
|
winrt::event_token m_childLayoutMetricsToken;
|
|
391
389
|
winrt::Microsoft::ReactNative::IComponentState m_state{nullptr};
|
|
392
|
-
winrt::Microsoft::UI::Content::DesktopChildSiteBridge m_bridge{nullptr};
|
|
393
390
|
winrt::Microsoft::ReactNative::ReactNativeIsland m_reactNativeIsland{nullptr};
|
|
394
|
-
|
|
395
|
-
winrt::Microsoft::UI::
|
|
396
|
-
|
|
391
|
+
winrt::Microsoft::UI::Content::DesktopPopupSiteBridge m_popUp{nullptr};
|
|
392
|
+
winrt::Microsoft::UI::Windowing::AppWindow m_appWindow{nullptr};
|
|
393
|
+
winrt::event_token m_appWindowClosingToken;
|
|
394
|
+
winrt::com_ptr<::Microsoft::ReactNativeSpecs::ModalHostViewProps> m_localProps{nullptr};
|
|
397
395
|
};
|
|
398
396
|
|
|
399
397
|
void RegisterWindowsModalHostNativeComponent(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
// Copyright (c) Microsoft Corporation.
|
|
3
2
|
// Licensed under the MIT License.
|
|
4
3
|
|
|
@@ -32,14 +31,12 @@ ParagraphComponentView::ParagraphComponentView(
|
|
|
32
31
|
void ParagraphComponentView::MountChildComponentView(
|
|
33
32
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
34
33
|
uint32_t index) noexcept {
|
|
35
|
-
assert(false);
|
|
36
34
|
base_type::MountChildComponentView(childComponentView, index);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
void ParagraphComponentView::UnmountChildComponentView(
|
|
40
38
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
41
39
|
uint32_t index) noexcept {
|
|
42
|
-
assert(false);
|
|
43
40
|
base_type::UnmountChildComponentView(childComponentView, index);
|
|
44
41
|
}
|
|
45
42
|
|
|
@@ -64,6 +61,10 @@ void ParagraphComponentView::updateProps(
|
|
|
64
61
|
updateTextAlignment(newViewProps.textAttributes.alignment);
|
|
65
62
|
}
|
|
66
63
|
|
|
64
|
+
if (oldViewProps.paragraphAttributes.adjustsFontSizeToFit != newViewProps.paragraphAttributes.adjustsFontSizeToFit) {
|
|
65
|
+
m_requireRedraw = true;
|
|
66
|
+
}
|
|
67
|
+
|
|
67
68
|
Super::updateProps(props, oldProps);
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -73,7 +74,7 @@ void ParagraphComponentView::updateState(
|
|
|
73
74
|
const auto &newState = *std::static_pointer_cast<facebook::react::ParagraphShadowNode::ConcreteState const>(state);
|
|
74
75
|
|
|
75
76
|
m_attributedStringBox = facebook::react::AttributedStringBox(newState.getData().attributedString);
|
|
76
|
-
m_paragraphAttributes =
|
|
77
|
+
m_paragraphAttributes = facebook::react::ParagraphAttributes(newState.getData().paragraphAttributes);
|
|
77
78
|
|
|
78
79
|
m_textLayout = nullptr;
|
|
79
80
|
}
|
|
@@ -168,7 +169,9 @@ void ParagraphComponentView::updateVisualBrush() noexcept {
|
|
|
168
169
|
constraints.maximumSize.height =
|
|
169
170
|
m_layoutMetrics.frame.size.height - m_layoutMetrics.contentInsets.top - m_layoutMetrics.contentInsets.bottom;
|
|
170
171
|
|
|
171
|
-
facebook::react::TextLayoutManager::GetTextLayout(
|
|
172
|
+
facebook::react::TextLayoutManager::GetTextLayout(
|
|
173
|
+
m_attributedStringBox, m_paragraphAttributes, constraints, m_textLayout);
|
|
174
|
+
|
|
172
175
|
requireNewBrush = true;
|
|
173
176
|
}
|
|
174
177
|
|
|
@@ -199,6 +202,7 @@ void ParagraphComponentView::updateVisualBrush() noexcept {
|
|
|
199
202
|
// The surfaceBrush's size is based on the size the text takes up, which maybe smaller than the total visual
|
|
200
203
|
// So we need to align the brush within the visual to match the text alignment.
|
|
201
204
|
float horizAlignment{0.f};
|
|
205
|
+
|
|
202
206
|
/*
|
|
203
207
|
const auto &props = paragraphProps()
|
|
204
208
|
if (props.textAttributes.alignment) {
|
|
@@ -227,7 +231,6 @@ void ParagraphComponentView::updateVisualBrush() noexcept {
|
|
|
227
231
|
// TODO Using brush alignment to align the text makes it blurry...
|
|
228
232
|
if (m_drawingSurface) {
|
|
229
233
|
m_drawingSurface.HorizontalAlignmentRatio(horizAlignment);
|
|
230
|
-
m_drawingSurface.VerticalAlignmentRatio(0.f);
|
|
231
234
|
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None);
|
|
232
235
|
}
|
|
233
236
|
Visual().as<Experimental::ISpriteVisual>().Brush(m_drawingSurface);
|