react-native-windows 0.66.3 → 0.67.0-preview.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +2 -1
- package/CHANGELOG.json +917 -85
- package/CHANGELOG.md +352 -37
- package/Chakra/Chakra.vcxitems +0 -1
- package/Chakra/Chakra.vcxitems.filters +0 -3
- package/Chakra/ChakraHelpers.cpp +0 -267
- package/Chakra/ChakraInstanceArgs.h +0 -5
- package/Chakra/ChakraPlatform.h +0 -4
- package/Chakra/ChakraTracing.cpp +0 -33
- package/Chakra/ChakraValue.h +0 -4
- package/Chakra/Utf8DebugExtensions.cpp +0 -5
- package/Chakra/Utf8DebugExtensions.h +0 -6
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +14 -1
- package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +2 -0
- package/Libraries/Alert/Alert.windows.js +48 -21
- package/Libraries/Alert/NativeDialogManagerWindows.js +49 -0
- package/Libraries/Animated/AnimatedEvent.js +23 -4
- package/Libraries/Animated/NativeAnimatedHelper.js +2 -2
- package/Libraries/Animated/components/AnimatedImage.js +3 -3
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -3
- package/Libraries/Animated/components/AnimatedText.js +3 -3
- package/Libraries/Animated/components/AnimatedView.js +1 -3
- package/Libraries/Animated/createAnimatedComponent.js +3 -34
- package/Libraries/Components/Button.js +3 -0
- package/Libraries/Components/Button.windows.js +70 -38
- package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +3 -6
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -7
- package/Libraries/Components/Flyout/Flyout.js +3 -3
- package/Libraries/Components/Flyout/Flyout.js.map +1 -1
- package/Libraries/Components/Flyout/FlyoutProps.d.ts +4 -0
- package/Libraries/Components/Flyout/FlyoutProps.js.map +1 -1
- package/Libraries/Components/Glyph/Glyph.js +2 -2
- package/Libraries/Components/Glyph/Glyph.js.map +1 -1
- package/Libraries/Components/Keyboard/KeyboardExt.js +4 -3
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/Popup/Popup.js +3 -3
- package/Libraries/Components/Popup/Popup.js.map +1 -1
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +1 -0
- package/Libraries/Components/ScrollView/ScrollView.js +17 -16
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +268 -252
- package/Libraries/Components/View/View.js +1 -1
- package/Libraries/Components/View/View.windows.js +1 -1
- package/Libraries/Components/View/ViewAccessibility.js +1 -1
- package/Libraries/Components/View/ViewAccessibility.windows.js +1 -1
- package/Libraries/Components/View/ViewWindows.js +1 -1
- package/Libraries/Components/View/ViewWindows.js.map +1 -1
- package/Libraries/Components/View/ViewWindowsProps.d.ts +42 -2
- package/Libraries/Components/View/ViewWindowsProps.js.map +1 -1
- package/Libraries/Core/ExceptionsManager.js +45 -80
- package/Libraries/Core/ExtendedError.js +0 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +1 -1
- package/Libraries/Core/setUpGlobals.js +2 -4
- package/Libraries/Core/setUpTimers.js +2 -2
- package/Libraries/Image/Image.ios.js +6 -0
- package/Libraries/Image/Image.windows.js +6 -0
- package/Libraries/Image/ImageBackground.js +10 -8
- package/Libraries/Image/ImageProps.js +28 -0
- package/Libraries/LogBox/Data/LogBoxData.js +18 -19
- package/Libraries/LogBox/UI/LogBoxImages/alert-triangle.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/chevron-left.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/chevron-right.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/close.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/loader.png +0 -0
- package/Libraries/NewAppScreen/components/logo.png +0 -0
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +2 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +2 -0
- package/Libraries/Pressability/Pressability.js +13 -13
- package/Libraries/Pressability/Pressability.windows.js +13 -13
- package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
- package/Libraries/ReactNative/AppRegistry.js +4 -2
- package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +1569 -875
- package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +529 -319
- package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +570 -362
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +1592 -891
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +521 -311
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +562 -354
- package/Libraries/Share/Share.js +1 -1
- package/Libraries/StyleSheet/normalizeColor.js +2 -2
- package/Libraries/Text/Text.windows.js +1 -0
- package/Libraries/Text/TextNativeComponent.windows.js +72 -0
- package/Libraries/Text/TextProps.js +1 -7
- package/Libraries/TurboModule/TurboModuleRegistry.js +1 -1
- package/Libraries/Utilities/HMRClient.js +1 -1
- package/Microsoft.ReactNative/ABIViewManager.cpp +10 -1
- package/Microsoft.ReactNative/ABIViewManager.h +3 -0
- package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -6
- package/Microsoft.ReactNative/IReactDispatcher.cpp +16 -1
- package/Microsoft.ReactNative/IViewManager.idl +25 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +35 -8
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +60 -0
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +3 -4
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +3 -3
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +57 -14
- package/Microsoft.ReactNative/Modules/AlertModule.h +17 -24
- package/Microsoft.ReactNative/Modules/Animated/InterpolationAnimatedNode.cpp +4 -2
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +3 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +8 -6
- package/Microsoft.ReactNative/Modules/AppStateModule.h +6 -9
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +34 -22
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +8 -4
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +6 -4
- package/Microsoft.ReactNative/Modules/I18nManagerModule.h +3 -2
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +47 -95
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +28 -17
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.cpp +14 -4
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +1 -1
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +82 -66
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +14 -1
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +3 -1
- package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +37 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.h +28 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.idl +67 -0
- package/Microsoft.ReactNative/Utils/TextTransform.h +1 -1
- package/Microsoft.ReactNative/Utils/XamlIslandUtils.cpp +24 -10
- package/Microsoft.ReactNative/Utils/XamlIslandUtils.h +4 -2
- package/Microsoft.ReactNative/Version.rc +2 -19
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +57 -2
- package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +3 -0
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +7 -2
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +16 -6
- package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +18 -11
- package/Microsoft.ReactNative/Views/Image/ReactImage.h +3 -1
- package/Microsoft.ReactNative/Views/RawTextViewManager.cpp +4 -53
- package/Microsoft.ReactNative/Views/RawTextViewManager.h +0 -3
- package/Microsoft.ReactNative/Views/ShadowNodeBase.h +5 -0
- package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.cpp +52 -0
- package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.h +37 -0
- package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.cpp +343 -0
- package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.h +13 -0
- package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.cpp +76 -0
- package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.h +32 -0
- package/Microsoft.ReactNative/Views/Text/TextParentVisitor.cpp +12 -0
- package/Microsoft.ReactNative/Views/Text/TextParentVisitor.h +19 -0
- package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.cpp +80 -0
- package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.h +43 -0
- package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.cpp +21 -0
- package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +23 -0
- package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.cpp +70 -0
- package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.h +34 -0
- package/Microsoft.ReactNative/Views/Text/TextVisitor.cpp +56 -0
- package/Microsoft.ReactNative/Views/Text/TextVisitor.h +34 -0
- package/Microsoft.ReactNative/Views/Text/TextVisitorScope.h +35 -0
- package/Microsoft.ReactNative/Views/Text/TextVisitors.h +47 -0
- package/Microsoft.ReactNative/Views/TextViewManager.cpp +112 -103
- package/Microsoft.ReactNative/Views/TextViewManager.h +6 -12
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +171 -129
- package/Microsoft.ReactNative/Views/TouchEventHandler.h +19 -15
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +31 -0
- package/Microsoft.ReactNative/Views/ViewManagerBase.h +2 -0
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +0 -5
- package/Microsoft.ReactNative/Views/VirtualTextViewManager.cpp +21 -91
- package/Microsoft.ReactNative/Views/VirtualTextViewManager.h +5 -8
- package/Microsoft.ReactNative/XamlView.h +3 -3
- package/Microsoft.ReactNative/packages.config +1 -1
- package/Microsoft.ReactNative.Cxx/NativeModules.h +114 -0
- package/Microsoft.ReactNative.Cxx/VersionMacros.h +19 -0
- package/PropertySheets/External/Microsoft.ReactNative.Common.props +2 -0
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.props +1 -0
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.props +1 -0
- package/PropertySheets/Generated/PackageVersion.g.props +19 -0
- package/PropertySheets/PackageVersionDefinitions.props +28 -0
- package/PropertySheets/React.Cpp.props +2 -0
- package/PropertySheets/WinUI.props +1 -1
- package/Scripts/Microsoft.ReactNative.Managed.nuspec +1 -1
- package/Scripts/copyRNLibraries.js +12 -0
- package/Scripts/rnw-dependencies.ps1 +25 -24
- package/Shared/HermesSamplingProfiler.cpp +3 -21
- package/Shared/JSI/ChakraApi.cpp +1 -37
- package/Shared/JSI/ChakraApi.h +0 -4
- package/Shared/JSI/ChakraJsiRuntime_edgemode.cpp +1 -5
- package/Shared/JSI/ChakraRuntime.cpp +0 -12
- package/Shared/JSI/ChakraRuntimeFactory.h +0 -2
- package/Shared/Modules/PlatformConstantsModule.cpp +1 -15
- package/Shared/OInstance.cpp +6 -19
- package/Shared/Shared.vcxitems +0 -1
- package/Shared/Shared.vcxitems.filters +0 -3
- package/Shared/Utils.cpp +58 -0
- package/Shared/Utils.h +3 -0
- package/codegen/NativeAccessibilityInfoSpec.g.h +9 -9
- package/codegen/NativeAccessibilityManagerSpec.g.h +49 -21
- package/codegen/NativeActionSheetManagerSpec.g.h +62 -6
- package/codegen/NativeAlertManagerSpec.g.h +4 -4
- package/codegen/NativeAnimatedModuleSpec.g.h +10 -10
- package/codegen/NativeAnimatedTurboModuleSpec.g.h +10 -10
- package/codegen/NativeAppStateSpec.g.h +25 -3
- package/codegen/NativeAppearanceSpec.g.h +3 -3
- package/codegen/NativeAsyncLocalStorageSpec.g.h +66 -18
- package/codegen/NativeAsyncSQLiteDBStorageSpec.g.h +66 -18
- package/codegen/NativeBlobModuleSpec.g.h +24 -6
- package/codegen/NativeBugReportingSpec.g.h +3 -3
- package/codegen/NativeDatePickerAndroidSpec.g.h +3 -3
- package/codegen/NativeDevLoadingViewSpec.g.h +3 -3
- package/codegen/NativeDeviceInfoSpec.g.h +18 -0
- package/codegen/NativeDialogManagerAndroidSpec.g.h +28 -4
- package/codegen/NativeDialogManagerWindowsSpec.g.h +77 -0
- package/codegen/NativeExceptionsManagerSpec.g.h +11 -11
- package/codegen/NativeFileReaderModuleSpec.g.h +6 -6
- package/codegen/NativeFrameRateLoggerSpec.g.h +11 -3
- package/codegen/NativeI18nManagerSpec.g.h +20 -0
- package/codegen/NativeImageEditorSpec.g.h +30 -6
- package/codegen/NativeImageLoaderAndroidSpec.g.h +6 -6
- package/codegen/NativeImageLoaderIOSSpec.g.h +6 -6
- package/codegen/NativeImagePickerIOSSpec.g.h +28 -12
- package/codegen/NativeImageStoreAndroidSpec.g.h +3 -3
- package/codegen/NativeImageStoreIOSSpec.g.h +21 -9
- package/codegen/NativeIntentAndroidSpec.g.h +3 -3
- package/codegen/NativeJSCHeapCaptureSpec.g.h +3 -3
- package/codegen/NativeJSCSamplingProfilerSpec.g.h +3 -3
- package/codegen/NativeJSDevSupportSpec.g.h +18 -0
- package/codegen/NativeNetworkingAndroidSpec.g.h +6 -6
- package/codegen/NativeNetworkingIOSSpec.g.h +26 -6
- package/codegen/NativePermissionsAndroidSpec.g.h +3 -3
- package/codegen/NativePlatformConstantsAndroidSpec.g.h +48 -0
- package/codegen/NativePlatformConstantsIOSSpec.g.h +38 -0
- package/codegen/NativePlatformConstantsWinSpec.g.h +32 -0
- package/codegen/NativePushNotificationManagerIOSSpec.g.h +35 -25
- package/codegen/NativeRedBoxSpec.g.h +3 -3
- package/codegen/NativeSampleTurboModuleSpec.g.h +32 -12
- package/codegen/NativeSegmentFetcherSpec.g.h +6 -6
- package/codegen/NativeSettingsManagerSpec.g.h +22 -6
- package/codegen/NativeShareModuleSpec.g.h +11 -3
- package/codegen/NativeSourceCodeSpec.g.h +16 -0
- package/codegen/NativeStatusBarManagerAndroidSpec.g.h +21 -3
- package/codegen/NativeStatusBarManagerIOSSpec.g.h +30 -6
- package/codegen/NativeToastAndroidSpec.g.h +24 -0
- package/codegen/NativeUIManagerSpec.g.h +63 -63
- package/codegen/NativeVibrationSpec.g.h +3 -3
- package/codegen/NativeWebSocketModuleSpec.g.h +9 -3
- package/index.js +15 -10
- package/index.windows.js +15 -10
- package/jest/mockModal.js +31 -0
- package/jest/setup.js +5 -3
- package/just-task.js +2 -1
- package/package.json +23 -20
- package/rntypes/BatchedBridge.d.ts +23 -0
- package/rntypes/Devtools.d.ts +20 -0
- package/rntypes/LaunchScreen.d.ts +9 -0
- package/rntypes/globals.d.ts +496 -0
- package/rntypes/index.d.ts +9966 -0
- package/rntypes/legacy-properties.d.ts +266 -0
- package/template/cpp-app/proj/MyApp.vcxproj +0 -5
- package/template/cpp-app/src/pch.h +1 -0
- package/template/cpp-lib/src/pch.h +3 -0
- package/template/cs-app/proj/MyApp.csproj +0 -6
- package/typings-index.d.ts +2 -1
- package/typings-index.js +7 -5
- package/typings-index.js.map +1 -1
- package/Chakra/ChakraCoreDebugger.h +0 -147
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -87
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.windows.js +0 -30
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
- package/Libraries/Components/StaticContainer.react.js +0 -51
- package/Libraries/Components/Touchable/ensurePositiveDelayProps.js +0 -25
- package/Libraries/Interaction/InteractionMixin.js +0 -54
- package/Libraries/ReactNative/queryLayoutByID.js +0 -58
- package/Scripts/Microsoft.ChakraCore.ARM64.nuspec +0 -50
- package/Scripts/Microsoft.ChakraCore.ARM64.targets +0 -15
- package/Shared/JSI/ChakraCoreRuntime.h +0 -59
- package/template/cpp-app/keys/MyApp_TemporaryKey.pfx +0 -0
- package/template/cs-app/keys/MyApp_TemporaryKey.pfx +0 -0
|
@@ -168,10 +168,13 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
|
|
|
168
168
|
React::JSValueArray &&point,
|
|
169
169
|
std::function<void(double nativeViewTag, double left, double top, double width, double height)>
|
|
170
170
|
&&callback) noexcept {
|
|
171
|
-
auto
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
if (auto node = m_nodeRegistry.findNode(reactTag)) {
|
|
172
|
+
float x = static_cast<float>(point[0]);
|
|
173
|
+
float y = static_cast<float>(point[1]);
|
|
174
|
+
m_nativeUIManager->findSubviewIn(*node, x, y, std::move(callback));
|
|
175
|
+
} else {
|
|
176
|
+
callback(0, 0, 0, 0, 0);
|
|
177
|
+
}
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
void dispatchViewManagerCommand(
|
|
@@ -179,34 +182,40 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
|
|
|
179
182
|
winrt::Microsoft::ReactNative::JSValue &&commandID,
|
|
180
183
|
React::JSValueArray &&commandArgs) noexcept {
|
|
181
184
|
m_nativeUIManager->ensureInBatch();
|
|
182
|
-
auto
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
if (auto node = m_nodeRegistry.findNode(reactTag)) {
|
|
186
|
+
if (!node->m_zombie)
|
|
187
|
+
node->dispatchCommand(commandID.AsString(), std::move(commandArgs));
|
|
188
|
+
}
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
void measure(
|
|
189
192
|
int64_t reactTag,
|
|
190
193
|
std::function<void(double left, double top, double width, double height, double pageX, double pageY)>
|
|
191
194
|
&&callback) noexcept {
|
|
192
|
-
auto
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
if (auto node = m_nodeRegistry.findNode(reactTag)) {
|
|
196
|
+
int64_t rootTag = reactTag;
|
|
197
|
+
while (true) {
|
|
198
|
+
if (auto currNode = m_nodeRegistry.findNode(rootTag)) {
|
|
199
|
+
if (currNode->m_parent == -1) {
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
rootTag = currNode->m_parent;
|
|
203
|
+
} else {
|
|
204
|
+
callback(0, 0, 0, 0, 0, 0);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
auto &rootNode = m_nodeRegistry.getNode(rootTag);
|
|
201
209
|
|
|
202
|
-
|
|
210
|
+
m_nativeUIManager->measure(*node, rootNode, std::move(callback));
|
|
211
|
+
}
|
|
203
212
|
}
|
|
204
213
|
|
|
205
214
|
void measureInWindow(
|
|
206
215
|
int64_t reactTag,
|
|
207
216
|
std::function<void(double x, double y, double width, double height)> &&callback) noexcept {
|
|
208
|
-
auto
|
|
209
|
-
|
|
217
|
+
if (auto node = m_nodeRegistry.findNode(reactTag))
|
|
218
|
+
m_nativeUIManager->measureInWindow(*node, std::move(callback));
|
|
210
219
|
}
|
|
211
220
|
|
|
212
221
|
void viewIsDescendantOf(
|
|
@@ -222,9 +231,11 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
|
|
|
222
231
|
int64_t ancestorReactTag,
|
|
223
232
|
std::function<void(React::JSValue const &)> &&errorCallback,
|
|
224
233
|
std::function<void(double left, double top, double width, double height)> &&callback) noexcept {
|
|
225
|
-
auto
|
|
226
|
-
auto
|
|
227
|
-
|
|
234
|
+
auto node = m_nodeRegistry.findNode(reactTag);
|
|
235
|
+
auto ancestorNode = m_nodeRegistry.findNode(ancestorReactTag);
|
|
236
|
+
if (node && ancestorNode) {
|
|
237
|
+
m_nativeUIManager->measureLayout(*node, *ancestorNode, std::move(errorCallback), std::move(callback));
|
|
238
|
+
}
|
|
228
239
|
}
|
|
229
240
|
|
|
230
241
|
void measureLayoutRelativeToParent(
|
|
@@ -252,13 +263,13 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
|
|
|
252
263
|
|
|
253
264
|
void removeSubviewsFromContainerWithID(int64_t containerID) noexcept {
|
|
254
265
|
m_nativeUIManager->ensureInBatch();
|
|
255
|
-
auto
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
266
|
+
if (auto containerNode = m_nodeRegistry.findNode(containerID)) {
|
|
267
|
+
std::vector<int64_t> indicesToRemove(containerNode->m_children.size());
|
|
268
|
+
for (size_t i = 0; i < containerNode->m_children.size(); i++)
|
|
269
|
+
indicesToRemove[static_cast<size_t>(i)] = static_cast<int64_t>(i);
|
|
270
|
+
std::vector<int64_t> emptyVec;
|
|
271
|
+
manageChildren(containerID, emptyVec, emptyVec, emptyVec, emptyVec, indicesToRemove);
|
|
272
|
+
}
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
void replaceExistingNonRootView(int64_t reactTag, int64_t newReactTag) noexcept {
|
|
@@ -268,39 +279,44 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
|
|
|
268
279
|
std::vector<int64_t> tagToAdd(1);
|
|
269
280
|
tagToAdd[0] = newReactTag;
|
|
270
281
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
282
|
+
if (auto node = m_nodeRegistry.findNode(reactTag)) {
|
|
283
|
+
CHECK(node->m_parent != -1) << "oldTag must have a parent";
|
|
284
|
+
if (auto parent = m_nodeRegistry.findNode(node->m_parent)) {
|
|
285
|
+
auto it = find(parent->m_children.begin(), parent->m_children.end(), reactTag);
|
|
286
|
+
CHECK(it != parent->m_children.end());
|
|
287
|
+
indicesToAdd[0] = indicesToRemove[0] = it - parent->m_children.begin();
|
|
276
288
|
|
|
277
|
-
|
|
278
|
-
|
|
289
|
+
std::vector<int64_t> emptyVec;
|
|
290
|
+
manageChildren(parent->m_tag, emptyVec, emptyVec, tagToAdd, indicesToAdd, indicesToRemove);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
279
293
|
}
|
|
280
294
|
|
|
281
295
|
void removeRootView(int64_t rootViewTag) noexcept {
|
|
282
296
|
m_nativeUIManager->ensureInBatch();
|
|
283
|
-
auto
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
297
|
+
if (auto node = m_nodeRegistry.findNode(rootViewTag)) {
|
|
298
|
+
m_nativeUIManager->removeRootView(*node);
|
|
299
|
+
DropView(rootViewTag, true);
|
|
300
|
+
m_nodeRegistry.removeRootView(rootViewTag);
|
|
301
|
+
m_nativeUIManager->destroyRootShadowNode(node);
|
|
302
|
+
}
|
|
288
303
|
}
|
|
289
304
|
|
|
290
305
|
void setChildren(int64_t containerTag, React::JSValueArray &&reactTags) noexcept {
|
|
291
306
|
m_nativeUIManager->ensureInBatch();
|
|
292
|
-
auto
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
307
|
+
if (auto parent = m_nodeRegistry.findNode(containerTag)) {
|
|
308
|
+
int64_t index = 0;
|
|
309
|
+
for (auto &&childTag : reactTags) {
|
|
310
|
+
auto tag = childTag.AsInt64();
|
|
311
|
+
auto childNode = m_nodeRegistry.findNode(tag);
|
|
312
|
+
childNode->m_parent = parent->m_tag;
|
|
313
|
+
parent->m_children.push_back(tag);
|
|
314
|
+
if (!parent->m_zombie)
|
|
315
|
+
parent->AddView(*childNode, index);
|
|
316
|
+
|
|
317
|
+
m_nativeUIManager->AddView(*parent, *childNode, index);
|
|
318
|
+
++index;
|
|
319
|
+
}
|
|
304
320
|
}
|
|
305
321
|
}
|
|
306
322
|
|
|
@@ -483,23 +499,23 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
|
|
|
483
499
|
}
|
|
484
500
|
|
|
485
501
|
void DropView(int64_t tag, bool removeChildren = true, bool zombieView = false) {
|
|
486
|
-
auto
|
|
502
|
+
if (auto node = m_nodeRegistry.findNode(tag)) {
|
|
503
|
+
node->onDropViewInstance();
|
|
487
504
|
|
|
488
|
-
|
|
505
|
+
m_nativeUIManager->RemoveView(*node, removeChildren);
|
|
489
506
|
|
|
490
|
-
|
|
507
|
+
if (zombieView)
|
|
508
|
+
node->m_zombie = true;
|
|
491
509
|
|
|
492
|
-
|
|
493
|
-
|
|
510
|
+
for (auto childTag : node->m_children)
|
|
511
|
+
DropView(childTag, removeChildren, zombieView);
|
|
494
512
|
|
|
495
|
-
|
|
496
|
-
|
|
513
|
+
if (removeChildren)
|
|
514
|
+
node->removeAllChildren();
|
|
497
515
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (!zombieView)
|
|
502
|
-
m_nodeRegistry.removeNode(tag);
|
|
516
|
+
if (!zombieView)
|
|
517
|
+
m_nodeRegistry.removeNode(tag);
|
|
518
|
+
}
|
|
503
519
|
}
|
|
504
520
|
|
|
505
521
|
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
#include "../../codegen/NativeClipboardSpec.g.h"
|
|
23
23
|
#include "../../codegen/NativeDevSettingsSpec.g.h"
|
|
24
24
|
#include "../../codegen/NativeDeviceInfoSpec.g.h"
|
|
25
|
+
#include "../../codegen/NativeDialogManagerWindowsSpec.g.h"
|
|
25
26
|
#include "../../codegen/NativeI18nManagerSpec.g.h"
|
|
27
|
+
#include "../../codegen/NativeImageLoaderIOSSpec.g.h"
|
|
26
28
|
#include "../../codegen/NativeLogBoxSpec.g.h"
|
|
27
29
|
#include "../../codegen/NativeUIManagerSpec.g.h"
|
|
28
30
|
#include "NativeModules.h"
|
|
@@ -54,6 +56,7 @@
|
|
|
54
56
|
#endif
|
|
55
57
|
#include "Modules/DevSettingsModule.h"
|
|
56
58
|
#ifndef CORE_ABI
|
|
59
|
+
#include <Modules/ImageViewManagerModule.h>
|
|
57
60
|
#include "Modules/DeviceInfoModule.h"
|
|
58
61
|
#include "Modules/I18nManagerModule.h"
|
|
59
62
|
#include "Modules/LogBoxModule.h"
|
|
@@ -294,7 +297,11 @@ void ReactInstanceWin::LoadModules(
|
|
|
294
297
|
::Microsoft::ReactNative::AccessibilityInfo,
|
|
295
298
|
::Microsoft::ReactNativeSpecs::AccessibilityInfoSpec>());
|
|
296
299
|
|
|
297
|
-
registerTurboModule(
|
|
300
|
+
registerTurboModule(
|
|
301
|
+
L"Alert",
|
|
302
|
+
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<
|
|
303
|
+
::Microsoft::ReactNative::Alert,
|
|
304
|
+
::Microsoft::ReactNativeSpecs::DialogManagerWindowsSpec>());
|
|
298
305
|
|
|
299
306
|
registerTurboModule(
|
|
300
307
|
L"AppState",
|
|
@@ -316,6 +323,12 @@ void ReactInstanceWin::LoadModules(
|
|
|
316
323
|
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<
|
|
317
324
|
::Microsoft::ReactNative::DeviceInfo,
|
|
318
325
|
::Microsoft::ReactNativeSpecs::DeviceInfoSpec>());
|
|
326
|
+
|
|
327
|
+
registerTurboModule(
|
|
328
|
+
L"ImageLoader",
|
|
329
|
+
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<
|
|
330
|
+
::Microsoft::ReactNative::ImageLoader,
|
|
331
|
+
::Microsoft::ReactNativeSpecs::ImageLoaderIOSSpec>());
|
|
319
332
|
#endif
|
|
320
333
|
|
|
321
334
|
registerTurboModule(
|
|
@@ -217,7 +217,9 @@ namespace Microsoft.ReactNative
|
|
|
217
217
|
|
|
218
218
|
DOC_STRING(
|
|
219
219
|
"The @JSIEngine override to be used with the React instance.\n"
|
|
220
|
-
"In order the override to work
|
|
220
|
+
"In order for the override to work, Microsoft.ReactNative must be compiled with support of that engine. "
|
|
221
|
+
"This override will be ignored when @.UseWebDebugger is set to true, since the browser must use its own "
|
|
222
|
+
"engine to debug correctly.")
|
|
221
223
|
DOC_DEFAULT("JSIEngine.Chakra")
|
|
222
224
|
JSIEngine JSIEngineOverride { get; set; };
|
|
223
225
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "ReactPointerEventArgs.h"
|
|
6
|
+
#include "ReactPointerEventArgs.g.cpp"
|
|
7
|
+
|
|
8
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
9
|
+
|
|
10
|
+
xaml::Input::PointerRoutedEventArgs ReactPointerEventArgs::Args() const noexcept {
|
|
11
|
+
return m_args;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
PointerEventKind ReactPointerEventArgs::Kind() const noexcept {
|
|
15
|
+
return m_kind;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
void ReactPointerEventArgs::Kind(PointerEventKind kind) noexcept {
|
|
19
|
+
// The only event type change that is supported is CaptureLost to End.
|
|
20
|
+
assert(kind == PointerEventKind::End && m_kind == PointerEventKind::CaptureLost);
|
|
21
|
+
m_kind = kind;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
winrt::IInspectable ReactPointerEventArgs::Target() const noexcept {
|
|
25
|
+
return m_target;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void ReactPointerEventArgs::Target(winrt::IInspectable const &target) noexcept {
|
|
29
|
+
m_target = target;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
ReactPointerEventArgs::ReactPointerEventArgs(
|
|
33
|
+
PointerEventKind kind,
|
|
34
|
+
xaml::Input::PointerRoutedEventArgs const &args) noexcept
|
|
35
|
+
: m_kind{kind}, m_args{args} {}
|
|
36
|
+
|
|
37
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "ReactPointerEventArgs.g.h"
|
|
7
|
+
#include <UI.Xaml.Input.h>
|
|
8
|
+
|
|
9
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
10
|
+
struct ReactPointerEventArgs : ReactPointerEventArgsT<ReactPointerEventArgs> {
|
|
11
|
+
xaml::Input::PointerRoutedEventArgs Args() const noexcept;
|
|
12
|
+
|
|
13
|
+
PointerEventKind Kind() const noexcept;
|
|
14
|
+
void Kind(PointerEventKind kind) noexcept;
|
|
15
|
+
|
|
16
|
+
winrt::IInspectable Target() const noexcept;
|
|
17
|
+
void Target(winrt::IInspectable const &target) noexcept;
|
|
18
|
+
|
|
19
|
+
// Internal use
|
|
20
|
+
ReactPointerEventArgs(PointerEventKind kind, xaml::Input::PointerRoutedEventArgs const &args) noexcept;
|
|
21
|
+
|
|
22
|
+
private:
|
|
23
|
+
PointerEventKind m_kind;
|
|
24
|
+
xaml::Input::PointerRoutedEventArgs const &m_args;
|
|
25
|
+
winrt::IInspectable m_target{nullptr};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "DocString.h"
|
|
5
|
+
#include "NamespaceRedirect.h"
|
|
6
|
+
|
|
7
|
+
namespace Microsoft.ReactNative {
|
|
8
|
+
[experimental]
|
|
9
|
+
[webhosthidden]
|
|
10
|
+
enum PointerEventKind {
|
|
11
|
+
DOC_STRING(
|
|
12
|
+
"Default pointer event kind that corresponding to events that should be "
|
|
13
|
+
"ignored by the React root view pointer event handler."
|
|
14
|
+
)
|
|
15
|
+
None,
|
|
16
|
+
DOC_STRING(
|
|
17
|
+
"Pointer event kind corresponding to "
|
|
18
|
+
"@Windows.UI.Xaml.UIElement.PointerPressedEvent on the React root view."
|
|
19
|
+
)
|
|
20
|
+
Start,
|
|
21
|
+
DOC_STRING(
|
|
22
|
+
"Pointer event kind corresponding to "
|
|
23
|
+
"@Windows.UI.Xaml.UIElement.PointerReleasedEvent on the React root view."
|
|
24
|
+
)
|
|
25
|
+
End,
|
|
26
|
+
DOC_STRING(
|
|
27
|
+
"Pointer event kind corresponding to "
|
|
28
|
+
"@Windows.UI.Xaml.UIElement.PointerMovedEvent on the React root view."
|
|
29
|
+
)
|
|
30
|
+
Move,
|
|
31
|
+
DOC_STRING(
|
|
32
|
+
"Pointer event kind corresponding to "
|
|
33
|
+
"@Windows.UI.Xaml.UIElement.PointerCanceledEvent on the React root view."
|
|
34
|
+
)
|
|
35
|
+
Cancel,
|
|
36
|
+
DOC_STRING(
|
|
37
|
+
"Pointer event kind corresponding to "
|
|
38
|
+
"@Windows.UI.Xaml.UIElement.PointerCaptureLostEvent on the React root view."
|
|
39
|
+
)
|
|
40
|
+
CaptureLost,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
[experimental]
|
|
44
|
+
[webhosthidden]
|
|
45
|
+
DOC_STRING("Event arguments wrapper for @IViewManagerWithPointerEvents.")
|
|
46
|
+
runtimeclass ReactPointerEventArgs {
|
|
47
|
+
DOC_STRING("Gets the wrapped routed pointer event.")
|
|
48
|
+
XAML_NAMESPACE.Input.PointerRoutedEventArgs Args {
|
|
49
|
+
get;
|
|
50
|
+
};
|
|
51
|
+
DOC_STRING(
|
|
52
|
+
"Gets or sets the pointer event kind. The only valid override is "
|
|
53
|
+
"@PointerEventKind.CaptureLost to @PointerEventKind.End to handle cases "
|
|
54
|
+
"where PointerCaptureLost events on ReactRootView can be safely treated "
|
|
55
|
+
"as PointerReleased events, e.g., for pointer events on selectable text."
|
|
56
|
+
)
|
|
57
|
+
PointerEventKind Kind {
|
|
58
|
+
get;
|
|
59
|
+
set;
|
|
60
|
+
};
|
|
61
|
+
DOC_STRING("Gets or sets the React target for the pointer event.")
|
|
62
|
+
Object Target {
|
|
63
|
+
get;
|
|
64
|
+
set;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
} // namespace Microsoft.ReactNative
|
|
@@ -30,21 +30,35 @@ struct CustomAppBarButton : xaml::Controls::AppBarButtonT<CustomAppBarButton> {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
void FixProofingMenuCrashForXamlIsland(xaml::Controls::
|
|
33
|
+
void FixProofingMenuCrashForXamlIsland(xaml::Controls::Primitives::FlyoutBase const &flyout) {
|
|
34
34
|
flyout.Opening([](winrt::IInspectable const &sender, auto &&) {
|
|
35
|
-
const auto &flyout = sender.as<
|
|
35
|
+
const auto &flyout = sender.as<winrt::Microsoft::UI::Xaml::Controls::TextCommandBarFlyout>();
|
|
36
36
|
if (const auto &textBox = flyout.Target().try_as<xaml::Controls::TextBox>()) {
|
|
37
37
|
const auto &commands = flyout.SecondaryCommands();
|
|
38
38
|
for (uint32_t i = 0; i < commands.Size(); ++i) {
|
|
39
39
|
if (const auto &appBarButton = commands.GetAt(i).try_as<xaml::Controls::AppBarButton>()) {
|
|
40
|
-
if (appBarButton.Flyout()
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
if (!appBarButton.Flyout()) {
|
|
41
|
+
// This works around a loss of focus from the target element when clicking on
|
|
42
|
+
// on the menu items.
|
|
43
|
+
// https://github.com/microsoft/microsoft-ui-xaml/issues/5818
|
|
44
|
+
appBarButton.Click([weakCommandBarFlyout = winrt::make_weak(flyout)](auto &&...) {
|
|
45
|
+
if (auto flyout = weakCommandBarFlyout.get()) {
|
|
46
|
+
xaml::Input::FocusManager::TryFocusAsync(flyout.Target(), xaml::FocusState::Programmatic);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
} else if (appBarButton.Flyout() == textBox.ProofingMenuFlyout()) {
|
|
50
|
+
if (!appBarButton.try_as<CustomAppBarButton>()) {
|
|
51
|
+
// Replace the AppBarButton for the proofing menu with one that doesn't crash
|
|
52
|
+
const auto customAppBarButton = winrt::make<CustomAppBarButton>();
|
|
53
|
+
customAppBarButton.Label(appBarButton.Label());
|
|
54
|
+
customAppBarButton.Icon(appBarButton.Icon());
|
|
55
|
+
customAppBarButton.Flyout(appBarButton.Flyout());
|
|
56
|
+
commands.RemoveAt(i);
|
|
57
|
+
commands.InsertAt(i, customAppBarButton);
|
|
58
|
+
} else if (!textBox.IsSpellCheckEnabled()) {
|
|
59
|
+
// Remove proofing menu option if spell-check is disabled
|
|
60
|
+
commands.RemoveAt(i);
|
|
61
|
+
}
|
|
48
62
|
|
|
49
63
|
// There is only one proofing menu option
|
|
50
64
|
break;
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
#include <UI.Xaml.Controls.Primitives.h>
|
|
9
9
|
#include <UI.Xaml.Controls.h>
|
|
10
10
|
|
|
11
|
+
#include <winrt/Microsoft.UI.Xaml.Controls.h>
|
|
12
|
+
|
|
11
13
|
namespace Microsoft::ReactNative {
|
|
12
14
|
|
|
13
|
-
void FixProofingMenuCrashForXamlIsland(xaml::Controls::
|
|
15
|
+
void FixProofingMenuCrashForXamlIsland(xaml::Controls::Primitives::FlyoutBase const &flyout);
|
|
14
16
|
|
|
15
17
|
template <typename T>
|
|
16
18
|
inline void EnsureUniqueTextFlyoutForXamlIsland(T const &textView) {
|
|
@@ -19,7 +21,7 @@ inline void EnsureUniqueTextFlyoutForXamlIsland(T const &textView) {
|
|
|
19
21
|
// to show the flyout on other windows cause the first window to get focus.
|
|
20
22
|
// https://github.com/microsoft/microsoft-ui-xaml/issues/5341
|
|
21
23
|
if (IsXamlIsland()) {
|
|
22
|
-
|
|
24
|
+
winrt::Microsoft::UI::Xaml::Controls::TextCommandBarFlyout flyout;
|
|
23
25
|
flyout.Placement(xaml::Controls::Primitives::FlyoutPlacementMode::BottomEdgeAlignedLeft);
|
|
24
26
|
|
|
25
27
|
// This works around a XAML Islands bug where the Proofing sub-menu for
|
|
@@ -3,29 +3,12 @@
|
|
|
3
3
|
#define XSTRINGIZE(s) STRINGIZE(s)
|
|
4
4
|
#define STRINGIZE(s) #s
|
|
5
5
|
|
|
6
|
-
#ifdef RNW_PKG_VERSION_STR
|
|
7
|
-
#define VER_FILEVERSION_STR XSTRINGIZE(RNW_PKG_VERSION_STR)
|
|
8
|
-
#else
|
|
9
|
-
#define VER_FILEVERSION_STR "Private Build"
|
|
10
|
-
#endif
|
|
11
|
-
|
|
12
|
-
#ifndef RNW_PKG_VERSION_MAJOR
|
|
13
|
-
#define RNW_PKG_VERSION_MAJOR 1000
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
#ifndef RNW_PKG_VERSION_MINOR
|
|
17
|
-
#define RNW_PKG_VERSION_MINOR 0
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
#ifndef RNW_PKG_VERSION_PATCH
|
|
21
|
-
#define RNW_PKG_VERSION_PATCH 0
|
|
22
|
-
#endif
|
|
23
|
-
|
|
24
6
|
#ifndef RNW_PKG_VERSION_BUILD
|
|
25
7
|
#define RNW_PKG_VERSION_BUILD 0
|
|
26
8
|
#endif
|
|
27
9
|
|
|
28
|
-
#define
|
|
10
|
+
#define VER_FILEVERSION_STR XSTRINGIZE(RNW_VERSION)
|
|
11
|
+
#define VER_FILEVERSION RNW_MAJOR,RNW_MINOR,RNW_PATCH,RNW_PKG_VERSION_BUILD
|
|
29
12
|
|
|
30
13
|
#ifndef DEBUG
|
|
31
14
|
#define VER_DEBUG 0
|
|
@@ -62,6 +62,12 @@ static const std::unordered_map<std::string, winrt::FlyoutPlacementMode> placeme
|
|
|
62
62
|
{"right-edge-aligned-top", winrt::FlyoutPlacementMode::RightEdgeAlignedTop},
|
|
63
63
|
{"right-edge-aligned-bottom", winrt::FlyoutPlacementMode::RightEdgeAlignedBottom}};
|
|
64
64
|
|
|
65
|
+
static const std::unordered_map<std::string, winrt::FlyoutShowMode> showModes = {
|
|
66
|
+
{"auto", winrt::FlyoutShowMode::Auto},
|
|
67
|
+
{"standard", winrt::FlyoutShowMode::Standard},
|
|
68
|
+
{"transient", winrt::FlyoutShowMode::Transient},
|
|
69
|
+
{"transient-with-dismiss-on-pointer-move-away", winrt::FlyoutShowMode::TransientWithDismissOnPointerMoveAway}};
|
|
70
|
+
|
|
65
71
|
template <>
|
|
66
72
|
struct json_type_traits<winrt::FlyoutPlacementMode> {
|
|
67
73
|
static winrt::FlyoutPlacementMode parseJson(const winrt::Microsoft::ReactNative::JSValue &value) {
|
|
@@ -76,6 +82,19 @@ struct json_type_traits<winrt::FlyoutPlacementMode> {
|
|
|
76
82
|
}
|
|
77
83
|
};
|
|
78
84
|
|
|
85
|
+
template <>
|
|
86
|
+
struct json_type_traits<winrt::FlyoutShowMode> {
|
|
87
|
+
static winrt::FlyoutShowMode parseJson(const winrt::Microsoft::ReactNative::JSValue &value) {
|
|
88
|
+
auto iter = showModes.find(value.AsString());
|
|
89
|
+
|
|
90
|
+
if (iter != showModes.end()) {
|
|
91
|
+
return iter->second;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return winrt::FlyoutShowMode::Auto;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
79
98
|
namespace Microsoft::ReactNative {
|
|
80
99
|
|
|
81
100
|
class FlyoutShadowNode : public ShadowNodeBase {
|
|
@@ -112,6 +131,7 @@ class FlyoutShadowNode : public ShadowNodeBase {
|
|
|
112
131
|
float m_verticalOffset = 0;
|
|
113
132
|
bool m_isFlyoutShowOptionsSupported = false;
|
|
114
133
|
winrt::FlyoutShowOptions m_showOptions = nullptr;
|
|
134
|
+
bool m_autoFocus = false;
|
|
115
135
|
|
|
116
136
|
std::unique_ptr<TouchEventHandler> m_touchEventHanadler;
|
|
117
137
|
std::unique_ptr<PreviewKeyboardEventHandlerOnRoot> m_previewKeyboardEventHandlerOnRoot;
|
|
@@ -210,6 +230,17 @@ void FlyoutShadowNode::createView(const winrt::Microsoft::ReactNative::JSValueOb
|
|
|
210
230
|
}
|
|
211
231
|
}
|
|
212
232
|
|
|
233
|
+
if (m_autoFocus) {
|
|
234
|
+
if (const auto content = m_flyout.Content()) {
|
|
235
|
+
if (const auto elementToFocus = xaml::Input::FocusManager::FindFirstFocusableElement(content)) {
|
|
236
|
+
if (const auto uiManager = GetNativeUIManager(GetViewManager()->GetReactContext()).lock()) {
|
|
237
|
+
// NativeUIManager::focus is a no-op if the tag is not found
|
|
238
|
+
uiManager->focus(GetTag(elementToFocus));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
213
244
|
flyoutPresenter.AllowFocusOnInteraction(false);
|
|
214
245
|
}
|
|
215
246
|
}
|
|
@@ -327,6 +358,18 @@ void FlyoutShadowNode::updateProperties(winrt::Microsoft::ReactNative::JSValueOb
|
|
|
327
358
|
}
|
|
328
359
|
|
|
329
360
|
m_flyout.LightDismissOverlayMode(overlayMode);
|
|
361
|
+
} else if (propertyName == "autoFocus") {
|
|
362
|
+
m_autoFocus = propertyValue.AsBoolean();
|
|
363
|
+
} else if (propertyName == "showMode") {
|
|
364
|
+
const auto showMode = json_type_traits<winrt::FlyoutShowMode>::parseJson(propertyValue);
|
|
365
|
+
m_flyout.ShowMode(showMode);
|
|
366
|
+
if (m_isFlyoutShowOptionsSupported) {
|
|
367
|
+
m_showOptions.ShowMode(showMode);
|
|
368
|
+
}
|
|
369
|
+
} else if (propertyName == "shouldConstrainToRootBounds") {
|
|
370
|
+
if (propertyValue.Type() == React::JSValueType::Boolean) {
|
|
371
|
+
m_flyout.ShouldConstrainToRootBounds(propertyValue.AsBoolean());
|
|
372
|
+
}
|
|
330
373
|
}
|
|
331
374
|
}
|
|
332
375
|
|
|
@@ -384,7 +427,16 @@ void FlyoutShadowNode::SetTargetFrameworkElement() {
|
|
|
384
427
|
}
|
|
385
428
|
}
|
|
386
429
|
} else {
|
|
387
|
-
|
|
430
|
+
if (IsXamlIsland()) {
|
|
431
|
+
// // XamlRoot added in 19H1
|
|
432
|
+
if (Is19H1OrHigher()) {
|
|
433
|
+
if (auto xamlRoot = React::XamlUIService::GetXamlRoot(GetViewManager()->GetReactContext().Properties())) {
|
|
434
|
+
m_targetElement = xamlRoot.Content().as<xaml::FrameworkElement>();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
m_targetElement = xaml::Window::Current().Content().as<xaml::FrameworkElement>();
|
|
439
|
+
}
|
|
388
440
|
}
|
|
389
441
|
}
|
|
390
442
|
|
|
@@ -448,10 +500,13 @@ void FlyoutViewManager::GetNativeProps(const winrt::Microsoft::ReactNative::IJSV
|
|
|
448
500
|
React::WriteProperty(writer, L"horizontalOffset", L"number");
|
|
449
501
|
React::WriteProperty(writer, L"isLightDismissEnabled", L"boolean");
|
|
450
502
|
React::WriteProperty(writer, L"isOpen", L"boolean");
|
|
451
|
-
React::WriteProperty(writer, L"placement", L"
|
|
503
|
+
React::WriteProperty(writer, L"placement", L"string");
|
|
452
504
|
React::WriteProperty(writer, L"target", L"number");
|
|
453
505
|
React::WriteProperty(writer, L"verticalOffset", L"number");
|
|
454
506
|
React::WriteProperty(writer, L"isOverlayEnabled", L"boolean");
|
|
507
|
+
React::WriteProperty(writer, L"autoFocus", L"boolean");
|
|
508
|
+
React::WriteProperty(writer, L"showMode", L"string");
|
|
509
|
+
React::WriteProperty(writer, L"shouldConstrainToRootBounds", L"boolean");
|
|
455
510
|
}
|
|
456
511
|
|
|
457
512
|
void FlyoutViewManager::GetExportedCustomDirectEventTypeConstants(
|
|
@@ -33,6 +33,9 @@ void TransferFrameworkElementProperties(const xaml::DependencyObject &oldView, c
|
|
|
33
33
|
// Render Properties
|
|
34
34
|
TransferProperty(oldView, newView, xaml::UIElement::OpacityProperty());
|
|
35
35
|
|
|
36
|
+
// Hit Test Properties
|
|
37
|
+
TransferProperty(oldView, newView, xaml::UIElement::IsHitTestVisibleProperty());
|
|
38
|
+
|
|
36
39
|
// Layout Properties
|
|
37
40
|
TransferProperty(oldView, newView, xaml::FrameworkElement::WidthProperty());
|
|
38
41
|
TransferProperty(oldView, newView, xaml::FrameworkElement::HeightProperty());
|
|
@@ -261,8 +261,13 @@ bool FrameworkElementViewManager::UpdateProperty(
|
|
|
261
261
|
AnnounceLiveRegionChangedIfNeeded(element);
|
|
262
262
|
} else if (propertyName == "accessible") {
|
|
263
263
|
if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
|
|
264
|
-
if (
|
|
265
|
-
xaml::Automation::AutomationProperties::SetAccessibilityView(element, winrt::
|
|
264
|
+
if (propertyValue.AsBoolean()) {
|
|
265
|
+
xaml::Automation::AutomationProperties::SetAccessibilityView(element, winrt::AccessibilityView::Content);
|
|
266
|
+
} else {
|
|
267
|
+
xaml::Automation::AutomationProperties::SetAccessibilityView(element, winrt::AccessibilityView::Raw);
|
|
268
|
+
}
|
|
269
|
+
} else if (propertyValue.IsNull()) {
|
|
270
|
+
element.ClearValue(xaml::Automation::AutomationProperties::AccessibilityViewProperty());
|
|
266
271
|
}
|
|
267
272
|
} else if (propertyName == "accessibilityLiveRegion") {
|
|
268
273
|
if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::String) {
|