react-native-windows 0.66.5 → 0.67.0-preview.4
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 +934 -102
- package/CHANGELOG.md +358 -43
- 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 -6
- 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/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/Modules/PlatformConstantsModule.cpp +1 -15
- 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/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/template/cpp-app/keys/MyApp_TemporaryKey.pfx +0 -0
- package/template/cs-app/keys/MyApp_TemporaryKey.pfx +0 -0
package/Libraries/Share/Share.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
/* eslint no-bitwise: 0 */
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import _normalizeColor from '@react-native/normalize-color';
|
|
14
14
|
|
|
15
15
|
import type {ColorValue} from './StyleSheet';
|
|
16
16
|
import type {ProcessedColorValue} from './processColor';
|
|
@@ -27,7 +27,7 @@ function normalizeColor(
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (typeof color === 'string' || typeof color === 'number') {
|
|
30
|
-
return
|
|
30
|
+
return _normalizeColor(color);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import ReactNativeViewAttributes from '../Components/View/ReactNativeViewAttributes';
|
|
12
|
+
import UIManager from '../ReactNative/UIManager';
|
|
13
|
+
import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
14
|
+
import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
|
|
15
|
+
import {type ProcessedColorValue} from '../StyleSheet/processColor';
|
|
16
|
+
import {type TextProps} from './TextProps';
|
|
17
|
+
|
|
18
|
+
type NativeTextProps = $ReadOnly<{
|
|
19
|
+
...TextProps,
|
|
20
|
+
isHighlighted?: ?boolean,
|
|
21
|
+
isPressable?: ?boolean, // [Windows]
|
|
22
|
+
selectionColor?: ?ProcessedColorValue,
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
export const NativeText: HostComponent<NativeTextProps> = (createReactNativeComponentClass(
|
|
26
|
+
'RCTText',
|
|
27
|
+
() => ({
|
|
28
|
+
// $FlowFixMe[incompatible-call]
|
|
29
|
+
validAttributes: {
|
|
30
|
+
...ReactNativeViewAttributes.UIView,
|
|
31
|
+
isHighlighted: true,
|
|
32
|
+
isPressable: true, // [Windows]
|
|
33
|
+
numberOfLines: true,
|
|
34
|
+
ellipsizeMode: true,
|
|
35
|
+
allowFontScaling: true,
|
|
36
|
+
maxFontSizeMultiplier: true,
|
|
37
|
+
disabled: true,
|
|
38
|
+
selectable: true,
|
|
39
|
+
selectionColor: true,
|
|
40
|
+
adjustsFontSizeToFit: true,
|
|
41
|
+
minimumFontScale: true,
|
|
42
|
+
textBreakStrategy: true,
|
|
43
|
+
onTextLayout: true,
|
|
44
|
+
onInlineViewLayout: true,
|
|
45
|
+
dataDetectorType: true,
|
|
46
|
+
android_hyphenationFrequency: true,
|
|
47
|
+
},
|
|
48
|
+
directEventTypes: {
|
|
49
|
+
topTextLayout: {
|
|
50
|
+
registrationName: 'onTextLayout',
|
|
51
|
+
},
|
|
52
|
+
topInlineViewLayout: {
|
|
53
|
+
registrationName: 'onInlineViewLayout',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
uiViewClassName: 'RCTText',
|
|
57
|
+
}),
|
|
58
|
+
): any);
|
|
59
|
+
|
|
60
|
+
export const NativeVirtualText: HostComponent<NativeTextProps> =
|
|
61
|
+
!global.RN$Bridgeless && !UIManager.hasViewManagerConfig('RCTVirtualText')
|
|
62
|
+
? NativeText
|
|
63
|
+
: (createReactNativeComponentClass('RCTVirtualText', () => ({
|
|
64
|
+
// $FlowFixMe[incompatible-call]
|
|
65
|
+
validAttributes: {
|
|
66
|
+
...ReactNativeViewAttributes.UIView,
|
|
67
|
+
isHighlighted: true,
|
|
68
|
+
isPressable: true, // [Windows]
|
|
69
|
+
maxFontSizeMultiplier: true,
|
|
70
|
+
},
|
|
71
|
+
uiViewClassName: 'RCTVirtualText',
|
|
72
|
+
})): any);
|
|
@@ -66,13 +66,7 @@ export type TextProps = $ReadOnly<{|
|
|
|
66
66
|
* Set hyphenation strategy on Android.
|
|
67
67
|
*
|
|
68
68
|
*/
|
|
69
|
-
android_hyphenationFrequency?: ?(
|
|
70
|
-
| 'normal'
|
|
71
|
-
| 'none'
|
|
72
|
-
| 'full'
|
|
73
|
-
| 'high'
|
|
74
|
-
| 'balanced'
|
|
75
|
-
),
|
|
69
|
+
android_hyphenationFrequency?: ?('normal' | 'none' | 'full'),
|
|
76
70
|
children?: ?Node,
|
|
77
71
|
|
|
78
72
|
/**
|
|
@@ -16,7 +16,7 @@ const turboModuleProxy = global.__turboModuleProxy;
|
|
|
16
16
|
|
|
17
17
|
function requireModule<T: TurboModule>(name: string): ?T {
|
|
18
18
|
// Bridgeless mode requires TurboModules
|
|
19
|
-
if (
|
|
19
|
+
if (global.RN$Bridgeless !== true) {
|
|
20
20
|
// Backward compatibility layer during migration.
|
|
21
21
|
const legacyModule = NativeModules[name];
|
|
22
22
|
if (legacyModule != null) {
|
|
@@ -119,7 +119,7 @@ const HMRClient: HMRClientNativeInterface = {
|
|
|
119
119
|
JSON.stringify({
|
|
120
120
|
type: 'log',
|
|
121
121
|
level,
|
|
122
|
-
mode: global.RN$Bridgeless ? 'NOBRIDGE' : 'BRIDGE',
|
|
122
|
+
mode: global.RN$Bridgeless === true ? 'NOBRIDGE' : 'BRIDGE',
|
|
123
123
|
data: data.map(item =>
|
|
124
124
|
typeof item === 'string'
|
|
125
125
|
? item
|
|
@@ -40,7 +40,8 @@ ABIViewManager::ABIViewManager(
|
|
|
40
40
|
m_viewManagerWithCommands{viewManager.try_as<IViewManagerWithCommands>()},
|
|
41
41
|
m_viewManagerWithExportedEventTypeConstants{viewManager.try_as<IViewManagerWithExportedEventTypeConstants>()},
|
|
42
42
|
m_viewManagerRequiresNativeLayout{viewManager.try_as<IViewManagerRequiresNativeLayout>()},
|
|
43
|
-
m_viewManagerWithChildren{viewManager.try_as<IViewManagerWithChildren>()}
|
|
43
|
+
m_viewManagerWithChildren{viewManager.try_as<IViewManagerWithChildren>()},
|
|
44
|
+
m_viewManagerWithPointerEvents{viewManager.try_as<IViewManagerWithPointerEvents>()} {
|
|
44
45
|
if (m_viewManagerWithReactContext) {
|
|
45
46
|
m_viewManagerWithReactContext.ReactContext(winrt::make<implementation::ReactContext>(Mso::Copy(reactContext)));
|
|
46
47
|
}
|
|
@@ -215,6 +216,14 @@ YGMeasureFunc ABIViewManager::GetYogaCustomMeasureFunc() const {
|
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
218
|
|
|
219
|
+
void ABIViewManager::OnPointerEvent(::Microsoft::ReactNative::ShadowNodeBase *node, const ReactPointerEventArgs &args) {
|
|
220
|
+
if (m_viewManagerWithPointerEvents) {
|
|
221
|
+
m_viewManagerWithPointerEvents.OnPointerEvent(node->GetView(), args);
|
|
222
|
+
}
|
|
223
|
+
// Call the base method to handle `pointerEvents` behavior
|
|
224
|
+
Super::OnPointerEvent(node, args);
|
|
225
|
+
}
|
|
226
|
+
|
|
218
227
|
::Microsoft::ReactNative::ShadowNode *ABIViewManager::createShadow() const {
|
|
219
228
|
return new ABIShadowNode(
|
|
220
229
|
m_viewManagerRequiresNativeLayout && m_viewManagerRequiresNativeLayout.RequiresNativeLayout());
|
|
@@ -65,6 +65,8 @@ class ABIViewManager : public ::Microsoft::ReactNative::FrameworkElementViewMana
|
|
|
65
65
|
return m_viewManagerRequiresNativeLayout != nullptr && m_viewManagerRequiresNativeLayout.RequiresNativeLayout();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
void OnPointerEvent(::Microsoft::ReactNative::ShadowNodeBase *node, const ReactPointerEventArgs &args) override;
|
|
69
|
+
|
|
68
70
|
protected:
|
|
69
71
|
xaml::DependencyObject CreateViewCore(int64_t, const winrt::Microsoft::ReactNative::JSValueObject &props) override;
|
|
70
72
|
|
|
@@ -77,6 +79,7 @@ class ABIViewManager : public ::Microsoft::ReactNative::FrameworkElementViewMana
|
|
|
77
79
|
IViewManagerWithExportedEventTypeConstants m_viewManagerWithExportedEventTypeConstants;
|
|
78
80
|
IViewManagerWithChildren m_viewManagerWithChildren;
|
|
79
81
|
IViewManagerRequiresNativeLayout m_viewManagerRequiresNativeLayout;
|
|
82
|
+
IViewManagerWithPointerEvents m_viewManagerWithPointerEvents;
|
|
80
83
|
|
|
81
84
|
winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, ViewManagerPropertyType> m_nativeProps;
|
|
82
85
|
};
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
#include <Modules/AppearanceModule.h>
|
|
12
12
|
#include <Modules/AsyncStorageModuleWin32.h>
|
|
13
13
|
#include <Modules/ClipboardModule.h>
|
|
14
|
-
#include <Modules/ImageViewManagerModule.h>
|
|
15
14
|
#include <Modules/LinkingManagerModule.h>
|
|
16
15
|
#include <Modules/NativeUIManager.h>
|
|
17
16
|
#include <Modules/NetworkingModule.h>
|
|
@@ -63,11 +62,6 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
|
|
|
63
62
|
modules.emplace_back(
|
|
64
63
|
LinkingManagerModule::name, []() { return std::make_unique<LinkingManagerModule>(); }, batchingUIMessageQueue);
|
|
65
64
|
|
|
66
|
-
modules.emplace_back(
|
|
67
|
-
ImageViewManagerModule::name,
|
|
68
|
-
[]() { return std::make_unique<ImageViewManagerModule>(); },
|
|
69
|
-
batchingUIMessageQueue);
|
|
70
|
-
|
|
71
65
|
modules.emplace_back(
|
|
72
66
|
AppThemeModule::Name,
|
|
73
67
|
[appTheme = std::move(appTheme)]() mutable { return std::make_unique<AppThemeModule>(std::move(appTheme)); },
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
#include "IReactDispatcher.h"
|
|
6
6
|
#include "ReactDispatcherHelper.g.cpp"
|
|
7
7
|
|
|
8
|
+
#include <glog/logging.h>
|
|
9
|
+
|
|
8
10
|
using namespace winrt;
|
|
9
11
|
using namespace Windows::Foundation;
|
|
10
12
|
|
|
@@ -37,8 +39,21 @@ bool ReactDispatcher::HasThreadAccess() noexcept {
|
|
|
37
39
|
return m_queue.HasThreadAccess();
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
ReactDispatcherCallback CreateLoggingCallback(ReactDispatcherCallback const &callback) {
|
|
43
|
+
return [callback]() {
|
|
44
|
+
try {
|
|
45
|
+
callback();
|
|
46
|
+
} catch (winrt::hresult_error const &error) {
|
|
47
|
+
std::stringstream errorCode;
|
|
48
|
+
errorCode << "0x" << std::hex << error.code();
|
|
49
|
+
LOG(ERROR) << "HRESULT " << errorCode.str() << ": " << winrt::to_string(error.message());
|
|
50
|
+
throw;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
void ReactDispatcher::Post(ReactDispatcherCallback const &callback) noexcept {
|
|
41
|
-
return m_queue.Post([callback]() noexcept { callback(); });
|
|
56
|
+
return m_queue.Post([callback = CreateLoggingCallback(callback)]() noexcept { callback(); });
|
|
42
57
|
}
|
|
43
58
|
|
|
44
59
|
void ReactDispatcher::Post(Mso::DispatchTask &&task) const noexcept {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import "IViewManagerCore.idl";
|
|
5
|
+
import "ReactPointerEventArgs.idl";
|
|
5
6
|
|
|
6
7
|
#include "NamespaceRedirect.h"
|
|
7
8
|
#include "DocString.h"
|
|
@@ -63,4 +64,28 @@ namespace Microsoft.ReactNative
|
|
|
63
64
|
interface IViewManagerCreateWithProperties {
|
|
64
65
|
Object CreateViewWithProperties(IJSValueReader propertyMapReader);
|
|
65
66
|
};
|
|
67
|
+
|
|
68
|
+
[experimental]
|
|
69
|
+
[webhosthidden]
|
|
70
|
+
DOC_STRING(
|
|
71
|
+
"Experimental interface enabling view managers to release pointer capture "
|
|
72
|
+
"from the React root view and start handling pointer events itself."
|
|
73
|
+
)
|
|
74
|
+
interface IViewManagerWithPointerEvents {
|
|
75
|
+
DOC_STRING(
|
|
76
|
+
"When pointer events are received on the React root view, the top-level "
|
|
77
|
+
"pointer event handler invokes this callback for each React view "
|
|
78
|
+
"ancestor of the @Windows.UI.Xaml.RoutedEventArgs.OriginalSource "
|
|
79
|
+
"element with a view manager that implements "
|
|
80
|
+
"@IViewManagerWithPointerEvents to allow the view manager to modify "
|
|
81
|
+
"handling for the pointer event. This can be used to refine the target "
|
|
82
|
+
"view. E.g., setting the @ReactPointerEventArgs.Target property to null "
|
|
83
|
+
"will force the React root view to choose one of the view's ancestors "
|
|
84
|
+
"as the hit target. Alternatively, the view manager may also set the "
|
|
85
|
+
"@ReactPointerEventArgs.Target to any descendent of provided view to "
|
|
86
|
+
"enable hit testing on views that do not derive from "
|
|
87
|
+
"@Windows.UI.Xaml.UIElement."
|
|
88
|
+
)
|
|
89
|
+
void OnPointerEvent(Object view, ReactPointerEventArgs args);
|
|
90
|
+
};
|
|
66
91
|
} // namespace Microsoft.ReactNative
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
<Import Project="$(SolutionDir)\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props" Condition="Exists('$(SolutionDir)\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" />
|
|
27
27
|
<Import Project="$(SolutionDir)\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props" Condition="Exists('$(SolutionDir)\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" />
|
|
28
28
|
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
|
|
29
|
+
<Import Project="$(ReactNativeWindowsDir)PropertySheets\Generated\PackageVersion.g.props" />
|
|
30
|
+
<Import Project="$(ReactNativeWindowsDir)PropertySheets\PackageVersionDefinitions.props" />
|
|
29
31
|
<ItemGroup Label="ProjectConfigurations">
|
|
30
32
|
<ProjectConfiguration Include="Debug|ARM64">
|
|
31
33
|
<Configuration>Debug</Configuration>
|
|
@@ -89,7 +91,7 @@
|
|
|
89
91
|
<ItemDefinitionGroup>
|
|
90
92
|
<ClCompile>
|
|
91
93
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
92
|
-
<RuntimeTypeInfo Condition="'$(UseFabric)' == 'true'">true</RuntimeTypeInfo>
|
|
94
|
+
<RuntimeTypeInfo Condition="'$(UseFabric)' == 'true' AND '$(Configuration)'=='Debug'">true</RuntimeTypeInfo>
|
|
93
95
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
94
96
|
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
|
95
97
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
|
@@ -344,6 +346,16 @@
|
|
|
344
346
|
<ClInclude Include="Views\SwitchViewManager.h" />
|
|
345
347
|
<ClInclude Include="Views\TextInputViewManager.h" />
|
|
346
348
|
<ClInclude Include="Views\TextViewManager.h" />
|
|
349
|
+
<ClInclude Include="Views\Text\TextHighlighterVisitor.h" />
|
|
350
|
+
<ClInclude Include="Views\Text\TextHitTestUtils.h" />
|
|
351
|
+
<ClInclude Include="Views\Text\TextHitTestVisitor.h" />
|
|
352
|
+
<ClInclude Include="Views\Text\TextParentVisitor.h" />
|
|
353
|
+
<ClInclude Include="Views\Text\TextPropertyChangedParentVisitor.h" />
|
|
354
|
+
<ClInclude Include="Views\Text\TextTransformParentVisitor.h" />
|
|
355
|
+
<ClInclude Include="Views\Text\TextTransformVisitor.h" />
|
|
356
|
+
<ClInclude Include="Views\Text\TextVisitorScope.h" />
|
|
357
|
+
<ClInclude Include="Views\Text\TextVisitor.h" />
|
|
358
|
+
<ClInclude Include="Views\Text\TextVisitors.h" />
|
|
347
359
|
<ClInclude Include="Views\TouchEventHandler.h" />
|
|
348
360
|
<ClInclude Include="Views\ViewControl.h" />
|
|
349
361
|
<ClInclude Include="Views\ViewManager.h" />
|
|
@@ -381,6 +393,10 @@
|
|
|
381
393
|
<SubType>Code</SubType>
|
|
382
394
|
</ClInclude>
|
|
383
395
|
<ClInclude Include="XamlView.h" />
|
|
396
|
+
<ClInclude Include="ReactPointerEventArgs.h">
|
|
397
|
+
<DependentUpon>ReactPointerEventArgs.idl</DependentUpon>
|
|
398
|
+
<SubType>Code</SubType>
|
|
399
|
+
</ClInclude>
|
|
384
400
|
</ItemGroup>
|
|
385
401
|
<ItemGroup Condition="'$(UseFabric)' == 'true'">
|
|
386
402
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\react\config\ReactNativeConfig.cpp" />
|
|
@@ -567,6 +583,10 @@
|
|
|
567
583
|
<ClCompile Include="Modules\TimingModule.cpp" />
|
|
568
584
|
<ClCompile Include="Modules\PaperUIManagerModule.cpp" />
|
|
569
585
|
<ClCompile Include="NativeModulesProvider.cpp" />
|
|
586
|
+
<ClCompile Include="ReactPointerEventArgs.cpp">
|
|
587
|
+
<DependentUpon>ReactPointerEventArgs.idl</DependentUpon>
|
|
588
|
+
<SubType>Code</SubType>
|
|
589
|
+
</ClCompile>
|
|
570
590
|
<ClCompile Include="RedBoxErrorInfo.cpp" />
|
|
571
591
|
<ClCompile Include="RedBoxErrorFrameInfo.cpp" />
|
|
572
592
|
<ClCompile Include="TurboModulesProvider.cpp" />
|
|
@@ -646,6 +666,14 @@
|
|
|
646
666
|
<ClCompile Include="Views\SwitchViewManager.cpp" />
|
|
647
667
|
<ClCompile Include="Views\TextInputViewManager.cpp" />
|
|
648
668
|
<ClCompile Include="Views\TextViewManager.cpp" />
|
|
669
|
+
<ClCompile Include="Views\Text\TextHighlighterVisitor.cpp" />
|
|
670
|
+
<ClCompile Include="Views\Text\TextHitTestUtils.cpp" />
|
|
671
|
+
<ClCompile Include="Views\Text\TextHitTestVisitor.cpp" />
|
|
672
|
+
<ClCompile Include="Views\Text\TextParentVisitor.cpp" />
|
|
673
|
+
<ClCompile Include="Views\Text\TextPropertyChangedParentVisitor.cpp" />
|
|
674
|
+
<ClCompile Include="Views\Text\TextTransformParentVisitor.cpp" />
|
|
675
|
+
<ClCompile Include="Views\Text\TextTransformVisitor.cpp" />
|
|
676
|
+
<ClCompile Include="Views\Text\TextVisitor.cpp" />
|
|
649
677
|
<ClCompile Include="Views\TouchEventHandler.cpp" />
|
|
650
678
|
<ClCompile Include="Views\ViewControl.cpp" />
|
|
651
679
|
<ClCompile Include="Views\ViewManagerBase.cpp" />
|
|
@@ -732,6 +760,7 @@
|
|
|
732
760
|
<SubType>Designer</SubType>
|
|
733
761
|
</Midl>
|
|
734
762
|
<Midl Include="XamlHelper.idl" />
|
|
763
|
+
<Midl Include="ReactPointerEventArgs.idl" />
|
|
735
764
|
</ItemGroup>
|
|
736
765
|
<ItemGroup>
|
|
737
766
|
<None Include="packages.config" />
|
|
@@ -745,11 +774,11 @@
|
|
|
745
774
|
</ItemGroup>
|
|
746
775
|
<ItemGroup>
|
|
747
776
|
<ResourceCompile Include="Version.rc">
|
|
748
|
-
<PreprocessorDefinitions
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
777
|
+
<PreprocessorDefinitions>
|
|
778
|
+
RNW_VERSION=$(ReactNativeWindowsVersion);
|
|
779
|
+
RNW_MAJOR=$(ReactNativeWindowsMajor);
|
|
780
|
+
RNW_MINOR=$(ReactNativeWindowsMinor);
|
|
781
|
+
RNW_PATCH=$(ReactNativeWindowsPatch);
|
|
753
782
|
_UNICODE;
|
|
754
783
|
UNICODE;
|
|
755
784
|
%(PreprocessorDefinitions)
|
|
@@ -309,6 +309,31 @@
|
|
|
309
309
|
<ClCompile Include="ReactHost\JSCallInvokerScheduler.cpp">
|
|
310
310
|
<Filter>ReactHost</Filter>
|
|
311
311
|
</ClCompile>
|
|
312
|
+
<ClCompile Include="Views\Text\TextHighlighterVisitor.cpp">
|
|
313
|
+
<Filter>Views\Text</Filter>
|
|
314
|
+
</ClCompile>
|
|
315
|
+
<ClCompile Include="Views\Text\TextHitTestUtils.cpp">
|
|
316
|
+
<Filter>Views\Text</Filter>
|
|
317
|
+
</ClCompile>
|
|
318
|
+
<ClCompile Include="Views\Text\TextHitTestVisitor.cpp">
|
|
319
|
+
<Filter>Views\Text</Filter>
|
|
320
|
+
</ClCompile>
|
|
321
|
+
<ClCompile Include="Views\Text\TextParentVisitor.cpp">
|
|
322
|
+
<Filter>Views\Text</Filter>
|
|
323
|
+
</ClCompile>
|
|
324
|
+
<ClCompile Include="Views\Text\TextPropertyChangedParentVisitor.cpp">
|
|
325
|
+
<Filter>Views\Text</Filter>
|
|
326
|
+
</ClCompile>
|
|
327
|
+
<ClCompile Include="Views\Text\TextTransformParentVisitor.cpp">
|
|
328
|
+
<Filter>Views\Text</Filter>
|
|
329
|
+
</ClCompile>
|
|
330
|
+
<ClCompile Include="Views\Text\TextTransformVisitor.cpp">
|
|
331
|
+
<Filter>Views\Text</Filter>
|
|
332
|
+
</ClCompile>
|
|
333
|
+
<ClCompile Include="Views\Text\TextVisitor.cpp">
|
|
334
|
+
<Filter>Views\Text</Filter>
|
|
335
|
+
</ClCompile>
|
|
336
|
+
<ClCompile Include="ReactPointerEventArgs.cpp" />
|
|
312
337
|
</ItemGroup>
|
|
313
338
|
<ItemGroup>
|
|
314
339
|
<ClInclude Include="ABICxxModule.h" />
|
|
@@ -672,6 +697,37 @@
|
|
|
672
697
|
<ClInclude Include="Utils\ShadowNodeTypeUtils.h">
|
|
673
698
|
<Filter>Utils</Filter>
|
|
674
699
|
</ClInclude>
|
|
700
|
+
<ClInclude Include="Views\Text\TextHighlighterVisitor.h">
|
|
701
|
+
<Filter>Views\Text</Filter>
|
|
702
|
+
</ClInclude>
|
|
703
|
+
<ClInclude Include="Views\Text\TextHitTestVisitor.h">
|
|
704
|
+
<Filter>Views\Text</Filter>
|
|
705
|
+
</ClInclude>
|
|
706
|
+
<ClInclude Include="Views\Text\TextHitTestUtils.h">
|
|
707
|
+
<Filter>Views\Text</Filter>
|
|
708
|
+
</ClInclude>
|
|
709
|
+
<ClInclude Include="Views\Text\TextParentVisitor.h">
|
|
710
|
+
<Filter>Views\Text</Filter>
|
|
711
|
+
</ClInclude>
|
|
712
|
+
<ClInclude Include="Views\Text\TextPropertyChangedParentVisitor.h">
|
|
713
|
+
<Filter>Views\Text</Filter>
|
|
714
|
+
</ClInclude>
|
|
715
|
+
<ClInclude Include="Views\Text\TextTransformParentVisitor.h">
|
|
716
|
+
<Filter>Views\Text</Filter>
|
|
717
|
+
</ClInclude>
|
|
718
|
+
<ClInclude Include="Views\Text\TextTransformVisitor.h">
|
|
719
|
+
<Filter>Views\Text</Filter>
|
|
720
|
+
</ClInclude>
|
|
721
|
+
<ClInclude Include="Views\Text\TextVisitorScope.h">
|
|
722
|
+
<Filter>Views\Text</Filter>
|
|
723
|
+
</ClInclude>
|
|
724
|
+
<ClInclude Include="Views\Text\TextVisitor.h">
|
|
725
|
+
<Filter>Views\Text</Filter>
|
|
726
|
+
</ClInclude>
|
|
727
|
+
<ClInclude Include="Views\Text\TextVisitors.h">
|
|
728
|
+
<Filter>Views\Text</Filter>
|
|
729
|
+
</ClInclude>
|
|
730
|
+
<ClInclude Include="ReactPointerEventArgs.h" />
|
|
675
731
|
</ItemGroup>
|
|
676
732
|
<ItemGroup>
|
|
677
733
|
<Midl Include="IJSValueReader.idl" />
|
|
@@ -709,6 +765,7 @@
|
|
|
709
765
|
<Midl Include="JsiApi.idl" />
|
|
710
766
|
<Midl Include="DocString.idl" />
|
|
711
767
|
<Midl Include="DesktopWindowMessage.idl" />
|
|
768
|
+
<Midl Include="ReactPointerEventArgs.idl" />
|
|
712
769
|
</ItemGroup>
|
|
713
770
|
<ItemGroup>
|
|
714
771
|
<None Include="microsoft.reactnative.def" />
|
|
@@ -755,6 +812,9 @@
|
|
|
755
812
|
<Filter Include="JSI">
|
|
756
813
|
<UniqueIdentifier>{24290499-e864-407e-89c0-473f2b8dbb6e}</UniqueIdentifier>
|
|
757
814
|
</Filter>
|
|
815
|
+
<Filter Include="Views\Text">
|
|
816
|
+
<UniqueIdentifier>{8b871c42-6131-44c2-a73f-f1061780e97f}</UniqueIdentifier>
|
|
817
|
+
</Filter>
|
|
758
818
|
</ItemGroup>
|
|
759
819
|
<ItemGroup>
|
|
760
820
|
<ResourceCompile Include="Version.rc" />
|
|
@@ -19,7 +19,7 @@ void AccessibilityInfo::Initialize(winrt::Microsoft::ReactNative::ReactContext c
|
|
|
19
19
|
m_context = reactContext;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
void AccessibilityInfo::isReduceMotionEnabled(std::function<void(
|
|
22
|
+
void AccessibilityInfo::isReduceMotionEnabled(std::function<void(bool)> const &onSuccess) noexcept {
|
|
23
23
|
auto jsDispatcher = m_context.JSDispatcher();
|
|
24
24
|
m_context.UIDispatcher().Post([weakThis = weak_from_this(), jsDispatcher, onSuccess] {
|
|
25
25
|
if (auto strongThis = weakThis.lock()) {
|
|
@@ -30,8 +30,7 @@ void AccessibilityInfo::isReduceMotionEnabled(std::function<void(React::JSValue
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
void AccessibilityInfo::isTouchExplorationEnabled(
|
|
34
|
-
std::function<void(React::JSValue const &)> const &onSuccess) noexcept {
|
|
33
|
+
void AccessibilityInfo::isTouchExplorationEnabled(std::function<void(bool)> const &onSuccess) noexcept {
|
|
35
34
|
onSuccess(UiaClientsAreListening());
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -73,7 +72,7 @@ void AccessibilityInfo::announceForAccessibility(std::string announcement) noexc
|
|
|
73
72
|
|
|
74
73
|
void AccessibilityInfo::getRecommendedTimeoutMillis(
|
|
75
74
|
double mSec,
|
|
76
|
-
std::function<void(
|
|
75
|
+
std::function<void(double)> const &onSuccess) noexcept {
|
|
77
76
|
onSuccess(mSec);
|
|
78
77
|
}
|
|
79
78
|
|
|
@@ -12,10 +12,10 @@ struct AccessibilityInfo : public std::enable_shared_from_this<AccessibilityInfo
|
|
|
12
12
|
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
13
13
|
|
|
14
14
|
REACT_METHOD(isReduceMotionEnabled)
|
|
15
|
-
void isReduceMotionEnabled(std::function<void(
|
|
15
|
+
void isReduceMotionEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
16
16
|
|
|
17
17
|
REACT_METHOD(isTouchExplorationEnabled)
|
|
18
|
-
void isTouchExplorationEnabled(std::function<void(
|
|
18
|
+
void isTouchExplorationEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
19
19
|
|
|
20
20
|
REACT_METHOD(setAccessibilityFocus)
|
|
21
21
|
void setAccessibilityFocus(double reactTag) noexcept;
|
|
@@ -24,7 +24,7 @@ struct AccessibilityInfo : public std::enable_shared_from_this<AccessibilityInfo
|
|
|
24
24
|
void announceForAccessibility(std::string announcement) noexcept;
|
|
25
25
|
|
|
26
26
|
REACT_METHOD(getRecommendedTimeoutMillis)
|
|
27
|
-
void getRecommendedTimeoutMillis(double mSec, std::function<void(
|
|
27
|
+
void getRecommendedTimeoutMillis(double mSec, std::function<void(double)> const &onSuccess) noexcept;
|
|
28
28
|
|
|
29
29
|
private:
|
|
30
30
|
React::ReactContext m_context;
|
|
@@ -15,10 +15,13 @@
|
|
|
15
15
|
|
|
16
16
|
namespace Microsoft::ReactNative {
|
|
17
17
|
|
|
18
|
-
void Alert::showAlert(
|
|
19
|
-
|
|
18
|
+
void Alert::showAlert(
|
|
19
|
+
DialogOptions &&args,
|
|
20
|
+
std::function<void(std::string)> /*error*/,
|
|
21
|
+
std::function<void(std::string, int)> result) noexcept {
|
|
22
|
+
m_context.UIDispatcher().Post([weakThis = weak_from_this(), args = std::move(args), result]() mutable {
|
|
20
23
|
if (auto strongThis = weakThis.lock()) {
|
|
21
|
-
strongThis->pendingAlerts.
|
|
24
|
+
strongThis->pendingAlerts.emplace(std::move(args), result);
|
|
22
25
|
if (strongThis->pendingAlerts.size() == 1) {
|
|
23
26
|
strongThis->ProcessPendingAlertRequests();
|
|
24
27
|
}
|
|
@@ -29,22 +32,37 @@ void Alert::showAlert(ShowAlertArgs const &args, std::function<void(std::string)
|
|
|
29
32
|
void Alert::ProcessPendingAlertRequests() noexcept {
|
|
30
33
|
if (pendingAlerts.empty())
|
|
31
34
|
return;
|
|
32
|
-
const auto &
|
|
35
|
+
const auto &pendingAlert = pendingAlerts.front();
|
|
36
|
+
const auto &args = pendingAlert.args;
|
|
37
|
+
const auto &result = pendingAlert.result;
|
|
33
38
|
auto jsDispatcher = m_context.JSDispatcher();
|
|
34
39
|
|
|
35
40
|
xaml::Controls::ContentDialog dialog{};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
xaml::Controls::TextBlock titleTextBlock;
|
|
42
|
+
xaml::Controls::TextBlock messageTextBlock;
|
|
43
|
+
titleTextBlock.Text(Microsoft::Common::Unicode::Utf8ToUtf16(args.title.value_or(std::string{})));
|
|
44
|
+
titleTextBlock.IsTextSelectionEnabled(true);
|
|
45
|
+
titleTextBlock.MaxLines(2);
|
|
46
|
+
titleTextBlock.TextWrapping(xaml::TextWrapping::Wrap);
|
|
47
|
+
messageTextBlock.Text(Microsoft::Common::Unicode::Utf8ToUtf16(args.message.value_or(std::string{})));
|
|
48
|
+
messageTextBlock.IsTextSelectionEnabled(true);
|
|
49
|
+
messageTextBlock.TextWrapping(xaml::TextWrapping::Wrap);
|
|
50
|
+
dialog.Title(titleTextBlock);
|
|
51
|
+
dialog.Content(messageTextBlock);
|
|
52
|
+
dialog.PrimaryButtonText(Microsoft::Common::Unicode::Utf8ToUtf16(args.buttonPositive.value_or(std::string{})));
|
|
53
|
+
dialog.SecondaryButtonText(Microsoft::Common::Unicode::Utf8ToUtf16(args.buttonNegative.value_or(std::string{})));
|
|
54
|
+
dialog.CloseButtonText(Microsoft::Common::Unicode::Utf8ToUtf16(args.buttonNeutral.value_or(std::string{})));
|
|
55
|
+
int defaultButton = args.defaultButton.value_or(0);
|
|
56
|
+
if (defaultButton >= 0 && defaultButton <= 3) {
|
|
57
|
+
dialog.DefaultButton(static_cast<xaml::Controls::ContentDialogButton>(defaultButton));
|
|
43
58
|
}
|
|
44
59
|
|
|
60
|
+
auto useXamlRootForThemeBugWorkaround = false;
|
|
61
|
+
|
|
45
62
|
if (Is19H1OrHigher()) {
|
|
46
63
|
// XamlRoot added in 19H1
|
|
47
64
|
if (const auto xamlRoot = React::XamlUIService::GetXamlRoot(m_context.Properties().Handle())) {
|
|
65
|
+
useXamlRootForThemeBugWorkaround = true;
|
|
48
66
|
dialog.XamlRoot(xamlRoot);
|
|
49
67
|
auto rootChangedToken = xamlRoot.Changed([=](auto &&, auto &&) {
|
|
50
68
|
const auto rootSize = xamlRoot.Size();
|
|
@@ -70,19 +88,35 @@ void Alert::ProcessPendingAlertRequests() noexcept {
|
|
|
70
88
|
}
|
|
71
89
|
}
|
|
72
90
|
|
|
91
|
+
// Workaround XAML bug with ContentDialog and dark theme:
|
|
92
|
+
// https://github.com/microsoft/microsoft-ui-xaml/issues/2331
|
|
93
|
+
dialog.Opened([useXamlRootForThemeBugWorkaround](winrt::IInspectable const &sender, auto &&) {
|
|
94
|
+
auto contentDialog = sender.as<xaml::Controls::ContentDialog>();
|
|
95
|
+
auto popups = xaml::Media::VisualTreeHelper::GetOpenPopupsForXamlRoot(contentDialog.XamlRoot());
|
|
96
|
+
|
|
97
|
+
auto contentAsFrameworkElement = useXamlRootForThemeBugWorkaround
|
|
98
|
+
? contentDialog.XamlRoot().Content().try_as<xaml::FrameworkElement>()
|
|
99
|
+
: xaml::Window::Current().Content().try_as<xaml::FrameworkElement>();
|
|
100
|
+
if (contentAsFrameworkElement) {
|
|
101
|
+
for (uint32_t i = 0; i < popups.Size(); i++) {
|
|
102
|
+
popups.GetAt(i).RequestedTheme(contentAsFrameworkElement.ActualTheme());
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
73
107
|
auto asyncOp = dialog.ShowAsync();
|
|
74
108
|
asyncOp.Completed(
|
|
75
109
|
[jsDispatcher, result, this](
|
|
76
110
|
const winrt::IAsyncOperation<xaml::Controls::ContentDialogResult> &asyncOp, winrt::AsyncStatus status) {
|
|
77
111
|
switch (asyncOp.GetResults()) {
|
|
78
112
|
case xaml::Controls::ContentDialogResult::Primary:
|
|
79
|
-
jsDispatcher.Post([result] { result(
|
|
113
|
+
jsDispatcher.Post([result, this] { result(m_constants.buttonClicked, m_constants.buttonPositive); });
|
|
80
114
|
break;
|
|
81
115
|
case xaml::Controls::ContentDialogResult::Secondary:
|
|
82
|
-
jsDispatcher.Post([result] { result(
|
|
116
|
+
jsDispatcher.Post([result, this] { result(m_constants.buttonClicked, m_constants.buttonNegative); });
|
|
83
117
|
break;
|
|
84
118
|
case xaml::Controls::ContentDialogResult::None:
|
|
85
|
-
jsDispatcher.Post([result] { result(
|
|
119
|
+
jsDispatcher.Post([result, this] { result(m_constants.buttonClicked, m_constants.buttonNeutral); });
|
|
86
120
|
break;
|
|
87
121
|
default:
|
|
88
122
|
break;
|
|
@@ -92,8 +126,17 @@ void Alert::ProcessPendingAlertRequests() noexcept {
|
|
|
92
126
|
});
|
|
93
127
|
}
|
|
94
128
|
|
|
129
|
+
Alert::Constants Alert::GetConstants() noexcept {
|
|
130
|
+
return m_constants;
|
|
131
|
+
}
|
|
132
|
+
|
|
95
133
|
void Alert::Initialize(React::ReactContext const &reactContext) noexcept {
|
|
96
134
|
m_context = reactContext;
|
|
135
|
+
m_constants.buttonClicked = "buttonClicked";
|
|
136
|
+
m_constants.dismissed = "dismissed";
|
|
137
|
+
m_constants.buttonPositive = -1;
|
|
138
|
+
m_constants.buttonNegative = -2;
|
|
139
|
+
m_constants.buttonNeutral = -3;
|
|
97
140
|
}
|
|
98
141
|
|
|
99
142
|
} // namespace Microsoft::ReactNative
|