react-native-windows 0.69.6 → 0.70.0
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 +5 -1
- package/Chakra/ChakraHelpers.cpp +1 -1
- package/Chakra/ChakraPlatform.cpp +1 -1
- package/Chakra/ChakraValue.cpp +6 -3
- package/Chakra/ChakraValue.h +1 -1
- package/Directory.Build.props +7 -7
- package/Folly/Folly.vcxproj +20 -13
- package/Folly/cgmanifest.json +14 -0
- package/Libraries/Alert/Alert.js +18 -4
- package/Libraries/Alert/Alert.windows.js +4 -0
- package/Libraries/Alert/NativeAlertManager.js +1 -0
- package/Libraries/Animated/Animated.js +2 -2
- package/Libraries/Animated/AnimatedEvent.js +7 -4
- package/Libraries/Animated/AnimatedImplementation.js +17 -3
- package/Libraries/Animated/AnimatedMock.js +7 -2
- package/Libraries/Animated/NativeAnimatedHelper.js +220 -95
- package/Libraries/Animated/NativeAnimatedModule.js +3 -0
- package/Libraries/Animated/NativeAnimatedTurboModule.js +3 -0
- package/Libraries/Animated/animations/SpringAnimation.js +3 -3
- package/Libraries/Animated/animations/TimingAnimation.js +3 -3
- package/Libraries/Animated/createAnimatedComponent.js +8 -1
- package/Libraries/Animated/nodes/AnimatedAddition.js +3 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +50 -29
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -1
- package/Libraries/Animated/nodes/AnimatedDivision.js +3 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +22 -21
- package/Libraries/Animated/nodes/AnimatedModulo.js +3 -1
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +3 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +20 -12
- package/Libraries/Animated/nodes/AnimatedStyle.js +19 -16
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +3 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
- package/Libraries/Animated/nodes/AnimatedValue.js +14 -5
- package/Libraries/Animated/nodes/AnimatedValueXY.js +28 -1
- package/Libraries/Animated/useAnimatedProps.js +1 -0
- package/Libraries/AppState/AppState.js +0 -32
- package/Libraries/AppTheme/AppTheme.js +14 -8
- package/Libraries/AppTheme/AppThemeTypes.d.ts +0 -3
- package/Libraries/BatchedBridge/MessageQueue.js +21 -15
- package/Libraries/BatchedBridge/NativeModules.js +3 -4
- package/Libraries/Blob/FileReader.js +0 -6
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +0 -20
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +0 -20
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
- package/Libraries/Components/Keyboard/Keyboard.js +0 -11
- package/Libraries/Components/Pressable/Pressable.js +2 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +2 -0
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
- package/Libraries/Components/SafeAreaView/SafeAreaView.windows.js +4 -30
- package/Libraries/Components/ScrollView/ScrollView.js +13 -11
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -3
- package/Libraries/Components/StatusBar/StatusBar.js +10 -7
- package/Libraries/Components/TextInput/InputAccessoryView.js +14 -13
- package/Libraries/Components/TextInput/TextInput.js +12 -2
- package/Libraries/Components/TextInput/TextInput.windows.js +12 -2
- package/Libraries/Components/Touchable/PooledClass.js +16 -4
- package/Libraries/Components/Touchable/Touchable.js +50 -1
- package/Libraries/Components/Touchable/Touchable.windows.js +972 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +3 -8
- package/Libraries/Components/View/ViewPropTypes.windows.js +3 -8
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/Timers/JSTimers.js +2 -2
- package/Libraries/Core/polyfillPromise.js +0 -32
- package/Libraries/Core/setUpBatchedBridge.js +5 -1
- package/Libraries/Core/setUpPerformance.js +1 -1
- package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
- package/Libraries/Image/AssetSourceResolver.js +2 -2
- package/Libraries/Image/Image.android.js +5 -3
- package/Libraries/Image/Image.ios.js +6 -3
- package/Libraries/Image/Image.windows.js +6 -3
- package/Libraries/Image/ImageSource.js +7 -5
- package/Libraries/Inspector/ElementBox.js +2 -2
- package/Libraries/Inspector/NetworkOverlay.js +13 -8
- package/Libraries/Interaction/PanResponder.js +16 -14
- package/Libraries/Linking/Linking.js +0 -11
- package/Libraries/Lists/FlatList.js +3 -2
- package/Libraries/Lists/SectionList.js +2 -0
- package/Libraries/Lists/ViewabilityHelper.js +7 -3
- package/Libraries/Lists/VirtualizeUtils.js +33 -20
- package/Libraries/Lists/VirtualizedList.js +93 -47
- package/Libraries/Lists/VirtualizedListContext.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +14 -9
- package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
- package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +3 -1
- package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
- package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +26 -12
- package/Libraries/Network/XMLHttpRequest.js +9 -11
- package/Libraries/Performance/PureComponentDebug.js +1 -0
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
- package/Libraries/Pressability/Pressability.js +26 -16
- package/Libraries/Pressability/Pressability.windows.js +30 -17
- package/Libraries/Promise.js +0 -1
- package/Libraries/ReactNative/AppRegistry.js +16 -13
- package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
- package/Libraries/ReactNative/PaperUIManager.js +9 -9
- package/Libraries/ReactNative/PaperUIManager.windows.js +7 -8
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
- package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
- package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
- package/Libraries/ReactNative/renderApplication.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
- package/Libraries/Storage/AsyncStorage.js +7 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
- package/Libraries/StyleSheet/flattenStyle.js +1 -1
- package/Libraries/StyleSheet/processTransform.js +2 -0
- package/Libraries/StyleSheet/processTransform.windows.js +2 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
- package/Libraries/Text/Text.js +15 -7
- package/Libraries/Text/Text.windows.js +14 -7
- package/Libraries/Types/CoreEventTypes.js +137 -11
- package/Libraries/Types/CoreEventTypes.windows.js +147 -22
- package/Libraries/Utilities/Dimensions.js +0 -13
- package/Libraries/Utilities/HMRClient.js +3 -3
- package/Libraries/Utilities/Platform.ios.js +0 -7
- package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
- package/Libraries/Utilities/codegenNativeCommands.js +11 -2
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/stringifySafe.js +3 -1
- package/Libraries/Utilities/truncate.js +1 -1
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
- package/Libraries/Vibration/Vibration.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +1 -0
- package/Libraries/vendor/emitter/EventEmitter.js +105 -12
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
- package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +24 -12
- package/Microsoft.ReactNative/CoreApp.cpp +303 -0
- package/Microsoft.ReactNative/CoreAppPage.cpp +21 -0
- package/Microsoft.ReactNative/CoreAppPage.h +15 -0
- package/Microsoft.ReactNative/CoreAppPage.idl +12 -0
- package/Microsoft.ReactNative/CoreAppPage.xaml +14 -0
- package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ImageComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ImageComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ParagraphComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ParagraphComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/SliderComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/SliderComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/SwitchComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/SwitchComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/TextComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/TextComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ViewComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ViewComponentView.h +1 -1
- package/Microsoft.ReactNative/GlyphViewManager.cpp +1 -0
- package/Microsoft.ReactNative/IReactDispatcher.cpp +18 -0
- package/Microsoft.ReactNative/IReactDispatcher.h +18 -3
- package/Microsoft.ReactNative/IReactDispatcher.idl +15 -0
- package/Microsoft.ReactNative/IReactPropertyBag.cpp +9 -0
- package/Microsoft.ReactNative/IReactPropertyBag.h +3 -0
- package/Microsoft.ReactNative/IReactPropertyBag.idl +3 -0
- package/Microsoft.ReactNative/JSDispatcherWriter.cpp +60 -22
- package/Microsoft.ReactNative/JSDispatcherWriter.h +5 -3
- package/Microsoft.ReactNative/JsiApi.cpp +41 -1
- package/Microsoft.ReactNative/JsiApi.h +3 -0
- package/Microsoft.ReactNative/JsiApi.idl +19 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +18 -2
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +7 -7
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +15 -12
- package/Microsoft.ReactNative/Modules/AlertModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +45 -9
- package/Microsoft.ReactNative/Modules/AppStateModule.h +9 -3
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +1 -1
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DevSettingsModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/I18nManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +66 -39
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +41 -11
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +1 -1
- package/Microsoft.ReactNative/QuirkSettings.cpp +22 -0
- package/Microsoft.ReactNative/QuirkSettings.h +10 -0
- package/Microsoft.ReactNative/QuirkSettings.idl +7 -0
- package/Microsoft.ReactNative/ReactApplication.cpp +44 -0
- package/Microsoft.ReactNative/ReactApplication.h +40 -5
- package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.cpp +5 -2
- package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.h +1 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +24 -4
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +12 -2
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +146 -84
- package/Microsoft.ReactNative/TurboModulesProvider.h +5 -0
- package/Microsoft.ReactNative/Utils/BatchingEventEmitter.cpp +1 -0
- package/Microsoft.ReactNative/Utils/Helpers.cpp +1 -1
- package/Microsoft.ReactNative/Utils/Helpers.h +1 -1
- package/Microsoft.ReactNative/Utils/PropertyUtils.h +1 -1
- package/Microsoft.ReactNative/Utils/TransformableText.h +1 -1
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -1
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +9 -7
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +3 -3
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +13 -1
- package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +1 -1
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +63 -13
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +1 -1
- package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +5 -6
- package/Microsoft.ReactNative/Views/Image/ReactImage.h +4 -4
- package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +1 -1
- package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +21 -2
- package/Microsoft.ReactNative/Views/TextViewManager.cpp +6 -3
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +7 -1
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +4 -0
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +8 -3
- package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +2 -0
- package/Microsoft.ReactNative/microsoft.reactnative.def +4 -1
- package/Microsoft.ReactNative.Cxx/AppModelHelpers.h +17 -0
- package/Microsoft.ReactNative.Cxx/CoreApp.h +60 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +65 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +13 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.cpp +53 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.h +32 -0
- package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +84 -0
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +14 -2
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +4 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +10 -0
- package/Microsoft.ReactNative.Managed/packages.lock.json +1 -24
- package/Mso/dispatchQueue/dispatchQueue.h +12 -4
- package/Mso/src/dispatchQueue/looperScheduler.cpp +36 -9
- package/Mso/src/dispatchQueue/queueService.cpp +2 -2
- package/Mso/src/dispatchQueue/queueService.h +2 -2
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +6 -1
- package/Mso/src/memoryApi/memoryApi.cpp +3 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/Release.props +6 -0
- package/ReactCommon/ReactCommon.vcxproj +11 -21
- package/ReactCommon/ReactCommon.vcxproj.filters +64 -46
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +145 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +344 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseTextProps.cpp +313 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.cpp +455 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ConcreteComponentDescriptor.h +216 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/PropsMacros.h +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/graphics/RectangleEdges.h +100 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/CompactValue.h +3 -1
- package/Scripts/Microsoft.ReactNative.nuspec +6 -0
- package/Scripts/Microsoft.ReactNative.targets +7 -0
- package/Shared/DevSettings.h +4 -0
- package/Shared/InstanceManager.cpp +29 -0
- package/Shared/InstanceManager.h +14 -0
- package/Shared/JSI/ChakraRuntime.cpp +11 -2
- package/Shared/JSI/ChakraRuntime.h +2 -0
- package/Shared/Modules/BlobModule.cpp +4 -4
- package/Shared/Modules/BlobModule.h +1 -1
- package/Shared/Modules/FileReaderModule.cpp +3 -2
- package/Shared/Modules/IBlobPersistor.h +1 -1
- package/Shared/Networking/IHttpResource.h +1 -0
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +16 -10
- package/Shared/Networking/WinRTHttpResource.cpp +34 -2
- package/Shared/OInstance.cpp +29 -6
- package/Shared/OInstance.h +4 -13
- package/Shared/Threading/BatchingQueueThread.cpp +23 -12
- package/Shared/Utils.cpp +2 -5
- package/codegen/NativeAlertManagerSpec.g.h +2 -0
- package/codegen/NativeAnimatedModuleSpec.g.h +6 -0
- package/codegen/NativeAnimatedTurboModuleSpec.g.h +6 -0
- package/codegen/react/components/rnwcore/Props.cpp +2 -2
- package/codegen/react/components/rnwcore/Props.h +1 -1
- package/fmt/cgmanifest.json +14 -0
- package/fmt/fmt.vcxproj +25 -11
- package/jest/assetFileTransformer.js +3 -2
- package/jest/setup.js +4 -0
- package/package.json +25 -26
- package/rntypes/index.d.ts +0 -1
- package/template/cs-app-WinAppSDK/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/template/metro.devMode.config.js +49 -2
- package/template/shared-app/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/template/shared-lib/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/Libraries/vendor/emitter/EventSubscription.js +0 -19
- package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
- package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
- package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
- package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +0 -87
- package/Scripts/copyRNLibraries.js +0 -99
- package/jest/preprocessor.js +0 -40
- package/jest/preprocessor_DO_NOT_USE.js +0 -122
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
//
|
|
3
4
|
// IMPORTANT: Before updating this file
|
|
4
5
|
// please read react-native-windows repo:
|
|
5
6
|
// vnext/Microsoft.ReactNative.Cxx/README.md
|
|
@@ -21,6 +22,7 @@ using namespace winrt;
|
|
|
21
22
|
using namespace Windows::Foundation;
|
|
22
23
|
|
|
23
24
|
namespace winrt::Microsoft::ReactNative {
|
|
25
|
+
|
|
24
26
|
/*-------------------------------------------------------------------------------
|
|
25
27
|
TurboModuleBuilder
|
|
26
28
|
-------------------------------------------------------------------------------*/
|
|
@@ -56,10 +58,17 @@ struct TurboModuleBuilder : winrt::implements<TurboModuleBuilder, IReactModuleBu
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
public:
|
|
59
|
-
std::unordered_map<std::string, TurboModuleMethodInfo>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const std::unordered_map<std::string, TurboModuleMethodInfo> &Methods() const noexcept {
|
|
62
|
+
return m_methods;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const std::unordered_map<std::string, SyncMethodDelegate> &SyncMethods() const noexcept {
|
|
66
|
+
return m_syncMethods;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const std::vector<ConstantProviderDelegate> &ConstantProviders() const noexcept {
|
|
70
|
+
return m_constantProviders;
|
|
71
|
+
}
|
|
63
72
|
|
|
64
73
|
private:
|
|
65
74
|
void EnsureMemberNotSet(const std::string &key, bool checkingMethod) noexcept {
|
|
@@ -72,6 +81,10 @@ struct TurboModuleBuilder : winrt::implements<TurboModuleBuilder, IReactModuleBu
|
|
|
72
81
|
|
|
73
82
|
private:
|
|
74
83
|
IReactContext m_reactContext;
|
|
84
|
+
std::unordered_map<std::string, TurboModuleMethodInfo> m_methods;
|
|
85
|
+
std::unordered_map<std::string, SyncMethodDelegate> m_syncMethods;
|
|
86
|
+
std::vector<ConstantProviderDelegate> m_constantProviders;
|
|
87
|
+
bool m_constantsEvaluated{false};
|
|
75
88
|
};
|
|
76
89
|
|
|
77
90
|
/*-------------------------------------------------------------------------------
|
|
@@ -84,11 +97,13 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
84
97
|
const IReactContext &reactContext,
|
|
85
98
|
const std::string &name,
|
|
86
99
|
const std::shared_ptr<facebook::react::CallInvoker> &jsInvoker,
|
|
100
|
+
std::weak_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
87
101
|
const ReactModuleProvider &reactModuleProvider)
|
|
88
102
|
: facebook::react::TurboModule(name, jsInvoker),
|
|
89
103
|
m_reactContext(reactContext),
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
m_longLivedObjectCollection(std::move(longLivedObjectCollection)),
|
|
105
|
+
m_moduleBuilder(winrt::make_self<TurboModuleBuilder>(reactContext)),
|
|
106
|
+
m_providedModule(reactModuleProvider(m_moduleBuilder.as<IReactModuleBuilder>())) {
|
|
92
107
|
if (auto hostObject = m_providedModule.try_as<IJsiHostObject>()) {
|
|
93
108
|
m_hostObjectWrapper = std::make_shared<implementation::HostObjectWrapper>(hostObject);
|
|
94
109
|
}
|
|
@@ -99,12 +114,23 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
99
114
|
return m_hostObjectWrapper->getPropertyNames(rt);
|
|
100
115
|
}
|
|
101
116
|
|
|
102
|
-
auto turboModuleBuilder = m_moduleBuilder.as<TurboModuleBuilder>();
|
|
103
117
|
std::vector<facebook::jsi::PropNameID> propertyNames;
|
|
104
|
-
propertyNames.reserve(
|
|
105
|
-
|
|
118
|
+
propertyNames.reserve(
|
|
119
|
+
m_moduleBuilder->Methods().size() + m_moduleBuilder->SyncMethods().size() +
|
|
120
|
+
(m_moduleBuilder->ConstantProviders().empty() ? 0 : 1));
|
|
121
|
+
|
|
122
|
+
for (auto &methodInfo : m_moduleBuilder->Methods()) {
|
|
106
123
|
propertyNames.push_back(facebook::jsi::PropNameID::forAscii(rt, methodInfo.first));
|
|
107
124
|
}
|
|
125
|
+
|
|
126
|
+
for (auto &syncMethodInfo : m_moduleBuilder->SyncMethods()) {
|
|
127
|
+
propertyNames.push_back(facebook::jsi::PropNameID::forAscii(rt, syncMethodInfo.first));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (!m_moduleBuilder->ConstantProviders().empty()) {
|
|
131
|
+
propertyNames.push_back(facebook::jsi::PropNameID::forAscii(rt, "getConstants"));
|
|
132
|
+
}
|
|
133
|
+
|
|
108
134
|
return propertyNames;
|
|
109
135
|
};
|
|
110
136
|
|
|
@@ -114,24 +140,23 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
114
140
|
}
|
|
115
141
|
|
|
116
142
|
// it is not safe to assume that "runtime" never changes, so members are not cached here
|
|
117
|
-
auto moduleBuilder = m_moduleBuilder.as<TurboModuleBuilder>();
|
|
118
143
|
std::string key = propName.utf8(runtime);
|
|
119
144
|
|
|
120
|
-
if (key == "getConstants" && !
|
|
145
|
+
if (key == "getConstants" && !m_moduleBuilder->ConstantProviders().empty()) {
|
|
121
146
|
// try to find getConstants if there is any constant
|
|
122
147
|
return facebook::jsi::Function::createFromHostFunction(
|
|
123
148
|
runtime,
|
|
124
149
|
propName,
|
|
125
150
|
0,
|
|
126
|
-
[moduleBuilder](
|
|
151
|
+
[moduleBuilder = m_moduleBuilder](
|
|
127
152
|
facebook::jsi::Runtime &rt,
|
|
128
|
-
const facebook::jsi::Value &thisVal
|
|
129
|
-
const facebook::jsi::Value *args
|
|
130
|
-
size_t count) {
|
|
153
|
+
const facebook::jsi::Value & /*thisVal*/,
|
|
154
|
+
const facebook::jsi::Value * /*args*/,
|
|
155
|
+
size_t /*count*/) {
|
|
131
156
|
// collect all constants to an object
|
|
132
157
|
auto writer = winrt::make<JsiWriter>(rt);
|
|
133
158
|
writer.WriteObjectBegin();
|
|
134
|
-
for (auto constantProvider : moduleBuilder->
|
|
159
|
+
for (auto const &constantProvider : moduleBuilder->ConstantProviders()) {
|
|
135
160
|
constantProvider(writer);
|
|
136
161
|
}
|
|
137
162
|
writer.WriteObjectEnd();
|
|
@@ -141,21 +166,21 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
141
166
|
|
|
142
167
|
{
|
|
143
168
|
// try to find a Method
|
|
144
|
-
auto it =
|
|
145
|
-
if (it !=
|
|
146
|
-
TurboModuleMethodInfo methodInfo = it->second;
|
|
169
|
+
auto it = m_moduleBuilder->Methods().find(key);
|
|
170
|
+
if (it != m_moduleBuilder->Methods().end()) {
|
|
171
|
+
TurboModuleMethodInfo const &methodInfo = it->second;
|
|
147
172
|
switch (methodInfo.ReturnType) {
|
|
148
173
|
case MethodReturnType::Void:
|
|
149
174
|
return facebook::jsi::Function::createFromHostFunction(
|
|
150
175
|
runtime,
|
|
151
176
|
propName,
|
|
152
177
|
0,
|
|
153
|
-
[methodInfo](
|
|
178
|
+
[method = methodInfo.Method](
|
|
154
179
|
facebook::jsi::Runtime &rt,
|
|
155
180
|
const facebook::jsi::Value & /*thisVal*/,
|
|
156
181
|
const facebook::jsi::Value *args,
|
|
157
182
|
size_t argCount) {
|
|
158
|
-
|
|
183
|
+
method(winrt::make<JsiReader>(rt, args, argCount), nullptr, nullptr, nullptr);
|
|
159
184
|
return facebook::jsi::Value::undefined();
|
|
160
185
|
});
|
|
161
186
|
case MethodReturnType::Callback:
|
|
@@ -163,17 +188,22 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
163
188
|
runtime,
|
|
164
189
|
propName,
|
|
165
190
|
0,
|
|
166
|
-
[jsDispatcher = m_reactContext.JSDispatcher(),
|
|
191
|
+
[jsDispatcher = m_reactContext.JSDispatcher(),
|
|
192
|
+
method = methodInfo.Method,
|
|
193
|
+
longLivedObjectCollection = m_longLivedObjectCollection](
|
|
167
194
|
facebook::jsi::Runtime &rt,
|
|
168
195
|
const facebook::jsi::Value & /*thisVal*/,
|
|
169
196
|
const facebook::jsi::Value *args,
|
|
170
197
|
size_t argCount) {
|
|
171
198
|
VerifyElseCrash(argCount > 0);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
199
|
+
if (auto strongLongLivedObjectCollection = longLivedObjectCollection.lock()) {
|
|
200
|
+
auto jsiRuntimeHolder = LongLivedJsiRuntime::CreateWeak(strongLongLivedObjectCollection, rt);
|
|
201
|
+
method(
|
|
202
|
+
winrt::make<JsiReader>(rt, args, argCount - 1),
|
|
203
|
+
winrt::make<JSDispatcherWriter>(jsDispatcher, jsiRuntimeHolder),
|
|
204
|
+
MakeCallback(rt, strongLongLivedObjectCollection, args[argCount - 1]),
|
|
205
|
+
nullptr);
|
|
206
|
+
}
|
|
177
207
|
return facebook::jsi::Value::undefined();
|
|
178
208
|
});
|
|
179
209
|
case MethodReturnType::TwoCallbacks:
|
|
@@ -181,17 +211,22 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
181
211
|
runtime,
|
|
182
212
|
propName,
|
|
183
213
|
0,
|
|
184
|
-
[jsDispatcher = m_reactContext.JSDispatcher(),
|
|
214
|
+
[jsDispatcher = m_reactContext.JSDispatcher(),
|
|
215
|
+
method = methodInfo.Method,
|
|
216
|
+
longLivedObjectCollection = m_longLivedObjectCollection](
|
|
185
217
|
facebook::jsi::Runtime &rt,
|
|
186
218
|
const facebook::jsi::Value & /*thisVal*/,
|
|
187
219
|
const facebook::jsi::Value *args,
|
|
188
220
|
size_t argCount) {
|
|
189
221
|
VerifyElseCrash(argCount > 1);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
222
|
+
if (auto strongLongLivedObjectCollection = longLivedObjectCollection.lock()) {
|
|
223
|
+
auto jsiRuntimeHolder = LongLivedJsiRuntime::CreateWeak(strongLongLivedObjectCollection, rt);
|
|
224
|
+
method(
|
|
225
|
+
winrt::make<JsiReader>(rt, args, argCount - 2),
|
|
226
|
+
winrt::make<JSDispatcherWriter>(jsDispatcher, jsiRuntimeHolder),
|
|
227
|
+
MakeCallback(rt, strongLongLivedObjectCollection, args[argCount - 2]),
|
|
228
|
+
MakeCallback(rt, strongLongLivedObjectCollection, args[argCount - 1]));
|
|
229
|
+
}
|
|
195
230
|
return facebook::jsi::Value::undefined();
|
|
196
231
|
});
|
|
197
232
|
case MethodReturnType::Promise:
|
|
@@ -199,52 +234,66 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
199
234
|
runtime,
|
|
200
235
|
propName,
|
|
201
236
|
0,
|
|
202
|
-
[jsDispatcher = m_reactContext.JSDispatcher(),
|
|
237
|
+
[jsDispatcher = m_reactContext.JSDispatcher(),
|
|
238
|
+
method = methodInfo.Method,
|
|
239
|
+
longLivedObjectCollection = m_longLivedObjectCollection](
|
|
203
240
|
facebook::jsi::Runtime &rt,
|
|
204
241
|
const facebook::jsi::Value & /*thisVal*/,
|
|
205
242
|
const facebook::jsi::Value *args,
|
|
206
243
|
size_t count) {
|
|
207
|
-
auto
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
244
|
+
if (auto strongLongLivedObjectCollection = longLivedObjectCollection.lock()) {
|
|
245
|
+
auto jsiRuntimeHolder = LongLivedJsiRuntime::CreateWeak(strongLongLivedObjectCollection, rt);
|
|
246
|
+
auto argReader = winrt::make<JsiReader>(rt, args, count);
|
|
247
|
+
auto argWriter = winrt::make<JSDispatcherWriter>(jsDispatcher, jsiRuntimeHolder);
|
|
248
|
+
return facebook::react::createPromiseAsJSIValue(
|
|
249
|
+
rt,
|
|
250
|
+
[method, argReader, argWriter, strongLongLivedObjectCollection](
|
|
251
|
+
facebook::jsi::Runtime &runtime, std::shared_ptr<facebook::react::Promise> promise) {
|
|
252
|
+
method(
|
|
253
|
+
argReader,
|
|
254
|
+
argWriter,
|
|
255
|
+
[weakResolve = LongLivedJsiFunction::CreateWeak(
|
|
256
|
+
strongLongLivedObjectCollection, runtime, std::move(promise->resolve_))](
|
|
257
|
+
const IJSValueWriter &writer) {
|
|
258
|
+
writer.as<JSDispatcherWriter>()->WithResultArgs([weakResolve](
|
|
259
|
+
facebook::jsi::Runtime &runtime,
|
|
260
|
+
facebook::jsi::Value const *args,
|
|
261
|
+
size_t argCount) {
|
|
262
|
+
VerifyElseCrash(argCount == 1);
|
|
263
|
+
if (auto resolveHolder = weakResolve.lock()) {
|
|
264
|
+
resolveHolder->Value().call(runtime, args[0]);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
[weakReject = LongLivedJsiFunction::CreateWeak(
|
|
269
|
+
strongLongLivedObjectCollection, runtime, std::move(promise->reject_))](
|
|
270
|
+
const IJSValueWriter &writer) {
|
|
271
|
+
writer.as<JSDispatcherWriter>()->WithResultArgs([weakReject](
|
|
272
|
+
facebook::jsi::Runtime &runtime,
|
|
273
|
+
facebook::jsi::Value const *args,
|
|
274
|
+
size_t argCount) {
|
|
275
|
+
VerifyElseCrash(argCount == 1);
|
|
276
|
+
if (auto rejectHolder = weakReject.lock()) {
|
|
277
|
+
// To match the Android and iOS TurboModule behavior we create the Error object for
|
|
278
|
+
// the Promise rejection the same way as in updateErrorWithErrorData method.
|
|
279
|
+
// See react-native/Libraries/BatchedBridge/NativeModules.js for details.
|
|
280
|
+
auto error = runtime.global()
|
|
281
|
+
.getPropertyAsFunction(runtime, "Error")
|
|
282
|
+
.callAsConstructor(runtime, {});
|
|
283
|
+
auto &errorData = args[0];
|
|
284
|
+
if (errorData.isObject()) {
|
|
285
|
+
runtime.global()
|
|
286
|
+
.getPropertyAsObject(runtime, "Object")
|
|
287
|
+
.getPropertyAsFunction(runtime, "assign")
|
|
288
|
+
.call(runtime, error, errorData.getObject(runtime));
|
|
289
|
+
}
|
|
290
|
+
rejectHolder->Value().call(runtime, args[0]);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
223
293
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
facebook::jsi::Runtime &runtime,
|
|
228
|
-
facebook::jsi::Value const *args,
|
|
229
|
-
size_t argCount) {
|
|
230
|
-
VerifyElseCrash(argCount == 1);
|
|
231
|
-
// To match the Android and iOS TurboModule behavior we create the Error object for
|
|
232
|
-
// the Promise rejection the same way as in updateErrorWithErrorData method.
|
|
233
|
-
// See react-native/Libraries/BatchedBridge/NativeModules.js for details.
|
|
234
|
-
auto error = runtime.global()
|
|
235
|
-
.getPropertyAsFunction(runtime, "Error")
|
|
236
|
-
.callAsConstructor(runtime, {});
|
|
237
|
-
auto &errorData = args[0];
|
|
238
|
-
if (errorData.isObject()) {
|
|
239
|
-
runtime.global()
|
|
240
|
-
.getPropertyAsObject(runtime, "Object")
|
|
241
|
-
.getPropertyAsFunction(runtime, "assign")
|
|
242
|
-
.call(runtime, error, errorData.getObject(runtime));
|
|
243
|
-
}
|
|
244
|
-
promise->reject_.call(runtime, error);
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
});
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return facebook::jsi::Value::undefined();
|
|
248
297
|
});
|
|
249
298
|
default:
|
|
250
299
|
VerifyElseCrash(false);
|
|
@@ -254,8 +303,8 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
254
303
|
|
|
255
304
|
{
|
|
256
305
|
// try to find a SyncMethod
|
|
257
|
-
auto it =
|
|
258
|
-
if (it !=
|
|
306
|
+
auto it = m_moduleBuilder->SyncMethods().find(key);
|
|
307
|
+
if (it != m_moduleBuilder->SyncMethods().end()) {
|
|
259
308
|
return facebook::jsi::Function::createFromHostFunction(
|
|
260
309
|
runtime,
|
|
261
310
|
propName,
|
|
@@ -287,27 +336,34 @@ class TurboModuleImpl : public facebook::react::TurboModule {
|
|
|
287
336
|
}
|
|
288
337
|
|
|
289
338
|
private:
|
|
290
|
-
static MethodResultCallback MakeCallback(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
339
|
+
static MethodResultCallback MakeCallback(
|
|
340
|
+
facebook::jsi::Runtime &rt,
|
|
341
|
+
const std::shared_ptr<facebook::react::LongLivedObjectCollection> &longLivedObjectCollection,
|
|
342
|
+
const facebook::jsi::Value &callback) noexcept {
|
|
343
|
+
auto weakCallback =
|
|
344
|
+
LongLivedJsiFunction::CreateWeak(longLivedObjectCollection, rt, callback.getObject(rt).getFunction(rt));
|
|
345
|
+
return [weakCallback = std::move(weakCallback)](const IJSValueWriter &writer) noexcept {
|
|
294
346
|
writer.as<JSDispatcherWriter>()->WithResultArgs(
|
|
295
|
-
[
|
|
296
|
-
|
|
347
|
+
[weakCallback](facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t count) {
|
|
348
|
+
if (auto callback = weakCallback.lock()) {
|
|
349
|
+
callback->Value().call(rt, args, count);
|
|
350
|
+
}
|
|
297
351
|
});
|
|
298
352
|
};
|
|
299
353
|
}
|
|
300
354
|
|
|
301
355
|
private:
|
|
302
356
|
IReactContext m_reactContext;
|
|
303
|
-
|
|
357
|
+
winrt::com_ptr<TurboModuleBuilder> m_moduleBuilder;
|
|
304
358
|
IInspectable m_providedModule;
|
|
305
359
|
std::shared_ptr<implementation::HostObjectWrapper> m_hostObjectWrapper;
|
|
360
|
+
std::weak_ptr<facebook::react::LongLivedObjectCollection> m_longLivedObjectCollection;
|
|
306
361
|
};
|
|
307
362
|
|
|
308
363
|
/*-------------------------------------------------------------------------------
|
|
309
364
|
TurboModulesProvider
|
|
310
365
|
-------------------------------------------------------------------------------*/
|
|
366
|
+
|
|
311
367
|
std::shared_ptr<facebook::react::TurboModule> TurboModulesProvider::getModule(
|
|
312
368
|
const std::string &moduleName,
|
|
313
369
|
const std::shared_ptr<facebook::react::CallInvoker> &callInvoker) noexcept {
|
|
@@ -317,7 +373,8 @@ std::shared_ptr<facebook::react::TurboModule> TurboModulesProvider::getModule(
|
|
|
317
373
|
return nullptr;
|
|
318
374
|
}
|
|
319
375
|
|
|
320
|
-
auto tm = std::make_shared<TurboModuleImpl>(
|
|
376
|
+
auto tm = std::make_shared<TurboModuleImpl>(
|
|
377
|
+
m_reactContext, moduleName, callInvoker, m_longLivedObjectCollection, /*reactModuleProvider*/ it->second);
|
|
321
378
|
return tm;
|
|
322
379
|
}
|
|
323
380
|
|
|
@@ -348,4 +405,9 @@ void TurboModulesProvider::AddModuleProvider(
|
|
|
348
405
|
}
|
|
349
406
|
}
|
|
350
407
|
|
|
408
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> const &
|
|
409
|
+
TurboModulesProvider::LongLivedObjectCollection() noexcept {
|
|
410
|
+
return m_longLivedObjectCollection;
|
|
411
|
+
}
|
|
412
|
+
|
|
351
413
|
} // namespace winrt::Microsoft::ReactNative
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
#pragma once
|
|
8
8
|
|
|
9
|
+
#include <ReactCommon/LongLivedObject.h>
|
|
9
10
|
#include <TurboModuleRegistry.h>
|
|
10
11
|
#include "Base/FollyIncludes.h"
|
|
11
12
|
#include "winrt/Microsoft.ReactNative.h"
|
|
@@ -25,8 +26,12 @@ class TurboModulesProvider final : public facebook::react::TurboModuleRegistry {
|
|
|
25
26
|
winrt::hstring const &moduleName,
|
|
26
27
|
ReactModuleProvider const &moduleProvider,
|
|
27
28
|
bool overwriteExisting) noexcept;
|
|
29
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> const &LongLivedObjectCollection() noexcept;
|
|
28
30
|
|
|
29
31
|
private:
|
|
32
|
+
// To keep a list of deferred asynchronous callbacks and promises.
|
|
33
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> m_longLivedObjectCollection{
|
|
34
|
+
std::make_shared<facebook::react::LongLivedObjectCollection>()};
|
|
30
35
|
std::unordered_map<std::string, ReactModuleProvider> m_moduleProviders;
|
|
31
36
|
IReactContext m_reactContext;
|
|
32
37
|
};
|
|
@@ -31,7 +31,7 @@ namespace Microsoft::ReactNative {
|
|
|
31
31
|
// Instead of deduce view id directly from FrameworkElement.Tag, this do
|
|
32
32
|
// additional check by uimanager.
|
|
33
33
|
ReactId getViewId(const Mso::React::IReactContext &context, xaml::FrameworkElement const &fe) {
|
|
34
|
-
ReactId reactId;
|
|
34
|
+
ReactId reactId{};
|
|
35
35
|
if (auto uiManager = Microsoft::ReactNative::GetNativeUIManager(context).lock()) {
|
|
36
36
|
if (auto peer = uiManager->reactPeerOrContainerFrom(fe)) {
|
|
37
37
|
reactId.isValid = true;
|
|
@@ -149,10 +149,10 @@ bool TryUpdateForeground(
|
|
|
149
149
|
}
|
|
150
150
|
} else if (propertyValue.IsNull()) {
|
|
151
151
|
element.ClearValue(T::ForegroundProperty());
|
|
152
|
-
UpdateControlForegroundResourceBrushes(element, nullptr);
|
|
153
152
|
if (uielement) {
|
|
154
153
|
uielement.HighContrastAdjustment(xaml::ElementHighContrastAdjustment::Application);
|
|
155
154
|
}
|
|
155
|
+
UpdateControlForegroundResourceBrushes(element, nullptr);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
return true;
|
|
@@ -133,7 +133,6 @@ struct BrushCache {
|
|
|
133
133
|
|
|
134
134
|
assert(false && "Resource is not a Color or Brush");
|
|
135
135
|
return xaml::Media::SolidColorBrush(winrt::Colors::Transparent());
|
|
136
|
-
;
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
xaml::Media::Brush RegisterBrush(winrt::hstring resourceName, const xaml::Media::Brush &brush) {
|
|
@@ -312,13 +312,15 @@ winrt::hstring DynamicAutomationPeer::GetContentName() const {
|
|
|
312
312
|
|
|
313
313
|
try {
|
|
314
314
|
if (auto const &viewControl = Owner().try_as<winrt::Microsoft::ReactNative::ViewControl>()) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
315
|
+
// It's possible that the ViewPanel is null, perhaps when this is invoked around the same time
|
|
316
|
+
// that a View is being unmounted, causing a fast fail for EXCEPTION_ACCESS_VIOLATION_READ.
|
|
317
|
+
if (auto viewPanel = viewControl.GetPanel()) {
|
|
318
|
+
for (auto const &child : viewPanel.Children()) {
|
|
319
|
+
if (auto const &textBlock = child.try_as<winrt::TextBlock>()) {
|
|
320
|
+
name = name.empty() ? textBlock.Text() : (L" " + name + textBlock.Text());
|
|
321
|
+
} else if (auto const &stringableName = child.try_as<winrt::IStringable>()) {
|
|
322
|
+
name = (name.empty() ? L"" : L" ") + name + stringableName.ToString();
|
|
323
|
+
}
|
|
322
324
|
}
|
|
323
325
|
}
|
|
324
326
|
}
|
|
@@ -179,7 +179,7 @@ xaml::DependencyProperty DynamicAutomationProperties::AccessibilityValueMinPrope
|
|
|
179
179
|
L"AccessibilityValueMin",
|
|
180
180
|
winrt::xaml_typename<double>(),
|
|
181
181
|
dynamicAutomationTypeName,
|
|
182
|
-
winrt::PropertyMetadata(winrt::box_value(0)));
|
|
182
|
+
winrt::PropertyMetadata(winrt::box_value(0.0)));
|
|
183
183
|
|
|
184
184
|
return s_AccessibilityValueMinProperty;
|
|
185
185
|
}
|
|
@@ -197,7 +197,7 @@ xaml::DependencyProperty DynamicAutomationProperties::AccessibilityValueMaxPrope
|
|
|
197
197
|
L"AccessibilityValueMax",
|
|
198
198
|
winrt::xaml_typename<double>(),
|
|
199
199
|
dynamicAutomationTypeName,
|
|
200
|
-
winrt::PropertyMetadata(winrt::box_value(0)));
|
|
200
|
+
winrt::PropertyMetadata(winrt::box_value(0.0)));
|
|
201
201
|
|
|
202
202
|
return s_AccessibilityValueMaxProperty;
|
|
203
203
|
}
|
|
@@ -215,7 +215,7 @@ xaml::DependencyProperty DynamicAutomationProperties::AccessibilityValueNowPrope
|
|
|
215
215
|
L"AccessibilityValueNow",
|
|
216
216
|
winrt::xaml_typename<double>(),
|
|
217
217
|
dynamicAutomationTypeName,
|
|
218
|
-
winrt::PropertyMetadata(winrt::box_value(0)));
|
|
218
|
+
winrt::PropertyMetadata(winrt::box_value(0.0)));
|
|
219
219
|
|
|
220
220
|
return s_AccessibilityValueNowProperty;
|
|
221
221
|
}
|
|
@@ -122,6 +122,7 @@ class FlyoutShadowNode : public ShadowNodeBase {
|
|
|
122
122
|
winrt::Popup GetFlyoutParentPopup() const;
|
|
123
123
|
winrt::FlyoutPresenter GetFlyoutPresenter() const;
|
|
124
124
|
void OnShowFlyout();
|
|
125
|
+
void LogErrorAndClose(const string &error);
|
|
125
126
|
xaml::FrameworkElement m_targetElement = nullptr;
|
|
126
127
|
winrt::Flyout m_flyout = nullptr;
|
|
127
128
|
bool m_isLightDismissEnabled = true;
|
|
@@ -404,7 +405,13 @@ winrt::Flyout FlyoutShadowNode::GetFlyout() {
|
|
|
404
405
|
void FlyoutShadowNode::OnShowFlyout() {
|
|
405
406
|
AdjustDefaultFlyoutStyle(50000, 50000);
|
|
406
407
|
if (m_isFlyoutShowOptionsSupported) {
|
|
407
|
-
|
|
408
|
+
if (!m_targetElement && m_targetTag > 0) {
|
|
409
|
+
LogErrorAndClose("The target view unmounted before flyout could be shown.");
|
|
410
|
+
} else if (m_targetElement && m_flyout.XamlRoot() != m_targetElement.XamlRoot()) {
|
|
411
|
+
LogErrorAndClose("The target view window lost focus before flyout could be shown.");
|
|
412
|
+
} else {
|
|
413
|
+
m_flyout.ShowAt(m_targetElement, m_showOptions);
|
|
414
|
+
}
|
|
408
415
|
} else {
|
|
409
416
|
winrt::FlyoutBase::ShowAttachedFlyout(m_targetElement);
|
|
410
417
|
}
|
|
@@ -414,6 +421,11 @@ void FlyoutShadowNode::OnShowFlyout() {
|
|
|
414
421
|
}
|
|
415
422
|
}
|
|
416
423
|
|
|
424
|
+
void FlyoutShadowNode::LogErrorAndClose(const std::string &error) {
|
|
425
|
+
GetViewManager()->GetReactContext().CallJSFunction("RCTLog", "logToConsole", folly::dynamic::array("error", error));
|
|
426
|
+
OnFlyoutClosed(GetViewManager()->GetReactContext(), m_tag, false);
|
|
427
|
+
}
|
|
428
|
+
|
|
417
429
|
void FlyoutShadowNode::SetTargetFrameworkElement() {
|
|
418
430
|
if (m_targetTag > 0) {
|
|
419
431
|
if (auto uiManager = GetNativeUIManager(GetViewManager()->GetReactContext()).lock()) {
|
|
@@ -17,7 +17,7 @@ void TransferProperty(
|
|
|
17
17
|
xaml::DependencyProperty oldViewDP,
|
|
18
18
|
xaml::DependencyProperty newViewDP) {
|
|
19
19
|
auto oldValue = oldView.ReadLocalValue(oldViewDP);
|
|
20
|
-
if (oldValue !=
|
|
20
|
+
if (oldValue != xaml::DependencyProperty::UnsetValue()) {
|
|
21
21
|
oldView.ClearValue(oldViewDP);
|
|
22
22
|
newView.SetValue(newViewDP, oldValue);
|
|
23
23
|
}
|