react-native-windows 0.0.0-canary.587 → 0.0.0-canary.588
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/Microsoft.ReactNative/CompositionHwndHost.idl +5 -10
- package/Microsoft.ReactNative/CompositionRootView.idl +5 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +18 -18
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +7 -31
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.h +3 -15
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +89 -140
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +9 -27
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +4 -2
- package/Microsoft.ReactNative/ReactCoreInjection.cpp +7 -2
- package/Microsoft.ReactNative/ReactCoreInjection.h +4 -1
- package/Microsoft.ReactNative/ReactCoreInjection.idl +4 -1
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import "IJSValueWriter.idl";
|
|
5
|
+
import "ReactCoreInjection.idl";
|
|
5
6
|
import "ReactNativeHost.idl";
|
|
6
7
|
#include "NamespaceRedirect.h"
|
|
7
8
|
#include "DocString.h"
|
|
@@ -21,18 +22,12 @@ namespace Microsoft.ReactNative
|
|
|
21
22
|
|
|
22
23
|
void Initialize(UInt64 hwnd);
|
|
23
24
|
|
|
24
|
-
DOC_STRING("The @ReactNativeHost associated with the @CompositionRootView. It must be set to show any React UI elements.")
|
|
25
|
-
ReactNativeHost ReactNativeHost { get; set; };
|
|
26
|
-
|
|
27
|
-
Int64 TranslateMessage(UInt32 msg, UInt64 wParam, Int64 lParam);
|
|
28
|
-
|
|
29
25
|
DOC_STRING(
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
26
|
+
"A ReactViewHost specifies the root UI component and initial properties to render in this RootView"
|
|
27
|
+
"It must be set to show any React UI elements.")
|
|
28
|
+
IReactViewHost ReactViewHost { get; set; };
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
JSValueArgWriter InitialProps { get; set; };
|
|
30
|
+
Int64 TranslateMessage(UInt32 msg, UInt64 wParam, Int64 lParam);
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
} // namespace Microsoft.ReactNative
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import "CompositionContext.idl";
|
|
5
5
|
import "IJSValueWriter.idl";
|
|
6
|
+
import "ReactCoreInjection.idl";
|
|
6
7
|
import "ReactNativeHost.idl";
|
|
7
8
|
#include "NamespaceRedirect.h"
|
|
8
9
|
#include "DocString.h"
|
|
@@ -18,8 +19,10 @@ namespace Microsoft.ReactNative
|
|
|
18
19
|
DOC_STRING("Creates a new instance of @CompositionRootView.")
|
|
19
20
|
CompositionRootView();
|
|
20
21
|
|
|
21
|
-
DOC_STRING(
|
|
22
|
-
|
|
22
|
+
DOC_STRING(
|
|
23
|
+
"A ReactViewHost specifies the root UI component and initial properties to render in this RootView"
|
|
24
|
+
"It must be set to show any React UI elements.")
|
|
25
|
+
IReactViewHost ReactViewHost { get; set; };
|
|
23
26
|
|
|
24
27
|
DOC_STRING("The RootVisual associated with the @CompositionRootView. It must be set to show any React UI elements.")
|
|
25
28
|
Microsoft.ReactNative.Composition.IVisual RootVisual { get; set; };
|
|
@@ -37,17 +40,6 @@ namespace Microsoft.ReactNative
|
|
|
37
40
|
//void OnPointerPressed(PointerPressedArgs args);
|
|
38
41
|
//void OnMouseUp(Windows.Foundation.Point point);
|
|
39
42
|
void OnScrollWheel(Windows.Foundation.Point point, Int32 delta);
|
|
40
|
-
|
|
41
|
-
DOC_STRING(
|
|
42
|
-
"The name of the root UI component registered in JavaScript with help of the "
|
|
43
|
-
"[`AppRegistry.registerComponent`](https://reactnative.dev/docs/appregistry#registercomponent) method.")
|
|
44
|
-
String ComponentName { get; set; };
|
|
45
|
-
|
|
46
|
-
DOC_STRING("The @JSValueArgWriter that is used to serialize the main component initial properties.")
|
|
47
|
-
JSValueArgWriter InitialProps { get; set; };
|
|
48
|
-
|
|
49
|
-
DOC_STRING("Reloads the current @ReactRootView UI components.")
|
|
50
|
-
void ReloadView();
|
|
51
43
|
}
|
|
52
44
|
|
|
53
45
|
} // namespace Microsoft.ReactNative
|
|
@@ -66,10 +66,11 @@ facebook::react::SharedEventEmitter EventEmitterForComponent(
|
|
|
66
66
|
return nullptr;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
CompositionEventHandler::CompositionEventHandler(const
|
|
69
|
+
CompositionEventHandler::CompositionEventHandler(const winrt::Microsoft::ReactNative::ReactContext &context)
|
|
70
|
+
: m_context(context) {}
|
|
70
71
|
|
|
71
72
|
CompositionEventHandler::CompositionEventHandler(
|
|
72
|
-
const
|
|
73
|
+
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
73
74
|
const winrt::Microsoft::ReactNative::CompositionRootView &CompositionRootView)
|
|
74
75
|
: CompositionEventHandler(context) {
|
|
75
76
|
m_compRootView = CompositionRootView;
|
|
@@ -108,8 +109,8 @@ void CompositionEventHandler::ScrollWheel(
|
|
|
108
109
|
facebook::react::SurfaceId surfaceId,
|
|
109
110
|
facebook::react::Point pt,
|
|
110
111
|
uint32_t delta) {
|
|
111
|
-
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
112
|
-
|
|
112
|
+
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
113
|
+
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties())) {
|
|
113
114
|
facebook::react::Point ptLocal;
|
|
114
115
|
|
|
115
116
|
auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(surfaceId);
|
|
@@ -302,8 +303,8 @@ void CompositionEventHandler::HandleIncomingPointerEvent(
|
|
|
302
303
|
}
|
|
303
304
|
|
|
304
305
|
std::vector<ReactTaggedView> hoveredViews;
|
|
305
|
-
std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
306
|
-
|
|
306
|
+
std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
307
|
+
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties());
|
|
307
308
|
auto &viewRegistry = fabricuiManager->GetViewRegistry();
|
|
308
309
|
for (auto &view : eventPathViews) {
|
|
309
310
|
auto componentViewDescriptor = viewRegistry.componentViewDescriptorWithTag(view->tag());
|
|
@@ -376,8 +377,8 @@ void CompositionEventHandler::MouseMove(
|
|
|
376
377
|
auto x = GET_X_LPARAM(lParam);
|
|
377
378
|
auto y = GET_Y_LPARAM(lParam);
|
|
378
379
|
|
|
379
|
-
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
380
|
-
|
|
380
|
+
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
381
|
+
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties())) {
|
|
381
382
|
facebook::react::Point ptLocal;
|
|
382
383
|
|
|
383
384
|
auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(surfaceId);
|
|
@@ -431,8 +432,8 @@ void CompositionEventHandler::PointerPressed(
|
|
|
431
432
|
|
|
432
433
|
const auto eventType = TouchEventType::Start;
|
|
433
434
|
|
|
434
|
-
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
435
|
-
|
|
435
|
+
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
436
|
+
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties())) {
|
|
436
437
|
facebook::react::Point ptLocal;
|
|
437
438
|
|
|
438
439
|
auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(surfaceId);
|
|
@@ -514,8 +515,8 @@ void CompositionEventHandler::ButtonDown(
|
|
|
514
515
|
auto y = GET_Y_LPARAM(lParam);
|
|
515
516
|
const auto eventType = TouchEventType::Start;
|
|
516
517
|
|
|
517
|
-
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
518
|
-
|
|
518
|
+
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
519
|
+
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties())) {
|
|
519
520
|
facebook::react::Point ptLocal;
|
|
520
521
|
|
|
521
522
|
auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(surfaceId);
|
|
@@ -583,8 +584,8 @@ void CompositionEventHandler::PointerUp(
|
|
|
583
584
|
|
|
584
585
|
const auto eventType = TouchEventType::Start;
|
|
585
586
|
|
|
586
|
-
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
587
|
-
|
|
587
|
+
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
588
|
+
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties())) {
|
|
588
589
|
facebook::react::Point ptLocal;
|
|
589
590
|
|
|
590
591
|
auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(surfaceId);
|
|
@@ -624,8 +625,8 @@ void CompositionEventHandler::ButtonUp(
|
|
|
624
625
|
auto x = GET_X_LPARAM(lParam);
|
|
625
626
|
auto y = GET_Y_LPARAM(lParam);
|
|
626
627
|
|
|
627
|
-
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
628
|
-
|
|
628
|
+
if (std::shared_ptr<FabricUIManager> fabricuiManager =
|
|
629
|
+
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties())) {
|
|
629
630
|
facebook::react::Point ptLocal;
|
|
630
631
|
|
|
631
632
|
auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(surfaceId);
|
|
@@ -726,8 +727,7 @@ void CompositionEventHandler::DispatchTouchEvent(
|
|
|
726
727
|
facebook::react::SurfaceId surfaceId,
|
|
727
728
|
TouchEventType eventType,
|
|
728
729
|
PointerId pointerId) {
|
|
729
|
-
auto fabricuiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
730
|
-
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context->Properties()));
|
|
730
|
+
auto fabricuiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties());
|
|
731
731
|
|
|
732
732
|
if (!fabricuiManager)
|
|
733
733
|
return;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include <Fabric/ReactTaggedView.h>
|
|
6
6
|
#include <IReactInstance.h>
|
|
7
7
|
#include <JSValue.h>
|
|
8
|
+
#include <ReactContext.h>
|
|
8
9
|
#include <react/renderer/components/view/PointerEvent.h>
|
|
9
10
|
#include <react/renderer/components/view/Touch.h>
|
|
10
11
|
#include <react/renderer/components/view/TouchEventEmitter.h>
|
|
@@ -26,9 +27,9 @@ typedef int PointerId;
|
|
|
26
27
|
|
|
27
28
|
class CompositionEventHandler {
|
|
28
29
|
public:
|
|
29
|
-
CompositionEventHandler(const
|
|
30
|
+
CompositionEventHandler(const winrt::Microsoft::ReactNative::ReactContext &context);
|
|
30
31
|
CompositionEventHandler(
|
|
31
|
-
const
|
|
32
|
+
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
32
33
|
const winrt::Microsoft::ReactNative::CompositionRootView &CompositionRootView);
|
|
33
34
|
virtual ~CompositionEventHandler();
|
|
34
35
|
|
|
@@ -109,7 +110,7 @@ class CompositionEventHandler {
|
|
|
109
110
|
|
|
110
111
|
std::map<PointerId, std::vector<ReactTaggedView>> m_currentlyHoveredViewsPerPointer;
|
|
111
112
|
winrt::Microsoft::ReactNative::CompositionRootView m_compRootView{nullptr};
|
|
112
|
-
|
|
113
|
+
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
113
114
|
};
|
|
114
115
|
|
|
115
116
|
} // namespace Microsoft::ReactNative
|
|
@@ -54,9 +54,7 @@ void CompositionHwndHost::Initialize(uint64_t hwnd) noexcept {
|
|
|
54
54
|
CreateDesktopWindowTarget(m_hwnd);
|
|
55
55
|
CreateCompositionRoot();
|
|
56
56
|
|
|
57
|
-
m_compRootView.
|
|
58
|
-
m_compRootView.ComponentName(std::move(m_componentName));
|
|
59
|
-
m_compRootView.ReactNativeHost(std::move(m_reactNativeHost));
|
|
57
|
+
m_compRootView.ReactViewHost(std::move(m_reactViewHost));
|
|
60
58
|
|
|
61
59
|
m_compRootView.ScaleFactor(ScaleFactor());
|
|
62
60
|
m_compRootView.RootVisual(
|
|
@@ -123,47 +121,25 @@ LRESULT CompositionHwndHost::TranslateMessage(int msg, uint64_t wParam, int64_t
|
|
|
123
121
|
return 0;
|
|
124
122
|
}
|
|
125
123
|
|
|
126
|
-
ReactNative::
|
|
127
|
-
return
|
|
124
|
+
ReactNative::IReactViewHost CompositionHwndHost::ReactViewHost() const noexcept {
|
|
125
|
+
return m_reactViewHost ? m_reactViewHost : m_compRootView.ReactViewHost();
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
void CompositionHwndHost::
|
|
128
|
+
void CompositionHwndHost::ReactViewHost(ReactNative::IReactViewHost const &value) noexcept {
|
|
131
129
|
if (m_compRootView) {
|
|
132
|
-
m_compRootView.
|
|
130
|
+
m_compRootView.ReactViewHost(value);
|
|
133
131
|
} else {
|
|
134
|
-
|
|
132
|
+
m_reactViewHost = value;
|
|
135
133
|
}
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
winrt::Windows::UI::Composition::Compositor CompositionHwndHost::Compositor() const noexcept {
|
|
139
137
|
auto compositionContext =
|
|
140
138
|
winrt::Microsoft::ReactNative::Composition::implementation::CompositionUIService::GetCompositionContext(
|
|
141
|
-
ReactNativeHost().InstanceSettings().Properties());
|
|
139
|
+
m_reactViewHost.ReactNativeHost().InstanceSettings().Properties());
|
|
142
140
|
|
|
143
141
|
return winrt::Microsoft::ReactNative::Composition::implementation::CompositionContextHelper::InnerCompositor(
|
|
144
142
|
compositionContext);
|
|
145
143
|
}
|
|
146
144
|
|
|
147
|
-
winrt::hstring CompositionHwndHost::ComponentName() noexcept {
|
|
148
|
-
return m_compRootView ? m_compRootView.ComponentName() : m_componentName;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
void CompositionHwndHost::ComponentName(winrt::hstring const &value) noexcept {
|
|
152
|
-
if (m_compRootView)
|
|
153
|
-
m_compRootView.ComponentName(value);
|
|
154
|
-
else
|
|
155
|
-
m_componentName = value;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
ReactNative::JSValueArgWriter CompositionHwndHost::InitialProps() noexcept {
|
|
159
|
-
return m_compRootView ? m_compRootView.InitialProps() : m_initialPropsWriter;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
void CompositionHwndHost::InitialProps(ReactNative::JSValueArgWriter const &value) noexcept {
|
|
163
|
-
if (m_compRootView)
|
|
164
|
-
m_compRootView.InitialProps(value);
|
|
165
|
-
else
|
|
166
|
-
m_initialPropsWriter = value;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
145
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -17,19 +17,9 @@ struct CompositionHwndHost : CompositionHwndHostT<CompositionHwndHost> {
|
|
|
17
17
|
|
|
18
18
|
void Initialize(uint64_t hwnd) noexcept;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
ReactNative::
|
|
22
|
-
void ReactNativeHost(ReactNative::ReactNativeHost const &value) noexcept;
|
|
20
|
+
winrt::Microsoft::ReactNative::IReactViewHost ReactViewHost() const noexcept;
|
|
21
|
+
void ReactViewHost(winrt::Microsoft::ReactNative::IReactViewHost const &value) noexcept;
|
|
23
22
|
|
|
24
|
-
// property ComponentName
|
|
25
|
-
hstring ComponentName() noexcept;
|
|
26
|
-
void ComponentName(hstring const &value) noexcept;
|
|
27
|
-
|
|
28
|
-
// property InitialProps
|
|
29
|
-
ReactNative::JSValueArgWriter InitialProps() noexcept;
|
|
30
|
-
void InitialProps(ReactNative::JSValueArgWriter const &value) noexcept;
|
|
31
|
-
|
|
32
|
-
void ReloadView() noexcept;
|
|
33
23
|
winrt::Windows::UI::Composition::Visual RootVisual() const noexcept;
|
|
34
24
|
|
|
35
25
|
LRESULT TranslateMessage(int msg, uint64_t wParam, int64_t lParam) noexcept;
|
|
@@ -49,9 +39,7 @@ struct CompositionHwndHost : CompositionHwndHostT<CompositionHwndHost> {
|
|
|
49
39
|
winrt::Windows::UI::Composition::Desktop::DesktopWindowTarget m_target{nullptr};
|
|
50
40
|
|
|
51
41
|
// Store locally if set before we have a rootview
|
|
52
|
-
|
|
53
|
-
ReactNative::ReactNativeHost m_reactNativeHost{nullptr};
|
|
54
|
-
ReactNative::JSValueArgWriter m_initialPropsWriter{nullptr};
|
|
42
|
+
ReactNative::IReactViewHost m_reactViewHost{nullptr};
|
|
55
43
|
};
|
|
56
44
|
|
|
57
45
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -4,35 +4,35 @@
|
|
|
4
4
|
#include "CompositionRootView.h"
|
|
5
5
|
#include "CompositionRootView.g.cpp"
|
|
6
6
|
|
|
7
|
+
#include <DynamicWriter.h>
|
|
8
|
+
#include <Fabric/FabricUIManagerModule.h>
|
|
7
9
|
#include <IReactInstance.h>
|
|
10
|
+
#include <Modules/ReactRootViewTagGenerator.h>
|
|
8
11
|
#include <QuirkSettings.h>
|
|
9
12
|
#include <ReactHost/MsoUtils.h>
|
|
10
13
|
#include <Utils/Helpers.h>
|
|
11
14
|
#include <dispatchQueue/dispatchQueue.h>
|
|
15
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
16
|
+
#include <react/renderer/core/LayoutContext.h>
|
|
12
17
|
#include <winrt/Windows.UI.Core.h>
|
|
13
18
|
#include "CompositionContextHelper.h"
|
|
14
19
|
#include "CompositionHelpers.h"
|
|
15
20
|
#include "ReactNativeHost.h"
|
|
16
21
|
|
|
17
|
-
#ifdef USE_FABRIC
|
|
18
|
-
#include <Fabric/FabricUIManagerModule.h>
|
|
19
|
-
#include <react/renderer/core/LayoutConstraints.h>
|
|
20
|
-
#include <react/renderer/core/LayoutContext.h>
|
|
21
|
-
#endif
|
|
22
|
-
|
|
23
22
|
namespace winrt::Microsoft::ReactNative::implementation {
|
|
24
23
|
|
|
25
24
|
//! This class ensures that we access ReactRootView from UI thread.
|
|
26
25
|
struct CompositionReactViewInstance
|
|
27
|
-
: public
|
|
26
|
+
: public winrt::implements<CompositionReactViewInstance, winrt::Microsoft::ReactNative::IReactViewInstance> {
|
|
28
27
|
CompositionReactViewInstance(
|
|
29
28
|
winrt::weak_ref<winrt::Microsoft::ReactNative::implementation::CompositionRootView> &&weakRootControl) noexcept;
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
void InitRootView(
|
|
31
|
+
winrt::Microsoft::ReactNative::IReactContext context,
|
|
32
|
+
winrt::Microsoft::ReactNative::ReactViewOptions viewOptions) noexcept;
|
|
33
|
+
|
|
34
|
+
void UpdateRootView() noexcept;
|
|
35
|
+
void UninitRootView() noexcept;
|
|
36
36
|
|
|
37
37
|
private:
|
|
38
38
|
template <class TAction>
|
|
@@ -47,29 +47,28 @@ CompositionReactViewInstance::CompositionReactViewInstance(
|
|
|
47
47
|
winrt::weak_ref<winrt::Microsoft::ReactNative::implementation::CompositionRootView> &&weakRootControl) noexcept
|
|
48
48
|
: m_weakRootControl{std::move(weakRootControl)} {}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
m_uiDispatcher =
|
|
54
|
-
.Properties()
|
|
50
|
+
void CompositionReactViewInstance::InitRootView(
|
|
51
|
+
winrt::Microsoft::ReactNative::IReactContext context,
|
|
52
|
+
winrt::Microsoft::ReactNative::ReactViewOptions viewOptions) noexcept {
|
|
53
|
+
m_uiDispatcher = context.Properties()
|
|
55
54
|
.Get(winrt::Microsoft::ReactNative::ReactDispatcherHelper::UIDispatcherProperty())
|
|
56
55
|
.try_as<IReactDispatcher>();
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
rootControl->InitRootView(std::move(
|
|
57
|
+
PostInUIQueue([context{std::move(context)}, viewOptions{std::move(viewOptions)}](
|
|
58
|
+
winrt::com_ptr<winrt::Microsoft::ReactNative::implementation::CompositionRootView>
|
|
59
|
+
&rootControl) mutable noexcept {
|
|
60
|
+
rootControl->InitRootView(std::move(context), std::move(viewOptions));
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
void CompositionReactViewInstance::UpdateRootView() noexcept {
|
|
65
|
+
PostInUIQueue([](winrt::com_ptr<winrt::Microsoft::ReactNative::implementation::CompositionRootView>
|
|
66
|
+
&rootControl) mutable noexcept { rootControl->UpdateRootView(); });
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
void CompositionReactViewInstance::UninitRootView() noexcept {
|
|
70
|
+
PostInUIQueue([](winrt::com_ptr<winrt::Microsoft::ReactNative::implementation::CompositionRootView>
|
|
71
|
+
&rootControl) mutable noexcept { rootControl->UninitRootView(); });
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
//===========================================================================
|
|
@@ -81,8 +80,8 @@ inline Mso::Future<void> CompositionReactViewInstance::PostInUIQueue(TAction &&a
|
|
|
81
80
|
// ReactViewInstance has shorter lifetime than ReactRootControl. Thus, we capture this WeakPtr.
|
|
82
81
|
auto promise = Mso::Promise<void>();
|
|
83
82
|
|
|
84
|
-
m_uiDispatcher.Post([promise, weakThis
|
|
85
|
-
if (auto strongThis = weakThis.
|
|
83
|
+
m_uiDispatcher.Post([promise, weakThis{get_weak()}, action{std::forward<TAction>(action)}]() mutable {
|
|
84
|
+
if (auto strongThis = weakThis.get()) {
|
|
86
85
|
if (auto rootControl = strongThis->m_weakRootControl.get()) {
|
|
87
86
|
action(rootControl);
|
|
88
87
|
promise.SetValue();
|
|
@@ -97,15 +96,24 @@ inline Mso::Future<void> CompositionReactViewInstance::PostInUIQueue(TAction &&a
|
|
|
97
96
|
|
|
98
97
|
CompositionRootView::CompositionRootView() noexcept {}
|
|
99
98
|
|
|
100
|
-
ReactNative::
|
|
101
|
-
return
|
|
99
|
+
ReactNative::IReactViewHost CompositionRootView::ReactViewHost() noexcept {
|
|
100
|
+
return m_reactViewHost;
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
void CompositionRootView::
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
void CompositionRootView::ReactViewHost(winrt::Microsoft::ReactNative::IReactViewHost const &value) noexcept {
|
|
104
|
+
if (m_reactViewHost == value) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (m_reactViewHost) {
|
|
109
|
+
m_reactViewHost.DetachViewInstance();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
m_reactViewHost = value;
|
|
113
|
+
|
|
114
|
+
if (m_reactViewHost) {
|
|
115
|
+
auto viewInstance = winrt::make<CompositionReactViewInstance>(this->get_weak());
|
|
116
|
+
m_reactViewHost.AttachViewInstance(viewInstance);
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
119
|
|
|
@@ -136,51 +144,12 @@ void CompositionRootView::ScaleFactor(double value) noexcept {
|
|
|
136
144
|
m_scaleFactor = value;
|
|
137
145
|
}
|
|
138
146
|
|
|
139
|
-
winrt::hstring CompositionRootView::ComponentName() noexcept {
|
|
140
|
-
return m_componentName;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
void CompositionRootView::ComponentName(winrt::hstring const &value) noexcept {
|
|
144
|
-
if (m_componentName != value) {
|
|
145
|
-
m_componentName = value;
|
|
146
|
-
ReloadView();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
ReactNative::JSValueArgWriter CompositionRootView::InitialProps() noexcept {
|
|
151
|
-
return m_initialPropsWriter;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
void CompositionRootView::InitialProps(ReactNative::JSValueArgWriter const &value) noexcept {
|
|
155
|
-
if (m_initialPropsWriter != value) {
|
|
156
|
-
m_initialPropsWriter = value;
|
|
157
|
-
ReloadView();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
void CompositionRootView::ReloadView() noexcept {
|
|
162
|
-
if (m_reactNativeHost && !m_componentName.empty()) {
|
|
163
|
-
Mso::React::ReactViewOptions viewOptions{};
|
|
164
|
-
viewOptions.ComponentName = to_string(m_componentName);
|
|
165
|
-
viewOptions.InitialProps = m_initialPropsWriter;
|
|
166
|
-
if (auto reactViewHost = ReactViewHost()) {
|
|
167
|
-
reactViewHost->ReloadViewInstanceWithOptions(std::move(viewOptions));
|
|
168
|
-
} else {
|
|
169
|
-
auto reactNativeHost = winrt::get_self<implementation::ReactNativeHost>(m_reactNativeHost);
|
|
170
|
-
auto newReactViewHost = reactNativeHost->ReactHost()->MakeViewHost(std::move(viewOptions));
|
|
171
|
-
ReactViewHost(newReactViewHost.Get());
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
ReactViewHost(nullptr);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
147
|
winrt::Microsoft::ReactNative::Composition::IVisual CompositionRootView::GetVisual() const noexcept {
|
|
179
148
|
return m_rootVisual;
|
|
180
149
|
}
|
|
181
150
|
|
|
182
151
|
std::string CompositionRootView::JSComponentName() const noexcept {
|
|
183
|
-
return to_string(
|
|
152
|
+
return to_string(m_reactViewOptions.ComponentName());
|
|
184
153
|
}
|
|
185
154
|
|
|
186
155
|
int64_t CompositionRootView::GetActualHeight() const noexcept {
|
|
@@ -189,7 +158,6 @@ int64_t CompositionRootView::GetActualHeight() const noexcept {
|
|
|
189
158
|
|
|
190
159
|
int64_t CompositionRootView::GetActualWidth() const noexcept {
|
|
191
160
|
return static_cast<int64_t>(m_size.Width);
|
|
192
|
-
// return static_cast<int64_t>(m_xamlRootView.ActualWidth());
|
|
193
161
|
}
|
|
194
162
|
|
|
195
163
|
int64_t CompositionRootView::GetTag() const noexcept {
|
|
@@ -225,10 +193,9 @@ void CompositionRootView::OnScrollWheel(Windows::Foundation::Point point, int32_
|
|
|
225
193
|
}
|
|
226
194
|
|
|
227
195
|
void CompositionRootView::InitRootView(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
m_uiDispatcher =
|
|
231
|
-
.Properties()
|
|
196
|
+
winrt::Microsoft::ReactNative::IReactContext &&context,
|
|
197
|
+
winrt::Microsoft::ReactNative::ReactViewOptions &&viewOptions) noexcept {
|
|
198
|
+
m_uiDispatcher = context.Properties()
|
|
232
199
|
.Get(winrt::Microsoft::ReactNative::ReactDispatcherHelper::UIDispatcherProperty())
|
|
233
200
|
.try_as<IReactDispatcher>();
|
|
234
201
|
VerifyElseCrash(m_uiDispatcher.HasThreadAccess());
|
|
@@ -237,16 +204,14 @@ void CompositionRootView::InitRootView(
|
|
|
237
204
|
UninitRootView();
|
|
238
205
|
}
|
|
239
206
|
|
|
240
|
-
|
|
241
|
-
m_weakReactInstance = Mso::WeakPtr{reactInstance};
|
|
242
|
-
m_context = &reactInstance->GetReactContext();
|
|
207
|
+
m_context = winrt::Microsoft::ReactNative::ReactContext(std::move(context));
|
|
243
208
|
|
|
244
|
-
winrt::Microsoft::ReactNative::CompositionRootView
|
|
245
|
-
get_strong().as(
|
|
209
|
+
winrt::Microsoft::ReactNative::CompositionRootView compositionRootView;
|
|
210
|
+
get_strong().as(compositionRootView);
|
|
246
211
|
|
|
247
|
-
m_reactViewOptions = std::
|
|
212
|
+
m_reactViewOptions = std::move(viewOptions);
|
|
248
213
|
m_CompositionEventHandler =
|
|
249
|
-
std::make_shared<::Microsoft::ReactNative::CompositionEventHandler>(
|
|
214
|
+
std::make_shared<::Microsoft::ReactNative::CompositionEventHandler>(m_context, compositionRootView);
|
|
250
215
|
|
|
251
216
|
UpdateRootViewInternal();
|
|
252
217
|
|
|
@@ -260,23 +225,18 @@ void CompositionRootView::UpdateRootView() noexcept {
|
|
|
260
225
|
}
|
|
261
226
|
|
|
262
227
|
void CompositionRootView::UpdateRootViewInternal() noexcept {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
ShowInstanceError();
|
|
276
|
-
break;
|
|
277
|
-
default:
|
|
278
|
-
VerifyElseCrashSz(false, "Unexpected value");
|
|
279
|
-
}
|
|
228
|
+
switch (m_context.Handle().LoadingState()) {
|
|
229
|
+
case winrt::Microsoft::ReactNative::LoadingState::Loading:
|
|
230
|
+
ShowInstanceLoading();
|
|
231
|
+
break;
|
|
232
|
+
case winrt::Microsoft::ReactNative::LoadingState::Loaded:
|
|
233
|
+
ShowInstanceLoaded();
|
|
234
|
+
break;
|
|
235
|
+
case winrt::Microsoft::ReactNative::LoadingState::HasError:
|
|
236
|
+
ShowInstanceError();
|
|
237
|
+
break;
|
|
238
|
+
default:
|
|
239
|
+
VerifyElseCrashSz(false, "Unexpected value");
|
|
280
240
|
}
|
|
281
241
|
}
|
|
282
242
|
|
|
@@ -286,16 +246,22 @@ void CompositionRootView::UninitRootView() noexcept {
|
|
|
286
246
|
}
|
|
287
247
|
|
|
288
248
|
if (m_isJSViewAttached) {
|
|
289
|
-
if (
|
|
290
|
-
|
|
291
|
-
|
|
249
|
+
if (m_context.Handle().LoadingState() == winrt::Microsoft::ReactNative::LoadingState::HasError)
|
|
250
|
+
return;
|
|
251
|
+
|
|
252
|
+
auto uiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
253
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()));
|
|
254
|
+
uiManager->stopSurface(static_cast<facebook::react::SurfaceId>(GetTag()));
|
|
255
|
+
|
|
256
|
+
m_context.CallJSFunction(L"ReactFabric", L"unmountComponentAtNode", GetTag());
|
|
257
|
+
|
|
258
|
+
// Paper version gives the JS thread time to finish executing - Is this needed?
|
|
259
|
+
// m_jsMessageThread.Load()->runOnQueueSync([]() {});
|
|
292
260
|
}
|
|
293
261
|
|
|
294
262
|
m_rootTag = -1;
|
|
295
|
-
|
|
296
|
-
m_context.Clear();
|
|
263
|
+
m_context = nullptr;
|
|
297
264
|
m_reactViewOptions = nullptr;
|
|
298
|
-
m_weakReactInstance = nullptr;
|
|
299
265
|
|
|
300
266
|
m_isInitialized = false;
|
|
301
267
|
}
|
|
@@ -308,42 +274,25 @@ void CompositionRootView::ShowInstanceLoaded() noexcept {
|
|
|
308
274
|
if (m_rootVisual) {
|
|
309
275
|
ClearLoadingUI();
|
|
310
276
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
277
|
+
auto uiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
278
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()));
|
|
279
|
+
|
|
280
|
+
auto rootTag = ::Microsoft::ReactNative::getNextRootViewTag();
|
|
281
|
+
SetTag(rootTag);
|
|
282
|
+
uiManager->startSurface(
|
|
283
|
+
this, rootTag, JSComponentName(), DynamicWriter::ToDynamic(Mso::Copy(m_reactViewOptions.InitialProps())));
|
|
284
|
+
|
|
314
285
|
m_isJSViewAttached = true;
|
|
315
286
|
}
|
|
316
287
|
}
|
|
317
288
|
|
|
318
289
|
void CompositionRootView::ShowInstanceError() noexcept {}
|
|
319
290
|
|
|
320
|
-
void CompositionRootView::ShowInstanceWaiting() noexcept {}
|
|
321
|
-
|
|
322
291
|
void CompositionRootView::ShowInstanceLoading() noexcept {
|
|
323
|
-
if (!m_context
|
|
292
|
+
if (!Mso::React::ReactOptions::UseDeveloperSupport(m_context.Properties().Handle()))
|
|
324
293
|
return;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
Mso::React::IReactViewHost *CompositionRootView::ReactViewHost() noexcept {
|
|
328
|
-
return m_reactViewHost.Get();
|
|
329
|
-
}
|
|
330
294
|
|
|
331
|
-
|
|
332
|
-
if (m_reactViewHost.Get() == viewHost) {
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
if (m_reactViewHost) {
|
|
337
|
-
UninitRootView();
|
|
338
|
-
m_reactViewHost->DetachViewInstance();
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
m_reactViewHost = viewHost;
|
|
342
|
-
|
|
343
|
-
if (m_reactViewHost) {
|
|
344
|
-
auto viewInstance = Mso::Make<CompositionReactViewInstance>(this->get_weak());
|
|
345
|
-
m_reactViewHost->AttachViewInstance(*viewInstance);
|
|
346
|
-
}
|
|
295
|
+
// TODO: Show loading UI here
|
|
347
296
|
}
|
|
348
297
|
|
|
349
298
|
Windows::Foundation::Size CompositionRootView::Measure(Windows::Foundation::Size const &availableSize) const {
|
|
@@ -351,7 +300,7 @@ Windows::Foundation::Size CompositionRootView::Measure(Windows::Foundation::Size
|
|
|
351
300
|
|
|
352
301
|
if (m_isInitialized && m_rootTag != -1) {
|
|
353
302
|
if (auto fabricuiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
354
|
-
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context
|
|
303
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()))) {
|
|
355
304
|
facebook::react::LayoutContext context;
|
|
356
305
|
// TODO scaling factor
|
|
357
306
|
context.pointScaleFactor = static_cast<facebook::react::Float>(m_scaleFactor);
|
|
@@ -382,7 +331,7 @@ Windows::Foundation::Size CompositionRootView::Measure(Windows::Foundation::Size
|
|
|
382
331
|
Windows::Foundation::Size CompositionRootView::Arrange(Windows::Foundation::Size finalSize) const {
|
|
383
332
|
if (m_isInitialized && m_rootTag != -1) {
|
|
384
333
|
if (auto fabricuiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
385
|
-
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context
|
|
334
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()))) {
|
|
386
335
|
facebook::react::LayoutContext context;
|
|
387
336
|
context.pointScaleFactor = static_cast<facebook::react::Float>(m_scaleFactor);
|
|
388
337
|
context.fontSizeMultiplier = static_cast<facebook::react::Float>(m_scaleFactor);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
#include "CompositionRootView.g.h"
|
|
6
6
|
|
|
7
|
+
#include <ReactContext.h>
|
|
7
8
|
#include <winrt/Microsoft.ReactNative.h>
|
|
8
9
|
#include "CompositionEventHandler.h"
|
|
9
10
|
#include "ReactHost/React.h"
|
|
@@ -14,22 +15,14 @@ namespace winrt::Microsoft::ReactNative::implementation {
|
|
|
14
15
|
struct CompositionRootView : CompositionRootViewT<CompositionRootView>, ::Microsoft::ReactNative::ICompositionRootView {
|
|
15
16
|
CompositionRootView() noexcept;
|
|
16
17
|
|
|
17
|
-
// property
|
|
18
|
-
ReactNative::
|
|
19
|
-
void
|
|
20
|
-
|
|
21
|
-
// property ComponentName
|
|
22
|
-
hstring ComponentName() noexcept;
|
|
23
|
-
void ComponentName(hstring const &value) noexcept;
|
|
18
|
+
// property ReactViewHost
|
|
19
|
+
ReactNative::IReactViewHost ReactViewHost() noexcept;
|
|
20
|
+
void ReactViewHost(ReactNative::IReactViewHost const &value) noexcept;
|
|
24
21
|
|
|
25
22
|
// property RootVisual
|
|
26
23
|
winrt::Microsoft::ReactNative::Composition::IVisual RootVisual() noexcept;
|
|
27
24
|
void RootVisual(winrt::Microsoft::ReactNative::Composition::IVisual const &value) noexcept;
|
|
28
25
|
|
|
29
|
-
// property InitialProps
|
|
30
|
-
ReactNative::JSValueArgWriter InitialProps() noexcept;
|
|
31
|
-
void InitialProps(ReactNative::JSValueArgWriter const &value) noexcept;
|
|
32
|
-
|
|
33
26
|
// property Size
|
|
34
27
|
winrt::Windows::Foundation::Size Size() noexcept;
|
|
35
28
|
void Size(winrt::Windows::Foundation::Size value) noexcept;
|
|
@@ -38,8 +31,6 @@ struct CompositionRootView : CompositionRootViewT<CompositionRootView>, ::Micros
|
|
|
38
31
|
double ScaleFactor() noexcept;
|
|
39
32
|
void ScaleFactor(double value) noexcept;
|
|
40
33
|
|
|
41
|
-
void ReloadView() noexcept;
|
|
42
|
-
|
|
43
34
|
Windows::Foundation::Size Measure(Windows::Foundation::Size const &availableSize) const;
|
|
44
35
|
Windows::Foundation::Size Arrange(Windows::Foundation::Size finalSize) const;
|
|
45
36
|
|
|
@@ -58,27 +49,21 @@ struct CompositionRootView : CompositionRootViewT<CompositionRootView>, ::Micros
|
|
|
58
49
|
|
|
59
50
|
public: // IReactViewInstance UI-thread implementation
|
|
60
51
|
void InitRootView(
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
winrt::Microsoft::ReactNative::IReactContext &&context,
|
|
53
|
+
winrt::Microsoft::ReactNative::ReactViewOptions &&viewOptions) noexcept;
|
|
63
54
|
void UpdateRootView() noexcept;
|
|
64
55
|
void UninitRootView() noexcept;
|
|
65
56
|
|
|
66
57
|
private:
|
|
67
|
-
ReactNative::ReactNativeHost m_reactNativeHost{nullptr};
|
|
68
|
-
hstring m_componentName;
|
|
69
|
-
ReactNative::JSValueArgWriter m_initialPropsWriter;
|
|
70
|
-
bool m_isPerspectiveEnabled{true};
|
|
71
58
|
bool m_isInitialized{false};
|
|
72
59
|
bool m_isJSViewAttached{false};
|
|
73
60
|
IReactDispatcher m_uiDispatcher{nullptr};
|
|
74
61
|
int64_t m_rootTag{-1};
|
|
75
62
|
double m_scaleFactor{1.0};
|
|
76
63
|
winrt::Windows::Foundation::Size m_size;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Mso::CntPtr<Mso::React::IReactViewHost> m_reactViewHost;
|
|
81
|
-
std::unique_ptr<Mso::React::ReactViewOptions> m_reactViewOptions;
|
|
64
|
+
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
65
|
+
winrt::Microsoft::ReactNative::IReactViewHost m_reactViewHost;
|
|
66
|
+
winrt::Microsoft::ReactNative::ReactViewOptions m_reactViewOptions;
|
|
82
67
|
std::shared_ptr<::Microsoft::ReactNative::CompositionEventHandler> m_CompositionEventHandler;
|
|
83
68
|
winrt::Microsoft::ReactNative::Composition::IVisual m_rootVisual{nullptr};
|
|
84
69
|
void UpdateRootViewInternal() noexcept;
|
|
@@ -86,10 +71,7 @@ struct CompositionRootView : CompositionRootViewT<CompositionRootView>, ::Micros
|
|
|
86
71
|
void EnsureLoadingUI() noexcept;
|
|
87
72
|
void ShowInstanceLoaded() noexcept;
|
|
88
73
|
void ShowInstanceError() noexcept;
|
|
89
|
-
void ShowInstanceWaiting() noexcept;
|
|
90
74
|
void ShowInstanceLoading() noexcept;
|
|
91
|
-
Mso::React::IReactViewHost *ReactViewHost() noexcept;
|
|
92
|
-
void ReactViewHost(Mso::React::IReactViewHost *viewHost) noexcept;
|
|
93
75
|
};
|
|
94
76
|
|
|
95
77
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -167,8 +167,10 @@ void LogBox::ShowOnUIThread() noexcept {
|
|
|
167
167
|
|
|
168
168
|
if (!m_hwnd) {
|
|
169
169
|
auto CompositionHwndHost = React::CompositionHwndHost();
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
winrt::Microsoft::ReactNative::ReactViewOptions viewOptions;
|
|
171
|
+
viewOptions.ComponentName(L"LogBox");
|
|
172
|
+
CompositionHwndHost.ReactViewHost(
|
|
173
|
+
winrt::Microsoft::ReactNative::ReactCoreInjection::MakeViewHost(host, viewOptions));
|
|
172
174
|
HINSTANCE hInstance = GetModuleHandle(NULL);
|
|
173
175
|
winrt::impl::abi<winrt::Microsoft::ReactNative::ICompositionHwndHost>::type *pHost{nullptr};
|
|
174
176
|
winrt::com_ptr<::IUnknown> spunk;
|
|
@@ -70,7 +70,7 @@ ReactCoreInjection::PostToUIBatchingQueueProperty() noexcept {
|
|
|
70
70
|
.Get(winrt::Microsoft::ReactNative::ReactDispatcherHelper::UIDispatcherProperty())
|
|
71
71
|
.as<winrt::Microsoft::ReactNative::IReactDispatcher>();
|
|
72
72
|
auto viewHost = rnhost->MakeViewHost(viewOptions.as<ReactViewOptions>()->CreateViewOptions());
|
|
73
|
-
return winrt::make<ReactViewHost>(*viewHost, uiDispatcher);
|
|
73
|
+
return winrt::make<ReactViewHost>(host, *viewHost, uiDispatcher);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/*static*/ void ReactCoreInjection::PostToUIBatchingQueue(
|
|
@@ -81,9 +81,10 @@ ReactCoreInjection::PostToUIBatchingQueueProperty() noexcept {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
ReactViewHost::ReactViewHost(
|
|
84
|
+
const ReactNative::ReactNativeHost &host,
|
|
84
85
|
Mso::React::IReactViewHost &viewHost,
|
|
85
86
|
const winrt::Microsoft::ReactNative::IReactDispatcher &uiDispatcher)
|
|
86
|
-
: m_viewHost(&viewHost), m_uiDispatcher(uiDispatcher) {}
|
|
87
|
+
: m_host(host), m_viewHost(&viewHost), m_uiDispatcher(uiDispatcher) {}
|
|
87
88
|
|
|
88
89
|
// ReactViewOptions ReactViewHost::Options() noexcept;
|
|
89
90
|
// ReactNative::ReactNativeHost ReactViewHost::ReactHost() noexcept {}
|
|
@@ -157,4 +158,8 @@ winrt::Windows::Foundation::IAsyncAction ReactViewHost::DetachViewInstance() noe
|
|
|
157
158
|
return make<Mso::AsyncActionFutureAdapter>(m_viewHost->DetachViewInstance());
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
winrt::Microsoft::ReactNative::ReactNativeHost ReactViewHost::ReactNativeHost() noexcept {
|
|
162
|
+
return m_host;
|
|
163
|
+
}
|
|
164
|
+
|
|
160
165
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -50,6 +50,7 @@ struct ReactCoreInjection : ReactCoreInjectionT<ReactCoreInjection> {
|
|
|
50
50
|
|
|
51
51
|
struct ReactViewHost : public winrt::implements<ReactViewHost, IReactViewHost> {
|
|
52
52
|
ReactViewHost(
|
|
53
|
+
const winrt::Microsoft::ReactNative::ReactNativeHost &host,
|
|
53
54
|
Mso::React::IReactViewHost &viewHost,
|
|
54
55
|
const winrt::Microsoft::ReactNative::IReactDispatcher &uiDispatcher);
|
|
55
56
|
|
|
@@ -58,8 +59,10 @@ struct ReactViewHost : public winrt::implements<ReactViewHost, IReactViewHost> {
|
|
|
58
59
|
Windows::Foundation::IAsyncAction UnloadViewInstance() noexcept;
|
|
59
60
|
Windows::Foundation::IAsyncAction AttachViewInstance(IReactViewInstance viewInstance) noexcept;
|
|
60
61
|
Windows::Foundation::IAsyncAction DetachViewInstance() noexcept;
|
|
62
|
+
winrt::Microsoft::ReactNative::ReactNativeHost ReactNativeHost() noexcept;
|
|
61
63
|
|
|
62
64
|
private:
|
|
65
|
+
const ReactNative::ReactNativeHost m_host;
|
|
63
66
|
Mso::CntPtr<Mso::React::IReactViewHost> m_viewHost;
|
|
64
67
|
winrt::Microsoft::ReactNative::IReactDispatcher m_uiDispatcher;
|
|
65
68
|
};
|
|
@@ -69,4 +72,4 @@ struct ReactViewHost : public winrt::implements<ReactViewHost, IReactViewHost> {
|
|
|
69
72
|
namespace winrt::Microsoft::ReactNative::factory_implementation {
|
|
70
73
|
struct ReactCoreInjection : ReactCoreInjectionT<ReactCoreInjection, implementation::ReactCoreInjection> {};
|
|
71
74
|
struct ReactViewOptions : ReactViewOptionsT<ReactViewOptions, implementation::ReactViewOptions> {};
|
|
72
|
-
} // namespace winrt::Microsoft::ReactNative::factory_implementation
|
|
75
|
+
} // namespace winrt::Microsoft::ReactNative::factory_implementation
|
|
@@ -63,6 +63,9 @@ DOC_STRING("Settings per each IReactViewHost associated with an IReactHost insta
|
|
|
63
63
|
|
|
64
64
|
DOC_STRING("Detaches IReactViewInstance from the IReactViewHost.")
|
|
65
65
|
Windows.Foundation.IAsyncAction DetachViewInstance();
|
|
66
|
+
|
|
67
|
+
DOC_STRING("The ReactNativeHost associated with this ReactViewHost.")
|
|
68
|
+
ReactNativeHost ReactNativeHost { get; };
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
[experimental]
|
|
@@ -89,4 +92,4 @@ DOC_STRING("Settings per each IReactViewHost associated with an IReactHost insta
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
|
|
92
|
-
} // namespace Microsoft.ReactNative
|
|
95
|
+
} // namespace Microsoft.ReactNative
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.0.0-canary.
|
|
13
|
+
<ReactNativeWindowsVersion>0.0.0-canary.588</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|