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
|
@@ -8,17 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
#include "ImageViewManager.h"
|
|
10
10
|
|
|
11
|
+
#include <UI.Xaml.Automation.h>
|
|
11
12
|
#include <winrt/Windows.Foundation.h>
|
|
12
13
|
|
|
13
14
|
#include <IReactInstance.h>
|
|
14
15
|
#include <Utils/PropertyHandlerUtils.h>
|
|
15
16
|
#include <Utils/PropertyUtils.h>
|
|
16
17
|
#include <Views/ShadowNodeBase.h>
|
|
18
|
+
#include "DynamicAutomationProperties.h"
|
|
17
19
|
#include "ReactImage.h"
|
|
18
20
|
|
|
19
21
|
namespace winrt {
|
|
20
22
|
using namespace Windows::Foundation;
|
|
21
23
|
using namespace xaml::Controls;
|
|
24
|
+
using namespace xaml::Automation::Peers;
|
|
22
25
|
} // namespace winrt
|
|
23
26
|
|
|
24
27
|
// Such code is better to move to a seperate parser layer
|
|
@@ -79,6 +82,12 @@ class ImageShadowNode : public ShadowNodeBase {
|
|
|
79
82
|
ShadowNodeBase::createView(props);
|
|
80
83
|
auto reactImage{m_view.as<ReactImage>()};
|
|
81
84
|
|
|
85
|
+
// Image should default to "accessible: false", but this is not done on the JS level
|
|
86
|
+
// https://reactnative.dev/docs/image#accessible
|
|
87
|
+
xaml::Automation::AutomationProperties::SetAccessibilityView(*reactImage, winrt::AccessibilityView::Raw);
|
|
88
|
+
DynamicAutomationProperties::SetAccessibilityRole(
|
|
89
|
+
*reactImage, winrt::Microsoft::ReactNative::AccessibilityRoles::Image);
|
|
90
|
+
|
|
82
91
|
m_onLoadEndToken = reactImage->OnLoadEnd([imageViewManager{static_cast<ImageViewManager *>(GetViewManager())},
|
|
83
92
|
reactImage](const auto &, const bool &succeeded) {
|
|
84
93
|
ReactImageSource source{reactImage->Source()};
|
|
@@ -116,9 +125,7 @@ bool ImageViewManager::UpdateProperty(
|
|
|
116
125
|
const std::string &propertyName,
|
|
117
126
|
const winrt::Microsoft::ReactNative::JSValue &propertyValue) {
|
|
118
127
|
auto grid{nodeToUpdate->GetView().as<winrt::Grid>()};
|
|
119
|
-
|
|
120
|
-
if (grid == nullptr)
|
|
121
|
-
return true;
|
|
128
|
+
auto reactImage{grid.as<ReactImage>()};
|
|
122
129
|
|
|
123
130
|
bool finalizeBorderRadius{false};
|
|
124
131
|
bool ret = true;
|
|
@@ -127,21 +134,24 @@ bool ImageViewManager::UpdateProperty(
|
|
|
127
134
|
setSource(grid, propertyValue);
|
|
128
135
|
} else if (propertyName == "resizeMode") {
|
|
129
136
|
auto resizeMode{json_type_traits<facebook::react::ImageResizeMode>::parseJson(propertyValue)};
|
|
130
|
-
auto reactImage{grid.as<ReactImage>()};
|
|
131
137
|
reactImage->ResizeMode(resizeMode);
|
|
132
138
|
} else if (
|
|
133
139
|
propertyName == "blurRadius" &&
|
|
134
140
|
(propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Double ||
|
|
135
141
|
propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Int64)) {
|
|
136
|
-
auto reactImage{grid.as<ReactImage>()};
|
|
137
142
|
reactImage->BlurRadius(propertyValue.AsSingle());
|
|
138
143
|
} else if (propertyName == "tintColor") {
|
|
139
144
|
const auto isValidColorValue = IsValidColorValue(propertyValue);
|
|
140
145
|
if (isValidColorValue || propertyValue.IsNull()) {
|
|
141
|
-
auto reactImage{grid.as<ReactImage>()};
|
|
142
146
|
const auto color = isValidColorValue ? ColorFrom(propertyValue) : winrt::Colors::Transparent();
|
|
143
147
|
reactImage->TintColor(color);
|
|
144
148
|
}
|
|
149
|
+
// Override default accessibility behavior
|
|
150
|
+
} else if (propertyName == "accessible" && propertyValue.IsNull()) {
|
|
151
|
+
xaml::Automation::AutomationProperties::SetAccessibilityView(*reactImage, winrt::AccessibilityView::Raw);
|
|
152
|
+
} else if (propertyName == "accessibilityRole" && propertyValue.IsNull()) {
|
|
153
|
+
DynamicAutomationProperties::SetAccessibilityRole(
|
|
154
|
+
*reactImage, winrt::Microsoft::ReactNative::AccessibilityRoles::Image);
|
|
145
155
|
} else if (TryUpdateCornerRadiusOnNode(nodeToUpdate, grid, propertyName, propertyValue)) {
|
|
146
156
|
finalizeBorderRadius = true;
|
|
147
157
|
} else if (TryUpdateBorderProperties(nodeToUpdate, grid, propertyName, propertyValue)) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include <winrt/Windows.Web.Http.h>
|
|
14
14
|
|
|
15
15
|
#include <Utils/ValueUtils.h>
|
|
16
|
+
#include "DynamicAutomationPeer.h"
|
|
16
17
|
#include "Unicode.h"
|
|
17
18
|
#include "XamlView.h"
|
|
18
19
|
#include "cdebug.h"
|
|
@@ -25,6 +26,7 @@ using namespace xaml;
|
|
|
25
26
|
using namespace xaml::Media;
|
|
26
27
|
using namespace xaml::Media::Imaging;
|
|
27
28
|
using namespace Windows::Web::Http;
|
|
29
|
+
using namespace xaml::Automation::Peers;
|
|
28
30
|
} // namespace winrt
|
|
29
31
|
|
|
30
32
|
using Microsoft::Common::Unicode::Utf8ToUtf16;
|
|
@@ -44,6 +46,8 @@ winrt::Size ReactImage::ArrangeOverride(winrt::Size finalSize) {
|
|
|
44
46
|
if (auto brush{Background().try_as<ReactImageBrush>()}) {
|
|
45
47
|
brush->AvailableSize(finalSize);
|
|
46
48
|
}
|
|
49
|
+
} else if (auto brush{Background().try_as<winrt::ImageBrush>()}) {
|
|
50
|
+
brush.Stretch(ResizeModeToStretch(finalSize));
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
return finalSize;
|
|
@@ -57,6 +61,10 @@ void ReactImage::OnLoadEnd(winrt::event_token const &token) noexcept {
|
|
|
57
61
|
m_onLoadEndEvent.remove(token);
|
|
58
62
|
}
|
|
59
63
|
|
|
64
|
+
winrt::AutomationPeer ReactImage::OnCreateAutomationPeer() {
|
|
65
|
+
return winrt::make<winrt::Microsoft::ReactNative::implementation::DynamicAutomationPeer>(*this);
|
|
66
|
+
}
|
|
67
|
+
|
|
60
68
|
void ReactImage::ResizeMode(facebook::react::ImageResizeMode value) {
|
|
61
69
|
if (m_resizeMode != value) {
|
|
62
70
|
m_resizeMode = value;
|
|
@@ -71,7 +79,7 @@ void ReactImage::ResizeMode(facebook::react::ImageResizeMode value) {
|
|
|
71
79
|
} else if (auto brush{Background().try_as<ReactImageBrush>()}) {
|
|
72
80
|
brush->ResizeMode(value);
|
|
73
81
|
} else if (auto bitmapBrush{Background().as<winrt::ImageBrush>()}) {
|
|
74
|
-
bitmapBrush.Stretch(ResizeModeToStretch(
|
|
82
|
+
bitmapBrush.Stretch(ResizeModeToStretch());
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
}
|
|
@@ -112,8 +120,12 @@ void ReactImage::TintColor(winrt::Color value) {
|
|
|
112
120
|
}
|
|
113
121
|
}
|
|
114
122
|
|
|
115
|
-
winrt::Stretch ReactImage::ResizeModeToStretch(
|
|
116
|
-
|
|
123
|
+
winrt::Stretch ReactImage::ResizeModeToStretch() {
|
|
124
|
+
return ResizeModeToStretch({static_cast<float>(ActualWidth()), static_cast<float>(ActualHeight())});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
winrt::Stretch ReactImage::ResizeModeToStretch(winrt::Size size) {
|
|
128
|
+
switch (m_resizeMode) {
|
|
117
129
|
case facebook::react::ImageResizeMode::Cover:
|
|
118
130
|
return winrt::Stretch::UniformToFill;
|
|
119
131
|
case facebook::react::ImageResizeMode::Stretch:
|
|
@@ -121,7 +133,7 @@ winrt::Stretch ReactImage::ResizeModeToStretch(facebook::react::ImageResizeMode
|
|
|
121
133
|
case facebook::react::ImageResizeMode::Contain:
|
|
122
134
|
return winrt::Stretch::Uniform;
|
|
123
135
|
default: // ResizeMode::Center || ResizeMode::Repeat
|
|
124
|
-
if (m_imageSource.height <
|
|
136
|
+
if (m_imageSource.height < size.Height && m_imageSource.width < size.Width) {
|
|
125
137
|
return winrt::Stretch::None;
|
|
126
138
|
} else {
|
|
127
139
|
return winrt::Stretch::Uniform;
|
|
@@ -300,13 +312,7 @@ winrt::fire_and_forget ReactImage::SetBackground(bool fireLoadEndEvent) {
|
|
|
300
312
|
bool createImageBrush{!imageBrush};
|
|
301
313
|
if (createImageBrush) {
|
|
302
314
|
imageBrush = winrt::ImageBrush{};
|
|
303
|
-
|
|
304
|
-
strong_this->m_imageBrushOpenedRevoker =
|
|
305
|
-
imageBrush.ImageOpened(winrt::auto_revoke, [weak_this, imageBrush](const auto &, const auto &) {
|
|
306
|
-
if (auto strong_this{weak_this.get()}) {
|
|
307
|
-
imageBrush.Stretch(strong_this->ResizeModeToStretch(strong_this->m_resizeMode));
|
|
308
|
-
}
|
|
309
|
-
});
|
|
315
|
+
imageBrush.Stretch(strong_this->ResizeModeToStretch());
|
|
310
316
|
}
|
|
311
317
|
|
|
312
318
|
if (source.sourceFormat == ImageSourceFormat::Svg) {
|
|
@@ -356,6 +362,7 @@ winrt::fire_and_forget ReactImage::SetBackground(bool fireLoadEndEvent) {
|
|
|
356
362
|
if (auto bitmap{imageBrush.ImageSource().try_as<winrt::BitmapImage>()}) {
|
|
357
363
|
strong_this->m_imageSource.height = bitmap.PixelHeight();
|
|
358
364
|
strong_this->m_imageSource.width = bitmap.PixelWidth();
|
|
365
|
+
imageBrush.Stretch(strong_this->ResizeModeToStretch());
|
|
359
366
|
}
|
|
360
367
|
|
|
361
368
|
strong_this->m_onLoadEndEvent(*strong_this, true);
|
|
@@ -39,6 +39,7 @@ struct ReactImage : xaml::Controls::GridT<ReactImage> {
|
|
|
39
39
|
|
|
40
40
|
// Overrides
|
|
41
41
|
winrt::Windows::Foundation::Size ArrangeOverride(winrt::Windows::Foundation::Size finalSize);
|
|
42
|
+
xaml::Automation::Peers::AutomationPeer OnCreateAutomationPeer();
|
|
42
43
|
|
|
43
44
|
// Events
|
|
44
45
|
winrt::event_token OnLoadEnd(winrt::Windows::Foundation::EventHandler<bool> const &handler);
|
|
@@ -66,7 +67,8 @@ struct ReactImage : xaml::Controls::GridT<ReactImage> {
|
|
|
66
67
|
void TintColor(winrt::Windows::UI::Color value);
|
|
67
68
|
|
|
68
69
|
private:
|
|
69
|
-
xaml::Media::Stretch ResizeModeToStretch(
|
|
70
|
+
xaml::Media::Stretch ResizeModeToStretch();
|
|
71
|
+
xaml::Media::Stretch ResizeModeToStretch(winrt::Windows::Foundation::Size size);
|
|
70
72
|
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Storage::Streams::InMemoryRandomAccessStream>
|
|
71
73
|
GetImageMemoryStreamAsync(ReactImageSource source);
|
|
72
74
|
winrt::fire_and_forget SetBackground(bool fireLoadEndEvent);
|
|
@@ -4,19 +4,12 @@
|
|
|
4
4
|
#include "pch.h"
|
|
5
5
|
|
|
6
6
|
#include "RawTextViewManager.h"
|
|
7
|
-
#include "TextViewManager.h"
|
|
8
|
-
#include "VirtualTextViewManager.h"
|
|
9
7
|
|
|
10
8
|
#include <Views/ShadowNodeBase.h>
|
|
9
|
+
#include <Views/Text/TextVisitors.h>
|
|
11
10
|
|
|
12
|
-
#include <INativeUIManager.h>
|
|
13
|
-
#include <Utils/ShadowNodeTypeUtils.h>
|
|
14
|
-
#include <Utils/ValueUtils.h>
|
|
15
|
-
|
|
16
|
-
#include <Modules/NativeUIManager.h>
|
|
17
|
-
#include <Modules/PaperUIManagerModule.h>
|
|
18
|
-
#include <UI.Xaml.Controls.h>
|
|
19
11
|
#include <UI.Xaml.Documents.h>
|
|
12
|
+
#include <Utils/ValueUtils.h>
|
|
20
13
|
#include <winrt/Windows.Foundation.h>
|
|
21
14
|
|
|
22
15
|
namespace winrt {
|
|
@@ -52,56 +45,14 @@ bool RawTextViewManager::UpdateProperty(
|
|
|
52
45
|
if (propertyName == "text") {
|
|
53
46
|
run.Text(asHstring(propertyValue));
|
|
54
47
|
static_cast<RawTextShadowNode *>(nodeToUpdate)->originalText = winrt::hstring{};
|
|
55
|
-
|
|
48
|
+
ApplyTextTransformToChild(nodeToUpdate);
|
|
49
|
+
NotifyAncestorsTextPropertyChanged(nodeToUpdate, PropertyChangeType::Text);
|
|
56
50
|
} else {
|
|
57
51
|
return Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue);
|
|
58
52
|
}
|
|
59
53
|
return true;
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
void RawTextViewManager::NotifyAncestorsTextChanged(ShadowNodeBase *nodeToUpdate) {
|
|
63
|
-
if (auto uiManager = GetNativeUIManager(GetReactContext()).lock()) {
|
|
64
|
-
auto host = uiManager->getHost();
|
|
65
|
-
ShadowNodeBase *parent = static_cast<ShadowNodeBase *>(host->FindShadowNodeForTag(nodeToUpdate->GetParent()));
|
|
66
|
-
TextTransform textTransform = TextTransform::Undefined;
|
|
67
|
-
auto isNested = false;
|
|
68
|
-
while (parent) {
|
|
69
|
-
auto viewManager = parent->GetViewManager();
|
|
70
|
-
const auto nodeType = viewManager->GetName();
|
|
71
|
-
if (IsTextShadowNode(parent)) {
|
|
72
|
-
const auto textViewManager = static_cast<TextViewManager *>(viewManager);
|
|
73
|
-
if (textTransform == TextTransform::Undefined) {
|
|
74
|
-
textTransform = textViewManager->GetTextTransformValue(parent);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
VirtualTextShadowNode::ApplyTextTransform(
|
|
78
|
-
*nodeToUpdate, textTransform, /* forceUpdate = */ false, /* isRoot = */ false);
|
|
79
|
-
|
|
80
|
-
if (!isNested && parent->m_children.size() == 1) {
|
|
81
|
-
auto view = parent->GetView();
|
|
82
|
-
auto textBlock = view.try_as<winrt::TextBlock>();
|
|
83
|
-
if (textBlock != nullptr) {
|
|
84
|
-
const auto run = nodeToUpdate->GetView().try_as<winrt::Run>();
|
|
85
|
-
if (run != nullptr) {
|
|
86
|
-
textBlock.Text(run.Text());
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
(static_cast<TextViewManager *>(viewManager))->OnDescendantTextPropertyChanged(parent);
|
|
92
|
-
|
|
93
|
-
// We have reached the parent TextBlock, so there're no more parent <Text> elements in this tree.
|
|
94
|
-
break;
|
|
95
|
-
} else if (IsVirtualTextShadowNode(parent) && textTransform == TextTransform::Undefined) {
|
|
96
|
-
textTransform = static_cast<VirtualTextShadowNode *>(parent)->textTransform;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
parent = static_cast<ShadowNodeBase *>(host->FindShadowNodeForTag(parent->GetParent()));
|
|
100
|
-
isNested = true;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
56
|
void RawTextViewManager::SetLayoutProps(
|
|
106
57
|
ShadowNodeBase & /*nodeToUpdate*/,
|
|
107
58
|
const XamlView & /*viewToUpdate*/,
|
|
@@ -41,9 +41,6 @@ class RawTextViewManager : public ViewManagerBase {
|
|
|
41
41
|
const winrt::Microsoft::ReactNative::JSValue &propertyValue) override;
|
|
42
42
|
|
|
43
43
|
XamlView CreateViewCore(int64_t tag, const winrt::Microsoft::ReactNative::JSValueObject &) override;
|
|
44
|
-
|
|
45
|
-
private:
|
|
46
|
-
void NotifyAncestorsTextChanged(ShadowNodeBase *nodeToUpdate);
|
|
47
44
|
};
|
|
48
45
|
|
|
49
46
|
} // namespace Microsoft::ReactNative
|
|
@@ -16,6 +16,8 @@ namespace Microsoft::ReactNative {
|
|
|
16
16
|
|
|
17
17
|
class ViewManagerBase;
|
|
18
18
|
|
|
19
|
+
enum class PointerEventsKind : uint8_t { Auto = 0, BoxNone, BoxOnly, None };
|
|
20
|
+
|
|
19
21
|
enum class ShadowEdges : uint8_t {
|
|
20
22
|
Left = 0,
|
|
21
23
|
Top,
|
|
@@ -128,6 +130,9 @@ struct REACTWINDOWS_EXPORT ShadowNodeBase : public ShadowNode {
|
|
|
128
130
|
bool m_onMouseEnterRegistered = false;
|
|
129
131
|
bool m_onMouseLeaveRegistered = false;
|
|
130
132
|
|
|
133
|
+
// Pointer events
|
|
134
|
+
PointerEventsKind m_pointerEvents = PointerEventsKind::Auto;
|
|
135
|
+
|
|
131
136
|
// Support Keyboard
|
|
132
137
|
public:
|
|
133
138
|
void UpdateHandledKeyboardEvents(
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "TextHighlighterVisitor.h"
|
|
5
|
+
#include <Utils/ValueUtils.h>
|
|
6
|
+
#include <Views/RawTextViewManager.h>
|
|
7
|
+
#include <Views/TextViewManager.h>
|
|
8
|
+
#include <Views/VirtualTextViewManager.h>
|
|
9
|
+
#include "TextVisitorScope.h"
|
|
10
|
+
|
|
11
|
+
namespace winrt {
|
|
12
|
+
using namespace xaml::Documents;
|
|
13
|
+
} // namespace winrt
|
|
14
|
+
|
|
15
|
+
namespace Microsoft::ReactNative {
|
|
16
|
+
|
|
17
|
+
void TextHighlighterVisitor::VisitRawText(ShadowNodeBase *node) {
|
|
18
|
+
const auto textNode = static_cast<RawTextShadowNode *>(node);
|
|
19
|
+
m_startIndex += textNode->GetView().as<winrt::Run>().Text().size();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void TextHighlighterVisitor::VisitVirtualText(ShadowNodeBase *node) {
|
|
23
|
+
const auto textNode = static_cast<VirtualTextShadowNode *>(node);
|
|
24
|
+
const auto foregroundColor = textNode->foregroundColor;
|
|
25
|
+
const auto backgroundColor = textNode->backgroundColor;
|
|
26
|
+
const auto needsHighlighter = RequiresTextHighlighter(foregroundColor, backgroundColor);
|
|
27
|
+
TextVisitorScope<Color> foregroundScope{m_foregroundColors, foregroundColor};
|
|
28
|
+
TextVisitorScope<Color> backgroundScope{m_backgroundColors, backgroundColor};
|
|
29
|
+
|
|
30
|
+
const auto startIndex = m_startIndex;
|
|
31
|
+
const auto initialHighlighterCount = highlighters.size();
|
|
32
|
+
Super::VisitVirtualText(node);
|
|
33
|
+
|
|
34
|
+
if (needsHighlighter) {
|
|
35
|
+
winrt::TextHighlighter highlighter;
|
|
36
|
+
highlighter.Background(SolidBrushFromColor(m_backgroundColors.top().value()));
|
|
37
|
+
const auto inheritedForegroundColor = m_foregroundColors.top();
|
|
38
|
+
if (inheritedForegroundColor.has_value()) {
|
|
39
|
+
highlighter.Foreground(SolidBrushFromColor(inheritedForegroundColor.value()));
|
|
40
|
+
}
|
|
41
|
+
highlighter.Ranges().Append({startIndex, m_startIndex - startIndex});
|
|
42
|
+
highlighters.push_back(highlighter);
|
|
43
|
+
} else if (highlighters.size() == initialHighlighterCount) {
|
|
44
|
+
textNode->hasDescendantTextHighlighter = false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
bool TextHighlighterVisitor::RequiresTextHighlighter(Color foregroundColor, Color backgroundColor) {
|
|
49
|
+
return backgroundColor || m_backgroundColors.top() && foregroundColor;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <Utils/TextTransform.h>
|
|
7
|
+
#include <stack>
|
|
8
|
+
#include "TextVisitor.h"
|
|
9
|
+
|
|
10
|
+
namespace Microsoft::ReactNative {
|
|
11
|
+
|
|
12
|
+
class TextHighlighterVisitor : public TextVisitor {
|
|
13
|
+
using Super = TextVisitor;
|
|
14
|
+
using Color = std::optional<winrt::Windows::UI::Color>;
|
|
15
|
+
|
|
16
|
+
public:
|
|
17
|
+
TextHighlighterVisitor(Color foregroundColor, Color backgroundColor) : Super() {
|
|
18
|
+
m_foregroundColors.push(foregroundColor);
|
|
19
|
+
m_backgroundColors.push(backgroundColor);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
std::vector<xaml::Documents::TextHighlighter> highlighters{};
|
|
23
|
+
|
|
24
|
+
protected:
|
|
25
|
+
void VisitRawText(ShadowNodeBase *node) override;
|
|
26
|
+
|
|
27
|
+
void VisitVirtualText(ShadowNodeBase *node) override;
|
|
28
|
+
|
|
29
|
+
private:
|
|
30
|
+
int m_startIndex{0};
|
|
31
|
+
std::stack<Color> m_foregroundColors;
|
|
32
|
+
std::stack<Color> m_backgroundColors;
|
|
33
|
+
|
|
34
|
+
bool RequiresTextHighlighter(Color foregroundColor, Color backgroundColor);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
} // namespace Microsoft::ReactNative
|