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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include "../../codegen/NativeDialogManagerWindowsSpec.g.h"
|
|
5
6
|
#include <NativeModules.h>
|
|
6
7
|
#include <winrt/Windows.ApplicationModel.h>
|
|
7
8
|
#include <winrt/Windows.Foundation.h>
|
|
@@ -10,41 +11,33 @@
|
|
|
10
11
|
|
|
11
12
|
namespace Microsoft::ReactNative {
|
|
12
13
|
|
|
13
|
-
REACT_STRUCT(ShowAlertArgs)
|
|
14
|
-
struct ShowAlertArgs {
|
|
15
|
-
REACT_FIELD(title)
|
|
16
|
-
std::string title;
|
|
17
|
-
|
|
18
|
-
REACT_FIELD(message)
|
|
19
|
-
std::string message;
|
|
20
|
-
|
|
21
|
-
REACT_FIELD(buttonPositive)
|
|
22
|
-
std::string buttonPositive;
|
|
23
|
-
|
|
24
|
-
REACT_FIELD(buttonNegative)
|
|
25
|
-
std::string buttonNegative;
|
|
26
|
-
|
|
27
|
-
REACT_FIELD(buttonNeutral)
|
|
28
|
-
std::string buttonNeutral;
|
|
29
|
-
|
|
30
|
-
REACT_FIELD(defaultButton)
|
|
31
|
-
int defaultButton;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
14
|
REACT_MODULE(Alert)
|
|
35
15
|
struct Alert : public std::enable_shared_from_this<Alert> {
|
|
16
|
+
using DialogOptions = ReactNativeSpecs::DialogManagerWindowsSpec_DialogOptions;
|
|
17
|
+
using Constants = ReactNativeSpecs::DialogManagerWindowsSpec_Constants;
|
|
18
|
+
|
|
36
19
|
REACT_INIT(Initialize)
|
|
37
20
|
void Initialize(React::ReactContext const &reactContext) noexcept;
|
|
38
21
|
|
|
39
22
|
REACT_METHOD(showAlert)
|
|
40
|
-
void showAlert(
|
|
23
|
+
void showAlert(
|
|
24
|
+
DialogOptions &&args,
|
|
25
|
+
std::function<void(std::string)> error,
|
|
26
|
+
std::function<void(std::string, int)> result) noexcept;
|
|
27
|
+
|
|
28
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
29
|
+
Constants GetConstants() noexcept;
|
|
41
30
|
|
|
42
31
|
private:
|
|
43
32
|
React::ReactContext m_context;
|
|
33
|
+
Constants m_constants;
|
|
44
34
|
|
|
45
35
|
struct AlertRequest {
|
|
46
|
-
|
|
47
|
-
std::function<void(std::string)> result;
|
|
36
|
+
DialogOptions args;
|
|
37
|
+
std::function<void(std::string, int)> result;
|
|
38
|
+
|
|
39
|
+
AlertRequest(DialogOptions &&rargs, std::function<void(std::string, int)> rresult) noexcept
|
|
40
|
+
: args(std::move(rargs)), result(rresult) {}
|
|
48
41
|
};
|
|
49
42
|
|
|
50
43
|
std::queue<AlertRequest> pendingAlerts{};
|
|
@@ -138,9 +138,10 @@ winrt::hstring InterpolationAnimatedNode::GetLeftExpression(
|
|
|
138
138
|
const winrt::hstring &value,
|
|
139
139
|
const winrt::hstring &leftInterpolateExpression) {
|
|
140
140
|
const auto firstInput = s_inputName.data() + std::to_wstring(0);
|
|
141
|
+
const auto firstOutput = s_outputName.data() + std::to_wstring(0);
|
|
141
142
|
switch (ExtrapolationTypeFromString(m_extrapolateLeft)) {
|
|
142
143
|
case ExtrapolationType::Clamp:
|
|
143
|
-
return value + L" < " + firstInput + L" ? " +
|
|
144
|
+
return value + L" < " + firstInput + L" ? " + firstOutput + L" : ";
|
|
144
145
|
case ExtrapolationType::Identity:
|
|
145
146
|
return value + L" < " + firstInput + L" ? " + value + L" : ";
|
|
146
147
|
case ExtrapolationType::Extend:
|
|
@@ -154,9 +155,10 @@ winrt::hstring InterpolationAnimatedNode::GetRightExpression(
|
|
|
154
155
|
const winrt::hstring &value,
|
|
155
156
|
const winrt::hstring &rightInterpolateExpression) {
|
|
156
157
|
const auto lastInput = s_inputName.data() + std::to_wstring(m_inputRanges.size() - 1);
|
|
158
|
+
const auto lastOutput = s_outputName.data() + std::to_wstring(m_outputRanges.size() - 1);
|
|
157
159
|
switch (ExtrapolationTypeFromString(m_extrapolateRight)) {
|
|
158
160
|
case ExtrapolationType::Clamp:
|
|
159
|
-
return value + L" > " + lastInput + L" ? " +
|
|
161
|
+
return value + L" > " + lastInput + L" ? " + lastOutput + L" : ";
|
|
160
162
|
case ExtrapolationType::Identity:
|
|
161
163
|
return value + L" > " + lastInput + L" ? " + value + L" : ";
|
|
162
164
|
case ExtrapolationType::Extend:
|
|
@@ -121,7 +121,6 @@ void PropsAnimatedNode::StartAnimations() {
|
|
|
121
121
|
if (const auto uiElement = GetUIElement()) {
|
|
122
122
|
// Work around for https://github.com/microsoft/microsoft-ui-xaml/issues/2511
|
|
123
123
|
EnsureUIElementDirtyForRender(uiElement);
|
|
124
|
-
uiElement.RotationAxis(m_rotationAxis);
|
|
125
124
|
for (const auto &anim : m_expressionAnimations) {
|
|
126
125
|
if (anim.second.Target() == L"Translation.X") {
|
|
127
126
|
m_subchannelPropertySet.StartAnimation(L"TranslationX", anim.second);
|
|
@@ -135,6 +134,9 @@ void PropsAnimatedNode::StartAnimations() {
|
|
|
135
134
|
} else if (anim.second.Target() == L"Scale.Y") {
|
|
136
135
|
m_subchannelPropertySet.StartAnimation(L"ScaleY", anim.second);
|
|
137
136
|
uiElement.StartAnimation(m_scaleCombined);
|
|
137
|
+
} else if (anim.second.Target() == L"Rotation") {
|
|
138
|
+
uiElement.RotationAxis(m_rotationAxis);
|
|
139
|
+
uiElement.StartAnimation(anim.second);
|
|
138
140
|
} else {
|
|
139
141
|
uiElement.StartAnimation(anim.second);
|
|
140
142
|
}
|
|
@@ -47,13 +47,11 @@ void AppState::Initialize(winrt::Microsoft::ReactNative::ReactContext const &rea
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
void AppState::GetCurrentAppState(
|
|
50
|
-
std::function<void(
|
|
50
|
+
std::function<void(AppStateChangeArgs const &)> const &success,
|
|
51
51
|
std::function<void(React::JSValue const &)> const &error) noexcept {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
writer.WriteObjectEnd();
|
|
56
|
-
success(React::TakeJSValue(writer));
|
|
52
|
+
AppStateChangeArgs args;
|
|
53
|
+
args.app_state = m_active ? "active" : "background";
|
|
54
|
+
success(args);
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
void AppState::AddListener(std::string && /*eventName*/) noexcept {
|
|
@@ -64,6 +62,10 @@ void AppState::RemoveListeners(double /*count*/) noexcept {
|
|
|
64
62
|
// noop
|
|
65
63
|
}
|
|
66
64
|
|
|
65
|
+
ReactNativeSpecs::AppStateSpec_Constants AppState::GetConstants() noexcept {
|
|
66
|
+
return {m_active ? "active" : "background"};
|
|
67
|
+
}
|
|
68
|
+
|
|
67
69
|
void AppState::SetActive(bool active) noexcept {
|
|
68
70
|
m_active = active;
|
|
69
71
|
m_context.JSDispatcher().Post([this]() { AppStateDidChange({m_active ? "active" : "background"}); });
|
|
@@ -2,26 +2,23 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include "../../codegen/NativeAppStateSpec.g.h"
|
|
5
6
|
#include <NativeModules.h>
|
|
6
7
|
#include <winrt/Windows.ApplicationModel.h>
|
|
7
8
|
#include <winrt/Windows.Foundation.h>
|
|
8
9
|
|
|
9
10
|
namespace Microsoft::ReactNative {
|
|
10
11
|
|
|
11
|
-
REACT_STRUCT(AppStateChangeArgs)
|
|
12
|
-
struct AppStateChangeArgs {
|
|
13
|
-
REACT_FIELD(app_state)
|
|
14
|
-
std::string app_state;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
12
|
REACT_MODULE(AppState)
|
|
18
13
|
struct AppState : public std::enable_shared_from_this<AppState> {
|
|
14
|
+
using AppStateChangeArgs = ReactNativeSpecs::AppStateSpec_getCurrentAppState_success_appState;
|
|
15
|
+
|
|
19
16
|
REACT_INIT(Initialize)
|
|
20
17
|
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
21
18
|
|
|
22
19
|
REACT_METHOD(GetCurrentAppState, L"getCurrentAppState")
|
|
23
20
|
void GetCurrentAppState(
|
|
24
|
-
std::function<void(
|
|
21
|
+
std::function<void(AppStateChangeArgs const &)> const &success,
|
|
25
22
|
std::function<void(React::JSValue const &)> const &error) noexcept;
|
|
26
23
|
|
|
27
24
|
REACT_METHOD(AddListener, L"addListener")
|
|
@@ -30,8 +27,8 @@ struct AppState : public std::enable_shared_from_this<AppState> {
|
|
|
30
27
|
REACT_METHOD(RemoveListeners, L"removeListeners")
|
|
31
28
|
void RemoveListeners(double count) noexcept;
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
31
|
+
ReactNativeSpecs::AppStateSpec_Constants GetConstants() noexcept;
|
|
35
32
|
|
|
36
33
|
REACT_EVENT(AppStateDidChange, L"appStateDidChange")
|
|
37
34
|
std::function<void(AppStateChangeArgs const &)> AppStateDidChange;
|
|
@@ -89,33 +89,43 @@ void DeviceInfoHolder::InitDeviceInfoHolder(const Mso::React::IReactContext &con
|
|
|
89
89
|
|
|
90
90
|
void DeviceInfoHolder::notifyChanged() noexcept {
|
|
91
91
|
if (m_notifyCallback) {
|
|
92
|
-
|
|
92
|
+
auto writer = MakeJSValueTreeWriter();
|
|
93
|
+
WriteValue(writer, getDimensions());
|
|
94
|
+
m_notifyCallback(TakeJSValue(writer).MoveObject());
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
ReactNativeSpecs::DeviceInfoSpec_DimensionsPayload DeviceInfoHolder::GetDimensions(
|
|
99
|
+
const React::ReactPropertyBag &propertyBag) noexcept {
|
|
97
100
|
auto holder = propertyBag.Get(DeviceInfoHolderPropertyId());
|
|
98
|
-
|
|
99
101
|
return (*holder)->getDimensions();
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
ReactNativeSpecs::DeviceInfoSpec_DisplayMetricsAndroid DeviceInfoHolder::getWindow() noexcept {
|
|
105
|
+
ReactNativeSpecs::DeviceInfoSpec_DisplayMetricsAndroid metrics;
|
|
106
|
+
metrics.width = m_windowWidth * m_scale;
|
|
107
|
+
metrics.height = m_windowHeight * m_scale;
|
|
108
|
+
metrics.scale = m_scale;
|
|
109
|
+
metrics.fontScale = m_textScaleFactor;
|
|
110
|
+
metrics.densityDpi = m_dpi;
|
|
111
|
+
return metrics;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
ReactNativeSpecs::DeviceInfoSpec_DisplayMetricsAndroid DeviceInfoHolder::getScreen() noexcept {
|
|
115
|
+
ReactNativeSpecs::DeviceInfoSpec_DisplayMetricsAndroid metrics;
|
|
116
|
+
metrics.width = m_screenWidth;
|
|
117
|
+
metrics.height = m_screenHeight;
|
|
118
|
+
metrics.scale = m_scale;
|
|
119
|
+
metrics.fontScale = m_textScaleFactor;
|
|
120
|
+
metrics.densityDpi = m_dpi;
|
|
121
|
+
return metrics;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
ReactNativeSpecs::DeviceInfoSpec_DimensionsPayload DeviceInfoHolder::getDimensions() noexcept {
|
|
125
|
+
ReactNativeSpecs::DeviceInfoSpec_DimensionsPayload payload;
|
|
126
|
+
payload.windowPhysicalPixels = getWindow();
|
|
127
|
+
payload.screenPhysicalPixels = getScreen();
|
|
128
|
+
return payload;
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
void DeviceInfoHolder::SetCallback(
|
|
@@ -163,8 +173,10 @@ void DeviceInfoHolder::updateDeviceInfo() noexcept {
|
|
|
163
173
|
}
|
|
164
174
|
}
|
|
165
175
|
|
|
166
|
-
|
|
167
|
-
|
|
176
|
+
ReactNativeSpecs::DeviceInfoSpec_Constants DeviceInfo::GetConstants() noexcept {
|
|
177
|
+
ReactNativeSpecs::DeviceInfoSpec_Constants constants;
|
|
178
|
+
constants.Dimensions = DeviceInfoHolder::GetDimensions(m_context.Properties());
|
|
179
|
+
return constants;
|
|
168
180
|
}
|
|
169
181
|
|
|
170
182
|
void DeviceInfo::Initialize(React::ReactContext const &reactContext) noexcept {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include "../../codegen/NativeDeviceInfoSpec.g.h"
|
|
5
6
|
#include <NativeModules.h>
|
|
6
7
|
#include <React.h>
|
|
7
8
|
#include <ReactNotificationService.h>
|
|
@@ -22,10 +23,13 @@ struct DeviceInfoHolder {
|
|
|
22
23
|
const React::ReactPropertyBag &propertyBag,
|
|
23
24
|
Mso::Functor<void(React::JSValueObject &&)> &&callback) noexcept;
|
|
24
25
|
static void InitDeviceInfoHolder(const Mso::React::IReactContext &context) noexcept;
|
|
25
|
-
static
|
|
26
|
+
static ReactNativeSpecs::DeviceInfoSpec_DimensionsPayload GetDimensions(
|
|
27
|
+
const React::ReactPropertyBag &propertyBag) noexcept;
|
|
26
28
|
|
|
27
29
|
private:
|
|
28
|
-
|
|
30
|
+
ReactNativeSpecs::DeviceInfoSpec_DisplayMetricsAndroid getWindow() noexcept;
|
|
31
|
+
ReactNativeSpecs::DeviceInfoSpec_DisplayMetricsAndroid getScreen() noexcept;
|
|
32
|
+
ReactNativeSpecs::DeviceInfoSpec_DimensionsPayload getDimensions() noexcept;
|
|
29
33
|
void updateDeviceInfo() noexcept;
|
|
30
34
|
void notifyChanged() noexcept;
|
|
31
35
|
|
|
@@ -49,8 +53,8 @@ struct DeviceInfo : public std::enable_shared_from_this<DeviceInfo> {
|
|
|
49
53
|
REACT_INIT(Initialize)
|
|
50
54
|
void Initialize(React::ReactContext const &reactContext) noexcept;
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
57
|
+
ReactNativeSpecs::DeviceInfoSpec_Constants GetConstants() noexcept;
|
|
54
58
|
|
|
55
59
|
private:
|
|
56
60
|
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
@@ -61,7 +61,7 @@ void I18nManager::SwapLeftAndRightInRTL(bool /*flipStyles*/) noexcept {
|
|
|
61
61
|
// TODO - https://github.com/microsoft/react-native-windows/issues/4662
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
ReactNativeSpecs::I18nManagerSpec_Constants I18nManager::GetConstants() noexcept {
|
|
65
65
|
std::string locale = "en-us";
|
|
66
66
|
|
|
67
67
|
auto langs = winrt::Windows::Globalization::ApplicationLanguages::Languages();
|
|
@@ -69,9 +69,11 @@ void I18nManager::GetConstants(React::ReactConstantProvider &provider) noexcept
|
|
|
69
69
|
locale = Microsoft::Common::Unicode::Utf16ToUtf8(langs.GetAt(0));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
ReactNativeSpecs::I18nManagerSpec_Constants constants;
|
|
73
|
+
constants.localeIdentifier = locale;
|
|
74
|
+
constants.doLeftAndRightSwapInRTL = false;
|
|
75
|
+
constants.isRTL = IsRTL(m_context.Properties());
|
|
76
|
+
return constants;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
void I18nManager::Initialize(React::ReactContext const &reactContext) noexcept {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include "../../codegen/NativeI18nManagerSpec.g.h"
|
|
5
6
|
#include <NativeModules.h>
|
|
6
7
|
#include <winrt/Windows.ApplicationModel.h>
|
|
7
8
|
#include <winrt/Windows.Foundation.h>
|
|
@@ -20,8 +21,8 @@ struct I18nManager {
|
|
|
20
21
|
REACT_INIT(Initialize)
|
|
21
22
|
void Initialize(React::ReactContext const &reactContext) noexcept;
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
25
|
+
ReactNativeSpecs::I18nManagerSpec_Constants GetConstants() noexcept;
|
|
25
26
|
|
|
26
27
|
REACT_METHOD(AllowRTL, L"allowRTL")
|
|
27
28
|
void AllowRTL(bool allowRTL) noexcept;
|
|
@@ -23,39 +23,20 @@ using namespace xaml::Media::Imaging;
|
|
|
23
23
|
} // namespace winrt
|
|
24
24
|
|
|
25
25
|
namespace Microsoft::ReactNative {
|
|
26
|
-
//
|
|
27
|
-
// ImageViewManagerModule::ImageViewManagerModuleImpl
|
|
28
|
-
//
|
|
29
|
-
class ImageViewManagerModule::ImageViewManagerModuleImpl {
|
|
30
|
-
public:
|
|
31
|
-
ImageViewManagerModuleImpl(ImageViewManagerModule *parent) : m_parent(parent) {}
|
|
32
|
-
|
|
33
|
-
void Disconnect() {
|
|
34
|
-
m_parent = nullptr;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void getSize(std::string uri, Callback successCallback, Callback errorCallback);
|
|
38
|
-
void getSizeWithHeaders(std::string uri, folly::dynamic &headers, Callback successCallback, Callback errorCallback);
|
|
39
|
-
void prefetchImage(std::string uri, Callback successCallback, Callback errorCallback);
|
|
40
|
-
void queryCache(const folly::dynamic &requests, Callback successCallback, Callback errorCallback);
|
|
41
|
-
|
|
42
|
-
private:
|
|
43
|
-
ImageViewManagerModule *m_parent;
|
|
44
|
-
};
|
|
45
26
|
|
|
46
27
|
winrt::fire_and_forget GetImageSizeAsync(
|
|
47
28
|
std::string uriString,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
winrt::Microsoft::ReactNative::JSValue &&headers,
|
|
30
|
+
Mso::Functor<void(int32_t width, int32_t height)> successCallback,
|
|
31
|
+
Mso::Functor<void()> errorCallback) {
|
|
51
32
|
bool succeeded{false};
|
|
52
33
|
|
|
53
34
|
try {
|
|
54
35
|
ReactImageSource source;
|
|
55
36
|
source.uri = uriString;
|
|
56
|
-
if (!headers.
|
|
57
|
-
for (auto &header : headers.
|
|
58
|
-
source.headers.push_back(std::make_pair(header.first
|
|
37
|
+
if (!headers.IsNull()) {
|
|
38
|
+
for (auto &header : headers.AsObject()) {
|
|
39
|
+
source.headers.push_back(std::make_pair(header.first, header.second.AsString()));
|
|
59
40
|
}
|
|
60
41
|
}
|
|
61
42
|
|
|
@@ -77,96 +58,67 @@ winrt::fire_and_forget GetImageSizeAsync(
|
|
|
77
58
|
}
|
|
78
59
|
|
|
79
60
|
if (bitmap) {
|
|
80
|
-
successCallback(
|
|
61
|
+
successCallback(bitmap.PixelWidth(), bitmap.PixelHeight());
|
|
81
62
|
succeeded = true;
|
|
82
63
|
}
|
|
83
64
|
} catch (winrt::hresult_error const &) {
|
|
84
65
|
}
|
|
85
66
|
|
|
86
67
|
if (!succeeded)
|
|
87
|
-
errorCallback(
|
|
68
|
+
errorCallback();
|
|
88
69
|
|
|
89
70
|
co_return;
|
|
90
71
|
}
|
|
91
72
|
|
|
92
|
-
void
|
|
93
|
-
|
|
94
|
-
Callback successCallback,
|
|
95
|
-
Callback errorCallback) {
|
|
96
|
-
folly::dynamic headers{};
|
|
97
|
-
GetImageSizeAsync(uri, headers, successCallback, errorCallback);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
void ImageViewManagerModule::ImageViewManagerModuleImpl::getSizeWithHeaders(
|
|
101
|
-
std::string uri,
|
|
102
|
-
folly::dynamic &headers,
|
|
103
|
-
Callback successCallback,
|
|
104
|
-
Callback errorCallback) {
|
|
105
|
-
GetImageSizeAsync(uri, headers, successCallback, errorCallback);
|
|
73
|
+
void ImageLoader::Initialize(React::ReactContext const &reactContext) noexcept {
|
|
74
|
+
m_context = reactContext;
|
|
106
75
|
}
|
|
107
76
|
|
|
108
|
-
void
|
|
109
|
-
|
|
110
|
-
Callback successCallback,
|
|
111
|
-
Callback /*errorCallback*/) {
|
|
112
|
-
// NotYetImplemented
|
|
113
|
-
successCallback({});
|
|
77
|
+
void ImageLoader::getSize(std::string uri, React::ReactPromise<React::JSValue> &&result) noexcept {
|
|
78
|
+
getSizeWithHeaders(std::move(uri), {}, std::move(result));
|
|
114
79
|
}
|
|
115
80
|
|
|
116
|
-
void
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
81
|
+
void ImageLoader::getSizeWithHeaders(
|
|
82
|
+
std::string uri,
|
|
83
|
+
React::JSValue &&headers,
|
|
84
|
+
React::ReactPromise<React::JSValue> &&result) noexcept {
|
|
85
|
+
m_context.UIDispatcher().Post([context = m_context,
|
|
86
|
+
uri = std::move(uri),
|
|
87
|
+
headers = std::move(headers),
|
|
88
|
+
result = std::move(result)]() mutable noexcept {
|
|
89
|
+
GetImageSizeAsync(
|
|
90
|
+
std::move(uri),
|
|
91
|
+
std::move(headers),
|
|
92
|
+
[result, context](int32_t width, int32_t height) noexcept {
|
|
93
|
+
context.JSDispatcher().Post([result = std::move(result), width, height]() noexcept {
|
|
94
|
+
result.Resolve(React::JSValueArray{width, height});
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
[result, context]() noexcept {
|
|
98
|
+
context.JSDispatcher().Post([result = std::move(result)]() noexcept { result.Reject("Failed"); });
|
|
99
|
+
});
|
|
100
|
+
});
|
|
122
101
|
}
|
|
123
102
|
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
const char *ImageViewManagerModule::name = "ImageLoader";
|
|
128
|
-
|
|
129
|
-
ImageViewManagerModule::ImageViewManagerModule()
|
|
130
|
-
: m_imageViewManagerModule(std::make_shared<ImageViewManagerModuleImpl>(this)) {}
|
|
131
|
-
|
|
132
|
-
ImageViewManagerModule::~ImageViewManagerModule() {}
|
|
133
|
-
|
|
134
|
-
std::string ImageViewManagerModule::getName() {
|
|
135
|
-
return name;
|
|
103
|
+
void ImageLoader::prefetchImage(std::string uri, React::ReactPromise<React::JSValue> &&result) noexcept {
|
|
104
|
+
// NYI
|
|
105
|
+
result.Resolve(true);
|
|
136
106
|
}
|
|
137
107
|
|
|
138
|
-
|
|
139
|
-
|
|
108
|
+
void ImageLoader::prefetchImageWithMetadata(
|
|
109
|
+
std::string uri,
|
|
110
|
+
std::string queryRootName,
|
|
111
|
+
double rootTag,
|
|
112
|
+
React::ReactPromise<React::JSValue> &&result) noexcept {
|
|
113
|
+
// NYI
|
|
114
|
+
result.Resolve(true);
|
|
140
115
|
}
|
|
141
116
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
[imageViewManager](folly::dynamic args, Callback successCallback, Callback errorCallback) {
|
|
148
|
-
imageViewManager->getSize(facebook::xplat::jsArgAsString(args, 0), successCallback, errorCallback);
|
|
149
|
-
}),
|
|
150
|
-
Method(
|
|
151
|
-
"getSizeWithHeaders",
|
|
152
|
-
[imageViewManager](folly::dynamic args, Callback successCallback, Callback errorCallback) {
|
|
153
|
-
imageViewManager->getSizeWithHeaders(
|
|
154
|
-
facebook::xplat::jsArgAsString(args, 0),
|
|
155
|
-
facebook::xplat::jsArgAsObject(args, 1),
|
|
156
|
-
successCallback,
|
|
157
|
-
errorCallback);
|
|
158
|
-
}),
|
|
159
|
-
Method(
|
|
160
|
-
"prefetchImage",
|
|
161
|
-
[imageViewManager](folly::dynamic args, Callback successCallback, Callback errorCallback) {
|
|
162
|
-
imageViewManager->prefetchImage(facebook::xplat::jsArgAsString(args, 0), successCallback, errorCallback);
|
|
163
|
-
}),
|
|
164
|
-
Method(
|
|
165
|
-
"queryCache",
|
|
166
|
-
[imageViewManager](folly::dynamic args, Callback successCallback, Callback errorCallback) {
|
|
167
|
-
imageViewManager->queryCache(args[0], successCallback, errorCallback);
|
|
168
|
-
}),
|
|
169
|
-
};
|
|
117
|
+
void ImageLoader::queryCache(
|
|
118
|
+
std::vector<std::string> const &uris,
|
|
119
|
+
React::ReactPromise<React::JSValue> &&result) noexcept {
|
|
120
|
+
// NYI
|
|
121
|
+
result.Resolve(React::JSValueObject{});
|
|
170
122
|
}
|
|
171
123
|
|
|
172
124
|
} // namespace Microsoft::ReactNative
|
|
@@ -2,31 +2,42 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
|
-
#include <cxxreact/CxxModule.h>
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
#include "../../codegen/NativeImageLoaderIOSSpec.g.h"
|
|
7
|
+
#include <NativeModules.h>
|
|
8
|
+
#include <winrt/Windows.ApplicationModel.h>
|
|
9
|
+
#include <winrt/Windows.Foundation.h>
|
|
10
|
+
#include <winrt/Windows.Graphics.Display.h>
|
|
12
11
|
|
|
13
12
|
namespace Microsoft::ReactNative {
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
REACT_MODULE(ImageLoader)
|
|
15
|
+
struct ImageLoader {
|
|
16
|
+
REACT_INIT(Initialize)
|
|
17
|
+
void Initialize(React::ReactContext const &reactContext) noexcept;
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
std::string
|
|
22
|
-
std::map<std::string, folly::dynamic> getConstants() override;
|
|
23
|
-
auto getMethods() -> std::vector<Method> override;
|
|
19
|
+
REACT_METHOD(getSize)
|
|
20
|
+
void getSize(std::string uri, React::ReactPromise<React::JSValue> &&result) noexcept;
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
REACT_METHOD(getSizeWithHeaders)
|
|
23
|
+
void
|
|
24
|
+
getSizeWithHeaders(std::string uri, React::JSValue &&headers, React::ReactPromise<React::JSValue> &&result) noexcept;
|
|
25
|
+
|
|
26
|
+
REACT_METHOD(prefetchImage)
|
|
27
|
+
void prefetchImage(std::string uri, React::ReactPromise<React::JSValue> &&result) noexcept;
|
|
28
|
+
|
|
29
|
+
REACT_METHOD(prefetchImageWithMetadata)
|
|
30
|
+
void prefetchImageWithMetadata(
|
|
31
|
+
std::string uri,
|
|
32
|
+
std::string queryRootName,
|
|
33
|
+
double rootTag,
|
|
34
|
+
React::ReactPromise<React::JSValue> &&result) noexcept;
|
|
35
|
+
|
|
36
|
+
REACT_METHOD(queryCache)
|
|
37
|
+
void queryCache(std::vector<std::string> const &uris, React::ReactPromise<React::JSValue> &&result) noexcept;
|
|
26
38
|
|
|
27
39
|
private:
|
|
28
|
-
|
|
29
|
-
std::shared_ptr<ImageViewManagerModuleImpl> m_imageViewManagerModule;
|
|
40
|
+
React::ReactContext m_context;
|
|
30
41
|
};
|
|
31
42
|
|
|
32
43
|
} // namespace Microsoft::ReactNative
|
|
@@ -103,14 +103,24 @@ auto LinkingManagerModule::getMethods() -> std::vector<Method> {
|
|
|
103
103
|
Method(
|
|
104
104
|
"openURL",
|
|
105
105
|
[](folly::dynamic args, Callback successCallback, Callback errorCallback) {
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
auto inputUrl = facebook::xplat::jsArgAsString(args, 0);
|
|
107
|
+
try {
|
|
108
|
+
winrt::Windows::Foundation::Uri uri(Utf8ToUtf16(inputUrl));
|
|
109
|
+
openURLAsync(uri, successCallback, errorCallback);
|
|
110
|
+
} catch (winrt::hresult_error &e) {
|
|
111
|
+
errorCallback(
|
|
112
|
+
{folly::dynamic::object("code", e.code().value)("message", "Unable to open URL: " + inputUrl)});
|
|
113
|
+
}
|
|
108
114
|
}),
|
|
109
115
|
Method(
|
|
110
116
|
"canOpenURL",
|
|
111
117
|
[](folly::dynamic args, Callback successCallback, Callback errorCallback) {
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
try {
|
|
119
|
+
winrt::Windows::Foundation::Uri uri(Utf8ToUtf16(facebook::xplat::jsArgAsString(args, 0)));
|
|
120
|
+
canOpenURLAsync(uri, successCallback, errorCallback);
|
|
121
|
+
} catch (winrt::hresult_error &e) {
|
|
122
|
+
successCallback({false});
|
|
123
|
+
}
|
|
114
124
|
}),
|
|
115
125
|
Method(
|
|
116
126
|
"getInitialURL",
|
|
@@ -1070,7 +1070,7 @@ void NativeUIManager::findSubviewIn(
|
|
|
1070
1070
|
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
1071
1071
|
auto view = node.GetView();
|
|
1072
1072
|
|
|
1073
|
-
auto rootUIView = view.
|
|
1073
|
+
auto rootUIView = view.try_as<xaml::UIElement>();
|
|
1074
1074
|
if (rootUIView == nullptr) {
|
|
1075
1075
|
m_context.JSDispatcher().Post([callback = std::move(callback)]() { callback(0, 0, 0, 0, 0); });
|
|
1076
1076
|
return;
|