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
|
@@ -180,6 +180,16 @@ void UpdateUiaProperty(
|
|
|
180
180
|
spProviderSimple.get(), propId, CComVariant(oldValue.c_str()), CComVariant(newValue.c_str()));
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
void UpdateUiaProperty(
|
|
184
|
+
winrt::IInspectable provider,
|
|
185
|
+
PROPERTYID propId,
|
|
186
|
+
const std::optional<std::string> &oldValue,
|
|
187
|
+
const std::optional<std::string> &newValue) noexcept {
|
|
188
|
+
std::string oldData = oldValue.value_or("");
|
|
189
|
+
std::string newData = newValue.value_or("");
|
|
190
|
+
UpdateUiaProperty(provider, propId, oldData, newData);
|
|
191
|
+
}
|
|
192
|
+
|
|
183
193
|
long GetLiveSetting(const std::string &liveRegion) noexcept {
|
|
184
194
|
if (liveRegion == "polite") {
|
|
185
195
|
return LiveSetting::Polite;
|
|
@@ -189,6 +199,64 @@ long GetLiveSetting(const std::string &liveRegion) noexcept {
|
|
|
189
199
|
return LiveSetting::Off;
|
|
190
200
|
}
|
|
191
201
|
|
|
202
|
+
long GetAnnotationTypeId(const std::string &annotationType) noexcept {
|
|
203
|
+
if (annotationType == "Author") {
|
|
204
|
+
return AnnotationType_Author;
|
|
205
|
+
} else if (annotationType == "CircularReferenceError") {
|
|
206
|
+
return AnnotationType_CircularReferenceError;
|
|
207
|
+
} else if (annotationType == "Comment") {
|
|
208
|
+
return AnnotationType_Comment;
|
|
209
|
+
} else if (annotationType == "ConflictingChange") {
|
|
210
|
+
return AnnotationType_ConflictingChange;
|
|
211
|
+
} else if (annotationType == "DataValidationError") {
|
|
212
|
+
return AnnotationType_DataValidationError;
|
|
213
|
+
} else if (annotationType == "DeletionChange") {
|
|
214
|
+
return AnnotationType_DeletionChange;
|
|
215
|
+
} else if (annotationType == "EditingLockedChange") {
|
|
216
|
+
return AnnotationType_EditingLockedChange;
|
|
217
|
+
} else if (annotationType == "Endnote") {
|
|
218
|
+
return AnnotationType_Endnote;
|
|
219
|
+
} else if (annotationType == "ExternalChange") {
|
|
220
|
+
return AnnotationType_ExternalChange;
|
|
221
|
+
} else if (annotationType == "Footer") {
|
|
222
|
+
return AnnotationType_Footer;
|
|
223
|
+
} else if (annotationType == "Footnote") {
|
|
224
|
+
return AnnotationType_Footnote;
|
|
225
|
+
} else if (annotationType == "FormatChange") {
|
|
226
|
+
return AnnotationType_FormatChange;
|
|
227
|
+
} else if (annotationType == "FormulaError") {
|
|
228
|
+
return AnnotationType_FormulaError;
|
|
229
|
+
} else if (annotationType == "GrammarError") {
|
|
230
|
+
return AnnotationType_GrammarError;
|
|
231
|
+
} else if (annotationType == "Header") {
|
|
232
|
+
return AnnotationType_Header;
|
|
233
|
+
} else if (annotationType == "Highlighted") {
|
|
234
|
+
return AnnotationType_Highlighted;
|
|
235
|
+
} else if (annotationType == "InsertionChange") {
|
|
236
|
+
return AnnotationType_InsertionChange;
|
|
237
|
+
} else if (annotationType == "Mathematics") {
|
|
238
|
+
return AnnotationType_Mathematics;
|
|
239
|
+
} else if (annotationType == "MoveChange") {
|
|
240
|
+
return AnnotationType_MoveChange;
|
|
241
|
+
} else if (annotationType == "SpellingError") {
|
|
242
|
+
return AnnotationType_SpellingError;
|
|
243
|
+
} else if (annotationType == "TrackChanges") {
|
|
244
|
+
return AnnotationType_TrackChanges;
|
|
245
|
+
} else if (annotationType == "AdvanceProofingIssue") {
|
|
246
|
+
return AnnotationType_AdvancedProofingIssue;
|
|
247
|
+
} else if (annotationType == "UnsyncedChange") {
|
|
248
|
+
return AnnotationType_UnsyncedChange;
|
|
249
|
+
}
|
|
250
|
+
return AnnotationType_Unknown;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
bool accessibilityAnnotationHasValue(
|
|
254
|
+
const std::optional<facebook::react::AccessibilityAnnotation> &annotation) noexcept {
|
|
255
|
+
return annotation.has_value() &&
|
|
256
|
+
!(annotation.value().typeID.empty() && annotation.value().typeName.empty() && annotation.value().author.empty() &&
|
|
257
|
+
annotation.value().dateTime.empty() && annotation.value().target.empty());
|
|
258
|
+
}
|
|
259
|
+
|
|
192
260
|
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept {
|
|
193
261
|
auto strongView = view.view();
|
|
194
262
|
|
|
@@ -31,8 +31,19 @@ void UpdateUiaProperty(
|
|
|
31
31
|
const std::string &oldValue,
|
|
32
32
|
const std::string &newValue) noexcept;
|
|
33
33
|
|
|
34
|
+
void UpdateUiaProperty(
|
|
35
|
+
winrt::IInspectable provider,
|
|
36
|
+
PROPERTYID propId,
|
|
37
|
+
const std::optional<std::string> &oldValue,
|
|
38
|
+
const std::optional<std::string> &newValue) noexcept;
|
|
39
|
+
|
|
34
40
|
long GetLiveSetting(const std::string &liveRegion) noexcept;
|
|
35
41
|
|
|
42
|
+
long GetAnnotationTypeId(const std::string &annotationType) noexcept;
|
|
43
|
+
|
|
44
|
+
bool accessibilityAnnotationHasValue(
|
|
45
|
+
const std::optional<facebook::react::AccessibilityAnnotation> &annotation) noexcept;
|
|
46
|
+
|
|
36
47
|
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept;
|
|
37
48
|
|
|
38
49
|
ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept;
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
#include <JSI/jsi.h>
|
|
20
20
|
#include <ReactCommon/RuntimeExecutor.h>
|
|
21
21
|
#include <SchedulerSettings.h>
|
|
22
|
-
#include <SynchronousEventBeat.h>
|
|
23
22
|
#include <UI.Xaml.Controls.h>
|
|
24
23
|
#include <react/components/rnwcore/ComponentDescriptors.h>
|
|
25
24
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
@@ -47,7 +46,10 @@ FabicUIManagerProperty() noexcept {
|
|
|
47
46
|
|
|
48
47
|
/*static*/ std::shared_ptr<FabricUIManager> FabricUIManager::FromProperties(
|
|
49
48
|
const winrt::Microsoft::ReactNative::ReactPropertyBag &props) {
|
|
50
|
-
|
|
49
|
+
auto p = props.Get(FabicUIManagerProperty());
|
|
50
|
+
if (p)
|
|
51
|
+
return p.Value();
|
|
52
|
+
return {};
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
FabricUIManager::FabricUIManager() {}
|
|
@@ -107,7 +109,6 @@ void FabricUIManager::installFabricUIManager() noexcept {
|
|
|
107
109
|
|
|
108
110
|
m_scheduler = std::make_shared<facebook::react::Scheduler>(
|
|
109
111
|
toolbox, (/*animationDriver_ ? animationDriver_.get() :*/ nullptr), this);
|
|
110
|
-
m_surfaceManager = std::make_shared<facebook::react::SurfaceManager>(*m_scheduler);
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
const IComponentViewRegistry &FabricUIManager::GetViewRegistry() const noexcept {
|
|
@@ -135,17 +136,38 @@ void FabricUIManager::startSurface(
|
|
|
135
136
|
layoutContext.pointScaleFactor = rootView.ScaleFactor();
|
|
136
137
|
layoutContext.fontSizeMultiplier = rootView.FontSizeMultiplier();
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
{
|
|
140
|
+
std::unique_lock lock(m_handlerMutex);
|
|
141
|
+
auto surfaceHandler = facebook::react::SurfaceHandler{moduleName, surfaceId};
|
|
142
|
+
surfaceHandler.setContextContainer(m_scheduler->getContextContainer());
|
|
143
|
+
m_handlerRegistry.emplace(surfaceId, std::move(surfaceHandler));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
visit(surfaceId, [&](const facebook::react::SurfaceHandler &surfaceHandler) {
|
|
147
|
+
surfaceHandler.setProps(initialProps);
|
|
148
|
+
surfaceHandler.constraintLayout(layoutConstraints, layoutContext);
|
|
149
|
+
m_scheduler->registerSurface(surfaceHandler);
|
|
150
|
+
surfaceHandler.start();
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
void FabricUIManager::setProps(facebook::react::SurfaceId surfaceId, const folly::dynamic &props) const noexcept {
|
|
155
|
+
visit(surfaceId, [=](const facebook::react::SurfaceHandler &surfaceHandler) { surfaceHandler.setProps(props); });
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
void FabricUIManager::stopSurface(facebook::react::SurfaceId surfaceId) noexcept {
|
|
148
|
-
|
|
159
|
+
visit(surfaceId, [&](const facebook::react::SurfaceHandler &surfaceHandler) {
|
|
160
|
+
surfaceHandler.stop();
|
|
161
|
+
m_scheduler->unregisterSurface(surfaceHandler);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
{
|
|
165
|
+
std::unique_lock lock(m_handlerMutex);
|
|
166
|
+
|
|
167
|
+
auto iterator = m_handlerRegistry.find(surfaceId);
|
|
168
|
+
m_handlerRegistry.erase(iterator);
|
|
169
|
+
}
|
|
170
|
+
|
|
149
171
|
auto &rootDescriptor = m_registry.componentViewDescriptorWithTag(surfaceId);
|
|
150
172
|
rootDescriptor.view.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>()->stop();
|
|
151
173
|
m_registry.enqueueComponentViewWithComponentHandle(
|
|
@@ -156,14 +178,36 @@ facebook::react::Size FabricUIManager::measureSurface(
|
|
|
156
178
|
facebook::react::SurfaceId surfaceId,
|
|
157
179
|
const facebook::react::LayoutConstraints &layoutConstraints,
|
|
158
180
|
const facebook::react::LayoutContext &layoutContext) const noexcept {
|
|
159
|
-
|
|
181
|
+
auto size = facebook::react::Size{};
|
|
182
|
+
|
|
183
|
+
visit(surfaceId, [&](const facebook::react::SurfaceHandler &surfaceHandler) {
|
|
184
|
+
size = surfaceHandler.measure(layoutConstraints, layoutContext);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
return size;
|
|
160
188
|
}
|
|
161
189
|
|
|
162
190
|
void FabricUIManager::constraintSurfaceLayout(
|
|
163
191
|
facebook::react::SurfaceId surfaceId,
|
|
164
192
|
const facebook::react::LayoutConstraints &layoutConstraints,
|
|
165
193
|
const facebook::react::LayoutContext &layoutContext) const noexcept {
|
|
166
|
-
|
|
194
|
+
visit(surfaceId, [=](const facebook::react::SurfaceHandler &surfaceHandler) {
|
|
195
|
+
surfaceHandler.constraintLayout(layoutConstraints, layoutContext);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
void FabricUIManager::visit(
|
|
200
|
+
facebook::react::SurfaceId surfaceId,
|
|
201
|
+
const std::function<void(const facebook::react::SurfaceHandler &surfaceHandler)> &callback) const noexcept {
|
|
202
|
+
std::shared_lock lock(m_handlerMutex);
|
|
203
|
+
|
|
204
|
+
auto iterator = m_handlerRegistry.find(surfaceId);
|
|
205
|
+
|
|
206
|
+
if (iterator == m_handlerRegistry.end()) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
callback(iterator->second);
|
|
167
211
|
}
|
|
168
212
|
|
|
169
213
|
winrt::Microsoft::ReactNative::ReactNotificationId<facebook::react::SurfaceId>
|
|
@@ -429,6 +473,19 @@ void FabricUIManager::Initialize(winrt::Microsoft::ReactNative::ReactContext con
|
|
|
429
473
|
|
|
430
474
|
m_context.Properties().Set(FabicUIManagerProperty(), shared_from_this());
|
|
431
475
|
|
|
476
|
+
auto destroyInstanceNotificationId{
|
|
477
|
+
winrt::Microsoft::ReactNative::ReactNotificationId<winrt::Microsoft::ReactNative::InstanceDestroyedEventArgs>{
|
|
478
|
+
L"ReactNative.InstanceSettings", L"InstanceDestroyed"}};
|
|
479
|
+
reactContext.Notifications().Subscribe(
|
|
480
|
+
destroyInstanceNotificationId,
|
|
481
|
+
[reactContext](
|
|
482
|
+
winrt::Windows::Foundation::IInspectable const & /*sender*/,
|
|
483
|
+
winrt::Microsoft::ReactNative::ReactNotificationArgs<
|
|
484
|
+
winrt::Microsoft::ReactNative::InstanceDestroyedEventArgs> const &args) noexcept {
|
|
485
|
+
reactContext.Properties().Remove(FabicUIManagerProperty());
|
|
486
|
+
args.Subscription().Unsubscribe(); // Unsubscribe after we handle the notification.
|
|
487
|
+
});
|
|
488
|
+
|
|
432
489
|
/*
|
|
433
490
|
EventBeatManager eventBeatManager = new EventBeatManager(mReactApplicationContext);
|
|
434
491
|
UIManagerModule nativeModule =
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
#include <NativeModules.h>
|
|
7
7
|
#include <React.h>
|
|
8
8
|
#include <react/renderer/scheduler/SchedulerDelegate.h>
|
|
9
|
-
#include <react/renderer/scheduler/SurfaceManager.h>
|
|
10
9
|
#include <winrt/Windows.UI.Composition.h>
|
|
11
10
|
#include "Composition/ComponentViewRegistry.h"
|
|
12
11
|
|
|
13
12
|
namespace facebook::react {
|
|
14
13
|
class Scheduler;
|
|
15
14
|
class ReactNativeConfig;
|
|
15
|
+
class SurfaceHandler;
|
|
16
16
|
} // namespace facebook::react
|
|
17
17
|
|
|
18
18
|
namespace Microsoft::ReactNative {
|
|
@@ -47,6 +47,8 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
|
|
|
47
47
|
const facebook::react::LayoutConstraints &layoutConstraints,
|
|
48
48
|
const facebook::react::LayoutContext &layoutContext) const noexcept;
|
|
49
49
|
|
|
50
|
+
void setProps(facebook::react::SurfaceId surfaceId, const folly::dynamic &props) const noexcept;
|
|
51
|
+
|
|
50
52
|
const IComponentViewRegistry &GetViewRegistry() const noexcept;
|
|
51
53
|
|
|
52
54
|
static winrt::Microsoft::ReactNative::ReactNotificationId<facebook::react::SurfaceId> NotifyMountedId() noexcept;
|
|
@@ -62,10 +64,13 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
|
|
|
62
64
|
facebook::react::SurfaceId surfaceId);
|
|
63
65
|
void didMountComponentsWithRootTag(facebook::react::SurfaceId surfaceId) noexcept;
|
|
64
66
|
|
|
67
|
+
void visit(
|
|
68
|
+
facebook::react::SurfaceId surfaceId,
|
|
69
|
+
const std::function<void(const facebook::react::SurfaceHandler &surfaceHandler)> &callback) const noexcept;
|
|
70
|
+
|
|
65
71
|
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
66
72
|
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext m_compContext;
|
|
67
73
|
std::shared_ptr<facebook::react::Scheduler> m_scheduler;
|
|
68
|
-
std::shared_ptr<facebook::react::SurfaceManager> m_surfaceManager;
|
|
69
74
|
std::mutex m_schedulerMutex; // Protect m_scheduler
|
|
70
75
|
bool m_transactionInFlight{false};
|
|
71
76
|
bool m_followUpTransactionRequired{false};
|
|
@@ -77,6 +82,9 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
|
|
|
77
82
|
|
|
78
83
|
std::unordered_map<facebook::react::SurfaceId, SurfaceInfo> m_surfaceRegistry;
|
|
79
84
|
|
|
85
|
+
std::unordered_map<facebook::react::SurfaceId, facebook::react::SurfaceHandler> m_handlerRegistry{};
|
|
86
|
+
mutable std::shared_mutex m_handlerMutex;
|
|
87
|
+
|
|
80
88
|
// Inherited via SchedulerDelegate
|
|
81
89
|
virtual void schedulerDidFinishTransaction(
|
|
82
90
|
const std::shared_ptr<const facebook::react::MountingCoordinator> &mountingCoordinator) override;
|
|
@@ -24,11 +24,11 @@ ImageRequest ImageManager::requestImage(const ImageSource &imageSource, SurfaceI
|
|
|
24
24
|
|
|
25
25
|
ImageRequest ImageManager::requestImage(
|
|
26
26
|
const ImageSource &imageSource,
|
|
27
|
-
SurfaceId
|
|
28
|
-
const ImageRequestParams &
|
|
29
|
-
Tag
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
SurfaceId surfaceId,
|
|
28
|
+
const ImageRequestParams &imageRequestParams,
|
|
29
|
+
Tag tag) const {
|
|
30
|
+
return ((Microsoft::ReactNative::WindowsImageManager *)self_)
|
|
31
|
+
->requestImage(imageSource, surfaceId, imageRequestParams, tag);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
} // namespace react
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <react/renderer/graphics/Float.h>
|
|
7
|
+
|
|
8
|
+
namespace facebook::react {
|
|
9
|
+
|
|
10
|
+
class ImageRequestParams {
|
|
11
|
+
public:
|
|
12
|
+
ImageRequestParams() = default;
|
|
13
|
+
explicit ImageRequestParams(Float blurRadius) : blurRadius(blurRadius) {}
|
|
14
|
+
|
|
15
|
+
Float blurRadius{};
|
|
16
|
+
|
|
17
|
+
bool operator==(const ImageRequestParams &rhs) const {
|
|
18
|
+
return this->blurRadius == rhs.blurRadius;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
bool operator!=(const ImageRequestParams &rhs) const {
|
|
22
|
+
return !(*this == rhs);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
} // namespace facebook::react
|
|
@@ -78,7 +78,9 @@ wicBitmapSourceFromStream(const winrt::Windows::Storage::Streams::IRandomAccessS
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
winrt::Windows::Foundation::IAsyncOperation<winrt::Microsoft::ReactNative::Composition::ImageResponse>
|
|
81
|
-
WindowsImageManager::GetImageRandomAccessStreamAsync(
|
|
81
|
+
WindowsImageManager::GetImageRandomAccessStreamAsync(
|
|
82
|
+
ReactImageSource source,
|
|
83
|
+
std::function<void(uint64_t loaded, uint64_t total)> progressCallback) const {
|
|
82
84
|
co_await winrt::resume_background();
|
|
83
85
|
|
|
84
86
|
winrt::Windows::Foundation::Uri uri(winrt::to_hstring(source.uri));
|
|
@@ -123,6 +125,12 @@ WindowsImageManager::GetImageRandomAccessStreamAsync(ReactImageSource source) co
|
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
if (!source.body.empty()) {
|
|
129
|
+
auto bodyContent = winrt::Windows::Web::Http::HttpStringContent(
|
|
130
|
+
winrt::to_hstring(source.body), winrt::Windows::Storage::Streams::UnicodeEncoding::Utf8, L"application/json");
|
|
131
|
+
request.Content(bodyContent);
|
|
132
|
+
}
|
|
133
|
+
|
|
126
134
|
winrt::Windows::Web::Http::HttpResponseMessage response(co_await m_httpClient.SendRequestAsync(request));
|
|
127
135
|
|
|
128
136
|
if (!response.IsSuccessStatusCode()) {
|
|
@@ -130,8 +138,29 @@ WindowsImageManager::GetImageRandomAccessStreamAsync(ReactImageSource source) co
|
|
|
130
138
|
response.ReasonPhrase(), response.StatusCode(), response.Headers());
|
|
131
139
|
}
|
|
132
140
|
|
|
141
|
+
auto inputStream = co_await response.Content().ReadAsInputStreamAsync();
|
|
142
|
+
auto contentLengthRef = response.Content().Headers().ContentLength();
|
|
143
|
+
uint64_t total = contentLengthRef ? contentLengthRef.GetUInt64() : 0;
|
|
144
|
+
uint64_t loaded = 0;
|
|
145
|
+
|
|
133
146
|
winrt::Windows::Storage::Streams::InMemoryRandomAccessStream memoryStream;
|
|
134
|
-
|
|
147
|
+
winrt::Windows::Storage::Streams::DataReader reader(inputStream);
|
|
148
|
+
constexpr uint32_t bufferSize = 16 * 1024;
|
|
149
|
+
|
|
150
|
+
while (true) {
|
|
151
|
+
uint32_t loadedBuffer = co_await reader.LoadAsync(bufferSize);
|
|
152
|
+
if (loadedBuffer == 0)
|
|
153
|
+
break;
|
|
154
|
+
|
|
155
|
+
auto buffer = reader.ReadBuffer(loadedBuffer);
|
|
156
|
+
co_await memoryStream.WriteAsync(buffer);
|
|
157
|
+
loaded += loadedBuffer;
|
|
158
|
+
|
|
159
|
+
if (progressCallback) {
|
|
160
|
+
progressCallback(loaded, total);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
135
164
|
memoryStream.Seek(0);
|
|
136
165
|
|
|
137
166
|
co_return winrt::Microsoft::ReactNative::Composition::StreamImageResponse(memoryStream.CloneStream());
|
|
@@ -159,8 +188,15 @@ facebook::react::ImageRequest WindowsImageManager::requestImage(
|
|
|
159
188
|
source.height = imageSource.size.height;
|
|
160
189
|
source.width = imageSource.size.width;
|
|
161
190
|
source.sourceType = ImageSourceType::Download;
|
|
191
|
+
source.body = imageSource.body;
|
|
162
192
|
|
|
163
|
-
|
|
193
|
+
auto progressCallback = [weakObserverCoordinator](int64_t loaded, int64_t total) {
|
|
194
|
+
if (auto observerCoordinator = weakObserverCoordinator.lock()) {
|
|
195
|
+
float progress = total > 0 ? static_cast<float>(loaded) / static_cast<float>(total) : 1.0f;
|
|
196
|
+
observerCoordinator->nativeImageResponseProgress(progress, loaded, total);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
imageResponseTask = GetImageRandomAccessStreamAsync(source, progressCallback);
|
|
164
200
|
}
|
|
165
201
|
|
|
166
202
|
imageResponseTask.Completed([weakObserverCoordinator](auto asyncOp, auto status) {
|
|
@@ -195,16 +231,19 @@ facebook::react::ImageRequest WindowsImageManager::requestImage(
|
|
|
195
231
|
observerCoordinator->nativeImageResponseFailed(facebook::react::ImageLoadError(errorInfo));
|
|
196
232
|
break;
|
|
197
233
|
}
|
|
198
|
-
case winrt::Windows::Foundation::AsyncStatus::Started: {
|
|
199
|
-
// TODO progress? - Can we register for progress off the download task?
|
|
200
|
-
// observerCoordinator->nativeImageResponseProgress(0.0/*progress*/, 0/*completed*/, 0/*total*/);
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
234
|
}
|
|
204
235
|
});
|
|
205
236
|
return imageRequest;
|
|
206
237
|
}
|
|
207
238
|
|
|
239
|
+
facebook::react::ImageRequest WindowsImageManager::requestImage(
|
|
240
|
+
const facebook::react::ImageSource &imageSource,
|
|
241
|
+
facebook::react::SurfaceId surfaceId,
|
|
242
|
+
const facebook::react::ImageRequestParams & /* imageRequestParams */,
|
|
243
|
+
facebook::react::Tag /* tag */) const {
|
|
244
|
+
return requestImage(imageSource, surfaceId);
|
|
245
|
+
}
|
|
246
|
+
|
|
208
247
|
} // namespace Microsoft::ReactNative
|
|
209
248
|
|
|
210
249
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include "pch.h"
|
|
5
5
|
|
|
6
6
|
#include <react/renderer/imagemanager/ImageRequest.h>
|
|
7
|
+
#include <react/renderer/imagemanager/ImageRequestParams.h>
|
|
7
8
|
|
|
8
9
|
#include <Fabric/Composition/UriImageManager.h>
|
|
9
10
|
#include <ReactContext.h>
|
|
@@ -20,9 +21,17 @@ struct WindowsImageManager {
|
|
|
20
21
|
const facebook::react::ImageSource &imageSource,
|
|
21
22
|
facebook::react::SurfaceId surfaceId) const;
|
|
22
23
|
|
|
24
|
+
facebook::react::ImageRequest requestImage(
|
|
25
|
+
const facebook::react::ImageSource &imageSource,
|
|
26
|
+
facebook::react::SurfaceId surfaceId,
|
|
27
|
+
const facebook::react::ImageRequestParams & /* imageRequestParams */,
|
|
28
|
+
facebook::react::Tag /* tag */) const;
|
|
29
|
+
|
|
23
30
|
private:
|
|
24
31
|
winrt::Windows::Foundation::IAsyncOperation<winrt::Microsoft::ReactNative::Composition::ImageResponse>
|
|
25
|
-
GetImageRandomAccessStreamAsync(
|
|
32
|
+
GetImageRandomAccessStreamAsync(
|
|
33
|
+
ReactImageSource source,
|
|
34
|
+
std::function<void(uint64_t loaded, uint64_t total)> progressCallback) const;
|
|
26
35
|
|
|
27
36
|
winrt::Windows::Web::Http::HttpClient m_httpClient;
|
|
28
37
|
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
7
|
+
#include <react/renderer/core/propsConversions.h>
|
|
8
|
+
#include <optional>
|
|
9
|
+
#include <unordered_map>
|
|
10
|
+
|
|
11
|
+
namespace facebook::react {
|
|
12
|
+
struct AccessibilityAnnotation {
|
|
13
|
+
std::string typeID{};
|
|
14
|
+
std::string typeName{};
|
|
15
|
+
std::string author{};
|
|
16
|
+
std::string dateTime{};
|
|
17
|
+
std::string target{};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
constexpr bool operator==(const AccessibilityAnnotation &lhs, const AccessibilityAnnotation &rhs) {
|
|
21
|
+
return lhs.typeID == rhs.typeID && lhs.typeName == rhs.typeName && lhs.author == rhs.author &&
|
|
22
|
+
lhs.dateTime == rhs.dateTime && lhs.target == rhs.target;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
constexpr bool operator!=(const AccessibilityAnnotation &lhs, const AccessibilityAnnotation &rhs) {
|
|
26
|
+
return !(rhs == lhs);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
inline void fromRawValue(const PropsParserContext &context, const RawValue &value, AccessibilityAnnotation &result) {
|
|
30
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
31
|
+
|
|
32
|
+
auto typeID = map.find("typeID");
|
|
33
|
+
if (typeID != map.end()) {
|
|
34
|
+
if (typeID->second.hasType<std::string>()) {
|
|
35
|
+
result.typeID = (std::string)typeID->second;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
auto typeName = map.find("typeName");
|
|
40
|
+
if (typeName != map.end()) {
|
|
41
|
+
if (typeName->second.hasType<std::string>()) {
|
|
42
|
+
result.typeName = (std::string)typeName->second;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
auto author = map.find("author");
|
|
47
|
+
if (author != map.end()) {
|
|
48
|
+
if (author->second.hasType<std::string>()) {
|
|
49
|
+
result.author = (std::string)author->second;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
auto dateTime = map.find("dateTime");
|
|
54
|
+
if (dateTime != map.end()) {
|
|
55
|
+
if (dateTime->second.hasType<std::string>()) {
|
|
56
|
+
result.dateTime = (std::string)dateTime->second;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
auto target = map.find("target");
|
|
61
|
+
if (target != map.end()) {
|
|
62
|
+
if (target->second.hasType<std::string>()) {
|
|
63
|
+
result.target = (std::string)target->second;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} // namespace facebook::react
|
|
@@ -38,12 +38,30 @@ void HostPlatformViewEventEmitter::onBlur() const {
|
|
|
38
38
|
|
|
39
39
|
#pragma mark - Mouse Events
|
|
40
40
|
|
|
41
|
-
void HostPlatformViewEventEmitter::onMouseEnter(
|
|
42
|
-
dispatchEvent("mouseEnter", std::make_shared<
|
|
41
|
+
void HostPlatformViewEventEmitter::onMouseEnter(MouseEvent const &pointerEvent) const {
|
|
42
|
+
dispatchEvent("mouseEnter", std::make_shared<MouseEvent>(pointerEvent), RawEvent::Category::ContinuousStart);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
void HostPlatformViewEventEmitter::onMouseLeave(
|
|
46
|
-
dispatchEvent("mouseLeave", std::make_shared<
|
|
45
|
+
void HostPlatformViewEventEmitter::onMouseLeave(MouseEvent const &pointerEvent) const {
|
|
46
|
+
dispatchEvent("mouseLeave", std::make_shared<MouseEvent>(pointerEvent), RawEvent::Category::ContinuousStart);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#pragma mark - Touch Events
|
|
50
|
+
|
|
51
|
+
void HostPlatformViewEventEmitter::onPressIn(PressEvent event) const {
|
|
52
|
+
dispatchEvent("pressIn", [event](jsi::Runtime &runtime) {
|
|
53
|
+
auto payload = jsi::Object(runtime);
|
|
54
|
+
auto nativeEvent = jsi::Object(runtime);
|
|
55
|
+
nativeEvent.setProperty(runtime, "target", static_cast<double>(event.target));
|
|
56
|
+
nativeEvent.setProperty(runtime, "pageX", event.pagePoint.x);
|
|
57
|
+
nativeEvent.setProperty(runtime, "pageY", event.pagePoint.y);
|
|
58
|
+
nativeEvent.setProperty(runtime, "locationX", event.offsetPoint.x);
|
|
59
|
+
nativeEvent.setProperty(runtime, "locationY", event.offsetPoint.y);
|
|
60
|
+
nativeEvent.setProperty(runtime, "timestamp", event.timestamp);
|
|
61
|
+
nativeEvent.setProperty(runtime, "identifier", event.identifier);
|
|
62
|
+
payload.setProperty(runtime, "nativeEvent", nativeEvent);
|
|
63
|
+
return payload;
|
|
64
|
+
});
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
} // namespace facebook::react
|
|
@@ -5,9 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
#include <react/renderer/components/view/BaseViewEventEmitter.h>
|
|
7
7
|
#include "KeyEvent.h"
|
|
8
|
+
#include "MouseEvent.h"
|
|
8
9
|
|
|
9
10
|
namespace facebook::react {
|
|
10
11
|
|
|
12
|
+
struct PressEvent {
|
|
13
|
+
Tag target;
|
|
14
|
+
Point pagePoint;
|
|
15
|
+
Point offsetPoint;
|
|
16
|
+
double timestamp;
|
|
17
|
+
int identifier;
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
class HostPlatformViewEventEmitter : public BaseViewEventEmitter {
|
|
12
21
|
public:
|
|
13
22
|
using BaseViewEventEmitter::BaseViewEventEmitter;
|
|
@@ -24,8 +33,12 @@ class HostPlatformViewEventEmitter : public BaseViewEventEmitter {
|
|
|
24
33
|
|
|
25
34
|
#pragma mark - Mouse Events
|
|
26
35
|
|
|
27
|
-
void onMouseEnter(
|
|
28
|
-
void onMouseLeave(
|
|
36
|
+
void onMouseEnter(MouseEvent const &pointerEvent) const;
|
|
37
|
+
void onMouseLeave(MouseEvent const &pointerEvent) const;
|
|
38
|
+
|
|
39
|
+
#pragma mark - Touch Events
|
|
40
|
+
|
|
41
|
+
virtual void onPressIn(PressEvent event) const;
|
|
29
42
|
};
|
|
30
43
|
|
|
31
44
|
} // namespace facebook::react
|
|
@@ -20,6 +20,10 @@ HostPlatformViewProps::HostPlatformViewProps(
|
|
|
20
20
|
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
21
21
|
? sourceProps.windowsEvents
|
|
22
22
|
: convertRawProp(context, rawProps, sourceProps.windowsEvents, {})),
|
|
23
|
+
accessibilityAnnotation(
|
|
24
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
25
|
+
? sourceProps.accessibilityAnnotation
|
|
26
|
+
: convertRawProp(context, rawProps, "accessibilityAnnotation", sourceProps.accessibilityAnnotation, {})),
|
|
23
27
|
enableFocusRing(
|
|
24
28
|
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
25
29
|
? sourceProps.enableFocusRing
|
|
@@ -40,6 +44,18 @@ HostPlatformViewProps::HostPlatformViewProps(
|
|
|
40
44
|
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
41
45
|
? sourceProps.accessibilitySetSize
|
|
42
46
|
: convertRawProp(context, rawProps, "accessibilitySetSize", sourceProps.accessibilitySetSize, 0)),
|
|
47
|
+
accessibilityLevel(
|
|
48
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
49
|
+
? sourceProps.accessibilityLevel
|
|
50
|
+
: convertRawProp(context, rawProps, "accessibilityLevel", sourceProps.accessibilityLevel, 0)),
|
|
51
|
+
accessibilityItemType(
|
|
52
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
53
|
+
? sourceProps.accessibilityItemType
|
|
54
|
+
: convertRawProp(context, rawProps, "accessibilityItemType", sourceProps.accessibilityItemType, {})),
|
|
55
|
+
accessibilityAccessKey(
|
|
56
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
57
|
+
? sourceProps.accessibilityAccessKey
|
|
58
|
+
: convertRawProp(context, rawProps, "accessibilityAccessKey", sourceProps.accessibilityAccessKey, {})),
|
|
43
59
|
accessibilityLiveRegion(
|
|
44
60
|
ReactNativeFeatureFlags::enableCppPropsIteratorSetter() ? sourceProps.accessibilityLiveRegion
|
|
45
61
|
: convertRawProp(
|
|
@@ -81,9 +97,13 @@ void HostPlatformViewProps::setProp(
|
|
|
81
97
|
WINDOWS_VIEW_EVENT_CASE(MouseEnter);
|
|
82
98
|
WINDOWS_VIEW_EVENT_CASE(MouseLeave);
|
|
83
99
|
RAW_SET_PROP_SWITCH_CASE_BASIC(enableFocusRing);
|
|
100
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityAnnotation);
|
|
84
101
|
RAW_SET_PROP_SWITCH_CASE_BASIC(focusable);
|
|
85
102
|
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityPosInSet);
|
|
86
103
|
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilitySetSize);
|
|
104
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityLevel);
|
|
105
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityItemType);
|
|
106
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityAccessKey);
|
|
87
107
|
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityLiveRegion);
|
|
88
108
|
RAW_SET_PROP_SWITCH_CASE_BASIC(keyDownEvents);
|
|
89
109
|
RAW_SET_PROP_SWITCH_CASE_BASIC(keyUpEvents);
|
package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <react/renderer/components/view/BaseViewProps.h>
|
|
7
7
|
#include <react/renderer/core/PropsParserContext.h>
|
|
8
|
+
#include "CompositionAccessibilityProps.h"
|
|
8
9
|
#include "KeyEvent.h"
|
|
9
10
|
#include "WindowsViewEvents.h"
|
|
10
11
|
|
|
@@ -27,6 +28,10 @@ class HostPlatformViewProps : public BaseViewProps {
|
|
|
27
28
|
int accessibilityPosInSet{0};
|
|
28
29
|
int accessibilitySetSize{0};
|
|
29
30
|
std::string accessibilityLiveRegion{"none"};
|
|
31
|
+
int accessibilityLevel{0};
|
|
32
|
+
std::optional<AccessibilityAnnotation> accessibilityAnnotation{};
|
|
33
|
+
std::optional<std::string> accessibilityItemType{};
|
|
34
|
+
std::optional<std::string> accessibilityAccessKey{};
|
|
30
35
|
|
|
31
36
|
// std::optional<std::string> overflowAnchor{};
|
|
32
37
|
std::optional<std::string> tooltip{};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <react/renderer/components/view/PointerEvent.h>
|
|
7
|
+
|
|
8
|
+
namespace facebook::react {
|
|
9
|
+
|
|
10
|
+
struct MouseEvent : public PointerEvent {
|
|
11
|
+
MouseEvent(PointerEvent &event) : PointerEvent(event){};
|
|
12
|
+
|
|
13
|
+
// We override the type so that it is not recorded as a PointerType,
|
|
14
|
+
// otherwise PointerEventsProcessor gets confused by the Windows specific MouseEvents
|
|
15
|
+
EventPayloadType getType() const override {
|
|
16
|
+
return static_cast<EventPayloadType>(-1);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
} // namespace facebook::react
|