react-native-windows 0.0.0-canary.751 → 0.0.0-canary.753
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/Libraries/Alert/NativeDialogManagerWindows.js +1 -1
- package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +5 -0
- package/Libraries/NewAppScreen/components/DebugInstructions.windows.js +4 -2
- package/Libraries/NewAppScreen/components/ReloadInstructions.windows.js +3 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.windows.js +1 -1
- package/Microsoft.ReactNative/Base/CoreUIManagers.cpp +2 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +13 -9
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +145 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +59 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +18 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +16 -3
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +3 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +6 -0
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +1 -1
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.cpp +77 -0
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.h +27 -0
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/ReactCommon/ReactCommon.vcxproj +5 -4
- package/ReactCommon/ReactCommon.vcxproj.filters +12 -1
- package/Shared/Shared.vcxitems +9 -0
- package/Shared/Shared.vcxitems.filters +13 -0
- package/package.json +1 -1
- package/ReactCommon/Yoga.cpp +0 -947
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import React from 'react';
|
|
12
11
|
import type {Node} from 'react';
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
14
|
+
import Text from '../../Text/Text';
|
|
15
|
+
import React from 'react';
|
|
14
16
|
|
|
15
17
|
const styles = StyleSheet.create({
|
|
16
18
|
highlight: {
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {Node} from 'react';
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
14
|
+
import Text from '../../Text/Text';
|
|
13
15
|
import React from 'react';
|
|
14
16
|
|
|
15
17
|
const styles = StyleSheet.create({
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
#include <Views/SwitchViewManager.h>
|
|
23
23
|
#include <Views/TextInputViewManager.h>
|
|
24
24
|
#include <Views/TextViewManager.h>
|
|
25
|
+
#include <Views/UnimplementedViewManager.h>
|
|
25
26
|
#include <Views/ViewViewManager.h>
|
|
26
27
|
#include <Views/VirtualTextViewManager.h>
|
|
27
28
|
|
|
@@ -33,6 +34,7 @@ void AddStandardViewManagers(
|
|
|
33
34
|
viewManagers.push_back(std::make_unique<ActivityIndicatorViewManager>(context));
|
|
34
35
|
viewManagers.push_back(std::make_unique<FlyoutViewManager>(context));
|
|
35
36
|
viewManagers.push_back(std::make_unique<ImageViewManager>(context));
|
|
37
|
+
viewManagers.push_back(std::make_unique<UnimplementedViewManager>(context, L"RCTModalHostView"));
|
|
36
38
|
viewManagers.push_back(std::make_unique<PopupViewManager>(context));
|
|
37
39
|
viewManagers.push_back(std::make_unique<RawTextViewManager>(context));
|
|
38
40
|
viewManagers.push_back(std::make_unique<RootViewManager>(context));
|
|
@@ -46,6 +46,12 @@ namespace Microsoft.ReactNative.Composition
|
|
|
46
46
|
unsealed runtimeclass ActivityIndicatorComponentView : ComponentView {
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
[experimental]
|
|
50
|
+
[webhosthidden]
|
|
51
|
+
[default_interface]
|
|
52
|
+
unsealed runtimeclass WindowsModalHostComponentView : ComponentView {
|
|
53
|
+
};
|
|
54
|
+
|
|
49
55
|
[experimental]
|
|
50
56
|
[webhosthidden]
|
|
51
57
|
[default_interface]
|
|
@@ -10,27 +10,28 @@
|
|
|
10
10
|
#include <react/renderer/components/scrollview/ScrollViewShadowNode.h>
|
|
11
11
|
#pragma warning(pop)
|
|
12
12
|
|
|
13
|
-
#include <Fabric/Composition/TextInput/WindowsTextInputShadowNode.h>
|
|
14
|
-
#include <react/components/rnwcore/ShadowNodes.h>
|
|
15
|
-
#include <react/renderer/components/image/ImageShadowNode.h>
|
|
16
|
-
#include <react/renderer/components/root/RootShadowNode.h>
|
|
17
|
-
#include <react/renderer/components/text/ParagraphShadowNode.h>
|
|
18
|
-
#include <react/renderer/components/text/RawTextShadowNode.h>
|
|
19
|
-
#include <react/renderer/components/text/TextShadowNode.h>
|
|
20
|
-
#include <react/renderer/components/view/ViewShadowNode.h>
|
|
21
|
-
|
|
22
13
|
#include <Fabric/Composition/AbiCompositionViewComponentView.h>
|
|
23
14
|
#include <Fabric/Composition/ActivityIndicatorComponentView.h>
|
|
24
15
|
#include <Fabric/Composition/CompositionHelpers.h>
|
|
25
16
|
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
26
17
|
#include <Fabric/Composition/ImageComponentView.h>
|
|
18
|
+
#include <Fabric/Composition/Modal/WindowsModalHostViewComponentView.h>
|
|
19
|
+
#include <Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h>
|
|
27
20
|
#include <Fabric/Composition/ParagraphComponentView.h>
|
|
28
21
|
#include <Fabric/Composition/RootComponentView.h>
|
|
29
22
|
#include <Fabric/Composition/ScrollViewComponentView.h>
|
|
30
23
|
#include <Fabric/Composition/SwitchComponentView.h>
|
|
31
24
|
#include <Fabric/Composition/TextInput/WindowsTextInputComponentView.h>
|
|
25
|
+
#include <Fabric/Composition/TextInput/WindowsTextInputShadowNode.h>
|
|
32
26
|
#include <Fabric/Composition/UnimplementedNativeViewComponentView.h>
|
|
33
27
|
#include <Fabric/WindowsComponentDescriptorRegistry.h>
|
|
28
|
+
#include <react/components/rnwcore/ShadowNodes.h>
|
|
29
|
+
#include <react/renderer/components/image/ImageShadowNode.h>
|
|
30
|
+
#include <react/renderer/components/root/RootShadowNode.h>
|
|
31
|
+
#include <react/renderer/components/text/ParagraphShadowNode.h>
|
|
32
|
+
#include <react/renderer/components/text/RawTextShadowNode.h>
|
|
33
|
+
#include <react/renderer/components/text/TextShadowNode.h>
|
|
34
|
+
#include <react/renderer/components/view/ViewShadowNode.h>
|
|
34
35
|
|
|
35
36
|
namespace Microsoft::ReactNative {
|
|
36
37
|
|
|
@@ -58,6 +59,9 @@ ComponentViewDescriptor const &ComponentViewRegistry::dequeueComponentViewWithCo
|
|
|
58
59
|
} else if (componentHandle == facebook::react::ImageShadowNode::Handle()) {
|
|
59
60
|
view = winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView::Create(
|
|
60
61
|
compContext, tag, m_context);
|
|
62
|
+
} else if (componentHandle == facebook::react::WindowsModalHostViewShadowNode::Handle()) {
|
|
63
|
+
view = winrt::Microsoft::ReactNative::Composition::implementation::WindowsModalHostComponentView::Create(
|
|
64
|
+
compContext, tag, m_context);
|
|
61
65
|
} else if (componentHandle == facebook::react::WindowsTextInputShadowNode::Handle()) {
|
|
62
66
|
view = winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView::Create(
|
|
63
67
|
compContext, tag, m_context);
|
package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <glog/logging.h>
|
|
11
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
12
|
+
// [Windows
|
|
13
|
+
#include "WindowsModalHostViewShadowNode.h"
|
|
14
|
+
// ]
|
|
15
|
+
|
|
16
|
+
namespace facebook::react {
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Descriptor for <WindowsModalHostView> component.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
class WindowsModalHostViewComponentDescriptor final
|
|
23
|
+
: public ConcreteComponentDescriptor<WindowsModalHostViewShadowNode> {
|
|
24
|
+
public:
|
|
25
|
+
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
|
|
26
|
+
|
|
27
|
+
void adopt(ShadowNode &shadowNode) const override {
|
|
28
|
+
auto &layoutableShadowNode = static_cast<YogaLayoutableShadowNode &>(shadowNode);
|
|
29
|
+
auto &stateData =
|
|
30
|
+
static_cast<const WindowsModalHostViewShadowNode::ConcreteState &>(*shadowNode.getState()).getData();
|
|
31
|
+
|
|
32
|
+
layoutableShadowNode.setSize(Size{stateData.screenSize.width, stateData.screenSize.height});
|
|
33
|
+
layoutableShadowNode.setPositionType(YGPositionTypeAbsolute);
|
|
34
|
+
|
|
35
|
+
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "WindowsModalHostViewComponentView.h"
|
|
8
|
+
|
|
9
|
+
#include <Fabric/DWriteHelpers.h>
|
|
10
|
+
#include "../CompositionDynamicAutomationProvider.h"
|
|
11
|
+
#include "Composition/AutoDraw.h"
|
|
12
|
+
#include "Unicode.h"
|
|
13
|
+
|
|
14
|
+
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
15
|
+
|
|
16
|
+
winrt::Microsoft::ReactNative::ComponentView WindowsModalHostComponentView::Create(
|
|
17
|
+
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
18
|
+
facebook::react::Tag tag,
|
|
19
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
20
|
+
return winrt::make<WindowsModalHostComponentView>(compContext, tag, reactContext);
|
|
21
|
+
}
|
|
22
|
+
WindowsModalHostComponentView::WindowsModalHostComponentView(
|
|
23
|
+
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
24
|
+
facebook::react::Tag tag,
|
|
25
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
26
|
+
: Super(compContext, tag, reactContext, CompositionComponentViewFeatures::Default) {
|
|
27
|
+
m_props = std::make_shared<facebook::react::ModalHostViewProps const>();
|
|
28
|
+
m_visual = compContext.CreateSpriteVisual();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
void WindowsModalHostComponentView::mountChildComponentView(
|
|
32
|
+
winrt::Microsoft::ReactNative::implementation::ComponentView &childComponentView,
|
|
33
|
+
uint32_t index) noexcept {
|
|
34
|
+
// assert(false);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
void WindowsModalHostComponentView::unmountChildComponentView(
|
|
38
|
+
winrt::Microsoft::ReactNative::implementation::ComponentView &childComponentView,
|
|
39
|
+
uint32_t index) noexcept {
|
|
40
|
+
// assert(false);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void WindowsModalHostComponentView::handleCommand(std::string const &commandName, folly::dynamic const &arg) noexcept {
|
|
44
|
+
Super::handleCommand(commandName, arg);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void WindowsModalHostComponentView::updateProps(
|
|
48
|
+
facebook::react::Props::Shared const &props,
|
|
49
|
+
facebook::react::Props::Shared const &oldProps) noexcept {
|
|
50
|
+
m_props = std::static_pointer_cast<facebook::react::ModalHostViewProps const>(props);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void WindowsModalHostComponentView::updateLayoutMetrics(
|
|
54
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
55
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
56
|
+
if ((layoutMetrics.displayType != m_layoutMetrics.displayType)) {
|
|
57
|
+
OuterVisual().IsVisible(layoutMetrics.displayType != facebook::react::DisplayType::None);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// TODO: RedBox placeholder for Modal (taken from unimplementedNativeViewComponent)
|
|
61
|
+
if (m_layoutMetrics.frame.size != layoutMetrics.frame.size ||
|
|
62
|
+
m_layoutMetrics.pointScaleFactor != layoutMetrics.pointScaleFactor) {
|
|
63
|
+
// Always make visual a min size, so that even if its laid out at zero size, its clear an unimplemented view was
|
|
64
|
+
// rendered
|
|
65
|
+
float width = std::max(m_layoutMetrics.frame.size.width, 200.0f);
|
|
66
|
+
float height = std::max(m_layoutMetrics.frame.size.width, 50.0f);
|
|
67
|
+
|
|
68
|
+
winrt::Windows::Foundation::Size surfaceSize = {
|
|
69
|
+
width * m_layoutMetrics.pointScaleFactor, height * m_layoutMetrics.pointScaleFactor};
|
|
70
|
+
auto drawingSurface = m_compContext.CreateDrawingSurfaceBrush(
|
|
71
|
+
surfaceSize,
|
|
72
|
+
winrt::Windows::Graphics::DirectX::DirectXPixelFormat::B8G8R8A8UIntNormalized,
|
|
73
|
+
winrt::Windows::Graphics::DirectX::DirectXAlphaMode::Premultiplied);
|
|
74
|
+
|
|
75
|
+
drawingSurface.HorizontalAlignmentRatio(0.f);
|
|
76
|
+
drawingSurface.VerticalAlignmentRatio(0.f);
|
|
77
|
+
drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::CompositionStretch::None);
|
|
78
|
+
m_visual.Brush(drawingSurface);
|
|
79
|
+
m_visual.Size(surfaceSize);
|
|
80
|
+
m_visual.Offset({
|
|
81
|
+
layoutMetrics.frame.origin.x * layoutMetrics.pointScaleFactor,
|
|
82
|
+
layoutMetrics.frame.origin.y * layoutMetrics.pointScaleFactor,
|
|
83
|
+
0.0f,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
POINT offset;
|
|
87
|
+
{
|
|
88
|
+
::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(drawingSurface, &offset);
|
|
89
|
+
if (auto d2dDeviceContext = autoDraw.GetRenderTarget()) {
|
|
90
|
+
d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Red, 0.3f));
|
|
91
|
+
assert(d2dDeviceContext->GetUnitMode() == D2D1_UNIT_MODE_DIPS);
|
|
92
|
+
const auto dpi = m_layoutMetrics.pointScaleFactor * 96.0f;
|
|
93
|
+
float oldDpiX, oldDpiY;
|
|
94
|
+
d2dDeviceContext->GetDpi(&oldDpiX, &oldDpiY);
|
|
95
|
+
d2dDeviceContext->SetDpi(dpi, dpi);
|
|
96
|
+
|
|
97
|
+
float offsetX = static_cast<float>(offset.x / m_layoutMetrics.pointScaleFactor);
|
|
98
|
+
float offsetY = static_cast<float>(offset.y / m_layoutMetrics.pointScaleFactor);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
Super::updateLayoutMetrics(layoutMetrics, oldLayoutMetrics);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
void WindowsModalHostComponentView::updateState(
|
|
107
|
+
facebook::react::State::Shared const &state,
|
|
108
|
+
facebook::react::State::Shared const &oldState) noexcept {}
|
|
109
|
+
|
|
110
|
+
void WindowsModalHostComponentView::prepareForRecycle() noexcept {}
|
|
111
|
+
|
|
112
|
+
facebook::react::SharedViewProps WindowsModalHostComponentView::viewProps() noexcept {
|
|
113
|
+
return m_props;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
winrt::Microsoft::ReactNative::Composition::IVisual WindowsModalHostComponentView::Visual() const noexcept {
|
|
117
|
+
return m_visual;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
facebook::react::Tag WindowsModalHostComponentView::hitTest(
|
|
121
|
+
facebook::react::Point pt,
|
|
122
|
+
facebook::react::Point &localPt,
|
|
123
|
+
bool ignorePointerEvents) const noexcept {
|
|
124
|
+
facebook::react::Point ptLocal{pt.x - m_layoutMetrics.frame.origin.x, pt.y - m_layoutMetrics.frame.origin.y};
|
|
125
|
+
|
|
126
|
+
if ((ignorePointerEvents || m_props->pointerEvents == facebook::react::PointerEventsMode::Auto ||
|
|
127
|
+
m_props->pointerEvents == facebook::react::PointerEventsMode::BoxOnly) &&
|
|
128
|
+
ptLocal.x >= 0 && ptLocal.x <= m_layoutMetrics.frame.size.width && ptLocal.y >= 0 &&
|
|
129
|
+
ptLocal.y <= m_layoutMetrics.frame.size.height) {
|
|
130
|
+
localPt = ptLocal;
|
|
131
|
+
return Tag();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return -1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
bool WindowsModalHostComponentView::focusable() const noexcept {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
std::string WindowsModalHostComponentView::DefaultControlType() const noexcept {
|
|
142
|
+
return "modal";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <Fabric/ComponentView.h>
|
|
8
|
+
#include <Microsoft.ReactNative.Cxx/ReactContext.h>
|
|
9
|
+
|
|
10
|
+
#include "Composition.WindowsModalHostComponentView.g.h"
|
|
11
|
+
#include "../CompositionViewComponentView.h"
|
|
12
|
+
|
|
13
|
+
#include <react/components/rnwcore/ShadowNodes.h>
|
|
14
|
+
|
|
15
|
+
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
16
|
+
|
|
17
|
+
struct WindowsModalHostComponentView
|
|
18
|
+
: WindowsModalHostComponentViewT<WindowsModalHostComponentView, CompositionBaseComponentView> {
|
|
19
|
+
using Super = WindowsModalHostComponentViewT<WindowsModalHostComponentView, CompositionBaseComponentView>;
|
|
20
|
+
|
|
21
|
+
[[nodiscard]] static winrt::Microsoft::ReactNative::ComponentView Create(
|
|
22
|
+
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
23
|
+
facebook::react::Tag tag,
|
|
24
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
25
|
+
|
|
26
|
+
void mountChildComponentView(
|
|
27
|
+
winrt::Microsoft::ReactNative::implementation::ComponentView &childComponentView,
|
|
28
|
+
uint32_t index) noexcept override;
|
|
29
|
+
void unmountChildComponentView(
|
|
30
|
+
winrt::Microsoft::ReactNative::implementation::ComponentView &childComponentView,
|
|
31
|
+
uint32_t index) noexcept override;
|
|
32
|
+
void handleCommand(std::string const &commandName, folly::dynamic const &arg) noexcept override;
|
|
33
|
+
void updateProps(facebook::react::Props::Shared const &props, facebook::react::Props::Shared const &oldProps) noexcept
|
|
34
|
+
override;
|
|
35
|
+
void updateState(facebook::react::State::Shared const &state, facebook::react::State::Shared const &oldState) noexcept
|
|
36
|
+
override;
|
|
37
|
+
void updateLayoutMetrics(
|
|
38
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
39
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
40
|
+
void prepareForRecycle() noexcept override;
|
|
41
|
+
facebook::react::SharedViewProps viewProps() noexcept override;
|
|
42
|
+
bool focusable() const noexcept override;
|
|
43
|
+
|
|
44
|
+
facebook::react::Tag hitTest(facebook::react::Point pt, facebook::react::Point &localPt, bool ignorePointerEvents)
|
|
45
|
+
const noexcept override;
|
|
46
|
+
winrt::Microsoft::ReactNative::Composition::IVisual Visual() const noexcept override;
|
|
47
|
+
virtual std::string DefaultControlType() const noexcept;
|
|
48
|
+
|
|
49
|
+
WindowsModalHostComponentView(
|
|
50
|
+
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
51
|
+
facebook::react::Tag tag,
|
|
52
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext);
|
|
53
|
+
|
|
54
|
+
private:
|
|
55
|
+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual m_visual{nullptr};
|
|
56
|
+
facebook::react::SharedViewProps m_props;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// [Windows
|
|
9
|
+
#include "WindowsModalHostViewShadowNode.h"
|
|
10
|
+
// ]
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/core/LayoutContext.h>
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
extern const char WindowsModalHostViewComponentName[] = "ModalHostView";
|
|
17
|
+
|
|
18
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <react/renderer/components/modal/ModalHostViewState.h>
|
|
11
|
+
// [Windows
|
|
12
|
+
#include <react/renderer/components/rnwcore/EventEmitters.h>
|
|
13
|
+
#include <react/renderer/components/rnwcore/Props.h>
|
|
14
|
+
// ]
|
|
15
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
extern const char WindowsModalHostViewComponentName[];
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* `ShadowNode` for <WindowsModalHostView> component.
|
|
23
|
+
*/
|
|
24
|
+
class WindowsModalHostViewShadowNode final : public ConcreteViewShadowNode<
|
|
25
|
+
WindowsModalHostViewComponentName,
|
|
26
|
+
ModalHostViewProps,
|
|
27
|
+
ModalHostViewEventEmitter,
|
|
28
|
+
ModalHostViewState> {
|
|
29
|
+
public:
|
|
30
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
31
|
+
|
|
32
|
+
static ShadowNodeTraits BaseTraits() {
|
|
33
|
+
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
34
|
+
traits.set(ShadowNodeTraits::Trait::RootNodeKind);
|
|
35
|
+
return traits;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
} // namespace facebook::react
|
|
@@ -181,12 +181,24 @@ void ScrollViewComponentView::updateProps(
|
|
|
181
181
|
void ScrollViewComponentView::updateState(
|
|
182
182
|
facebook::react::State::Shared const &state,
|
|
183
183
|
facebook::react::State::Shared const &oldState) noexcept {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
m_contentSize = newState.getData().getContentSize();
|
|
184
|
+
m_state = std::static_pointer_cast<facebook::react::ScrollViewShadowNode::ConcreteState const>(state);
|
|
185
|
+
m_contentSize = m_state->getData().getContentSize();
|
|
187
186
|
updateContentVisualSize();
|
|
188
187
|
}
|
|
189
188
|
|
|
189
|
+
void ScrollViewComponentView::updateStateWithContentOffset() noexcept {
|
|
190
|
+
if (!m_state) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
m_state->updateState([contentOffset = m_scrollVisual.ScrollPosition()](
|
|
195
|
+
const facebook::react::ScrollViewShadowNode::ConcreteState::Data &data) {
|
|
196
|
+
auto newData = data;
|
|
197
|
+
newData.contentOffset = {contentOffset.x, contentOffset.y};
|
|
198
|
+
return std::make_shared<facebook::react::ScrollViewShadowNode::ConcreteState::Data const>(newData);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
190
202
|
void ScrollViewComponentView::updateLayoutMetrics(
|
|
191
203
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
192
204
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
@@ -529,6 +541,7 @@ void ScrollViewComponentView::ensureVisual() noexcept {
|
|
|
529
541
|
[this](
|
|
530
542
|
winrt::IInspectable const & /*sender*/,
|
|
531
543
|
winrt::Microsoft::ReactNative::Composition::IScrollPositionChangedArgs const &args) {
|
|
544
|
+
updateStateWithContentOffset();
|
|
532
545
|
auto eventEmitter = GetEventEmitter();
|
|
533
546
|
if (eventEmitter) {
|
|
534
547
|
facebook::react::ScrollViewMetrics scrollMetrics;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#pragma warning(push)
|
|
12
12
|
#pragma warning(disable : 4305)
|
|
13
13
|
#include <react/renderer/components/scrollview/ScrollViewProps.h>
|
|
14
|
+
#include <react/renderer/components/scrollview/ScrollViewShadowNode.h>
|
|
14
15
|
#pragma warning(pop)
|
|
15
16
|
#include "Composition.ScrollViewComponentView.g.h"
|
|
16
17
|
#include <winrt/Windows.UI.Composition.interactions.h>
|
|
@@ -108,6 +109,7 @@ struct ScrollInteractionTrackerOwner : public winrt::implements<
|
|
|
108
109
|
bool scrollLeft(float delta, bool aniamte) noexcept;
|
|
109
110
|
bool scrollRight(float delta, bool animate) noexcept;
|
|
110
111
|
void updateBackgroundColor(const facebook::react::SharedColor &color) noexcept;
|
|
112
|
+
void updateStateWithContentOffset() noexcept;
|
|
111
113
|
|
|
112
114
|
facebook::react::Size m_contentSize;
|
|
113
115
|
winrt::Microsoft::ReactNative::Composition::ISpriteVisual m_visual{nullptr};
|
|
@@ -122,6 +124,7 @@ struct ScrollInteractionTrackerOwner : public winrt::implements<
|
|
|
122
124
|
bool m_isHorizontal = false;
|
|
123
125
|
bool m_changeViewAfterLoaded = false;
|
|
124
126
|
bool m_dismissKeyboardOnDrag = false;
|
|
127
|
+
std::shared_ptr<facebook::react::ScrollViewShadowNode::ConcreteState const> m_state;
|
|
125
128
|
|
|
126
129
|
private:
|
|
127
130
|
bool shouldBeControl() const noexcept;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "WindowsComponentDescriptorRegistry.h"
|
|
6
6
|
|
|
7
7
|
#include <Fabric/AbiViewComponentDescriptor.h>
|
|
8
|
+
#include <Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h>
|
|
8
9
|
#include <Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h>
|
|
9
10
|
#include <react/components/rnwcore/ComponentDescriptors.h>
|
|
10
11
|
#include <react/renderer/components/image/ImageComponentDescriptor.h>
|
|
@@ -33,9 +34,10 @@ WindowsComponentDescriptorRegistry::WindowsComponentDescriptorRegistry()
|
|
|
33
34
|
: m_componentDescriptorRegistry(std::make_shared<facebook::react::ComponentDescriptorProviderRegistry>()) {
|
|
34
35
|
m_componentDescriptorRegistry->add(facebook::react::concreteComponentDescriptorProvider<
|
|
35
36
|
facebook::react::ActivityIndicatorViewComponentDescriptor>());
|
|
36
|
-
|
|
37
37
|
m_componentDescriptorRegistry->add(
|
|
38
38
|
facebook::react::concreteComponentDescriptorProvider<facebook::react::ImageComponentDescriptor>());
|
|
39
|
+
m_componentDescriptorRegistry->add(
|
|
40
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::WindowsModalHostViewComponentDescriptor>());
|
|
39
41
|
m_componentDescriptorRegistry->add(
|
|
40
42
|
facebook::react::concreteComponentDescriptorProvider<facebook::react::ParagraphComponentDescriptor>());
|
|
41
43
|
m_componentDescriptorRegistry->add(
|
|
@@ -346,6 +346,7 @@
|
|
|
346
346
|
<ClInclude Include="Views\Image\ReactImageBrush.h" />
|
|
347
347
|
<ClInclude Include="Views\Impl\ScrollViewUWPImplementation.h" />
|
|
348
348
|
<ClInclude Include="Views\Impl\SnapPointManagingContentControl.h" />
|
|
349
|
+
<ClInclude Include="Views\UnimplementedViewManager.h" />
|
|
349
350
|
<ClInclude Include="Views\IXamlRootView.h" />
|
|
350
351
|
<ClInclude Include="Views\KeyboardEventHandler.h" />
|
|
351
352
|
<ClInclude Include="Views\PaperShadowNode.h" />
|
|
@@ -507,6 +508,7 @@
|
|
|
507
508
|
<ClCompile Include="Views\Impl\ScrollViewUWPImplementation.cpp" />
|
|
508
509
|
<ClCompile Include="Views\Impl\SnapPointManagingContentControl.cpp" />
|
|
509
510
|
<ClCompile Include="Views\KeyboardEventHandler.cpp" />
|
|
511
|
+
<ClCompile Include="Views\UnimplementedViewManager.cpp" />
|
|
510
512
|
<ClCompile Include="Views\PaperShadowNode.cpp" />
|
|
511
513
|
<ClCompile Include="Views\PopupViewManager.cpp" />
|
|
512
514
|
<ClCompile Include="Views\RawTextViewManager.cpp" />
|
|
@@ -171,6 +171,9 @@
|
|
|
171
171
|
<ClCompile Include="Views\KeyboardEventHandler.cpp">
|
|
172
172
|
<Filter>Views</Filter>
|
|
173
173
|
</ClCompile>
|
|
174
|
+
<ClCompile Include="Views\UnimplementedViewManager.cpp">
|
|
175
|
+
<Filter>Views</Filter>
|
|
176
|
+
</ClCompile>
|
|
174
177
|
<ClCompile Include="Views\PopupViewManager.cpp">
|
|
175
178
|
<Filter>Views</Filter>
|
|
176
179
|
</ClCompile>
|
|
@@ -525,6 +528,9 @@
|
|
|
525
528
|
<ClInclude Include="Views\KeyboardEventHandler.h">
|
|
526
529
|
<Filter>Views</Filter>
|
|
527
530
|
</ClInclude>
|
|
531
|
+
<ClInclude Include="Views\UnimplementedViewManager.h">
|
|
532
|
+
<Filter>Views</Filter>
|
|
533
|
+
</ClInclude>
|
|
528
534
|
<ClInclude Include="Views\PopupViewManager.h">
|
|
529
535
|
<Filter>Views</Filter>
|
|
530
536
|
</ClInclude>
|
|
@@ -163,7 +163,7 @@ NativeUIManager::NativeUIManager(winrt::Microsoft::ReactNative::ReactContext con
|
|
|
163
163
|
// To Debug Yoga layout, uncomment the following line.
|
|
164
164
|
// YGConfigSetPrintTreeFlag(m_yogaConfig, true);
|
|
165
165
|
|
|
166
|
-
// Additional logging can be enabled editing
|
|
166
|
+
// Additional logging can be enabled editing CalculateLayout.cpp (e.g. gPrintChanges,
|
|
167
167
|
// gPrintSkips)
|
|
168
168
|
#endif
|
|
169
169
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
|
|
6
|
+
#include "UnimplementedViewManager.h"
|
|
7
|
+
|
|
8
|
+
#include <JSValueWriter.h>
|
|
9
|
+
#include <UI.Xaml.Controls.h>
|
|
10
|
+
#include <Utils/PropertyUtils.h>
|
|
11
|
+
#include <Utils/ValueUtils.h>
|
|
12
|
+
#include <ViewControl.h>
|
|
13
|
+
|
|
14
|
+
namespace Microsoft::ReactNative {
|
|
15
|
+
|
|
16
|
+
class UnimplementedShadowNode : public ShadowNodeBase {
|
|
17
|
+
using Super = ShadowNodeBase;
|
|
18
|
+
std::string m_name;
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
UnimplementedShadowNode(std::wstring name) {
|
|
22
|
+
std::string str;
|
|
23
|
+
std::transform(name.begin(), name.end(), std::back_inserter(str), [](wchar_t c) { return (char)c; });
|
|
24
|
+
m_name = str;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
void createView(const winrt::Microsoft::ReactNative::JSValueObject &) override;
|
|
28
|
+
|
|
29
|
+
void AddView(ShadowNode &child, int64_t /*index*/) override {
|
|
30
|
+
// Not implemented
|
|
31
|
+
RedBox(m_name + " is not implemented on RNW Paper");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void RemoveChildAt(int64_t /*indexToRemove*/) override {
|
|
35
|
+
// Not implemented
|
|
36
|
+
RedBox(m_name + " is not implemented on RNW Paper");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void ReplaceChild(const XamlView & /*oldChildView*/, const XamlView & /*newChildView*/) override {
|
|
40
|
+
// Not implemented
|
|
41
|
+
RedBox(m_name + " is not implemented on RNW Paper");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
void UnimplementedShadowNode::createView(const winrt::Microsoft::ReactNative::JSValueObject &props) {
|
|
46
|
+
Super::createView(props);
|
|
47
|
+
RedBox(m_name + " is not implemented on RNW Paper");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
UnimplementedViewManager::UnimplementedViewManager(const Mso::React::IReactContext &context, std::wstring name)
|
|
51
|
+
: Super(context) {
|
|
52
|
+
m_name = name;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const wchar_t *UnimplementedViewManager::GetName() const {
|
|
56
|
+
return m_name.c_str();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void UnimplementedViewManager::GetNativeProps(const winrt::Microsoft::ReactNative::IJSValueWriter &writer) const {
|
|
60
|
+
Super::GetNativeProps(writer);
|
|
61
|
+
|
|
62
|
+
winrt::Microsoft::ReactNative::WriteProperty(writer, L"animationType", L"string");
|
|
63
|
+
winrt::Microsoft::ReactNative::WriteProperty(writer, L"presentationStyle", L"string");
|
|
64
|
+
winrt::Microsoft::ReactNative::WriteProperty(writer, L"focusable", L"boolean");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ShadowNode *UnimplementedViewManager::createShadow() const {
|
|
68
|
+
return new UnimplementedShadowNode(m_name);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
XamlView UnimplementedViewManager::CreateViewCore(
|
|
72
|
+
int64_t /*tag*/,
|
|
73
|
+
const winrt::Microsoft::ReactNative::JSValueObject &) {
|
|
74
|
+
return winrt::make<winrt::Microsoft::ReactNative::implementation::ViewControl>();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
} // namespace Microsoft::ReactNative
|