react-native-windows 0.81.1 → 0.82.0-preview.1
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 +11 -10
- package/Directory.Build.props +3 -3
- package/Folly/Folly.vcxproj +1 -3
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
- package/Libraries/Alert/RCTAlertManager.android.js +4 -2
- package/Libraries/Animated/Animated.d.ts +2 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedExports.js.flow +1 -0
- package/Libraries/Animated/AnimatedImplementation.js +4 -2
- package/Libraries/Animated/AnimatedMock.js +1 -1
- package/Libraries/Animated/Easing.js +2 -0
- package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
- package/Libraries/Animated/animations/Animation.js +19 -20
- package/Libraries/Animated/animations/TimingAnimation.js +2 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
- package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
- package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
- package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
- package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
- package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
- package/Libraries/Animated/nodes/AnimatedValue.js +18 -18
- package/Libraries/AppState/AppState.js +8 -4
- package/Libraries/BatchedBridge/MessageQueue.js +4 -0
- package/Libraries/BatchedBridge/NativeModules.js +1 -1
- package/Libraries/Blob/BlobManager.js +1 -1
- package/Libraries/Blob/URLSearchParams.js +2 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +2 -2
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.windows.js +1 -1
- package/Libraries/Components/Flyout/FlyoutNativeComponent.js +2 -2
- package/Libraries/Components/Glyph/GlyphNativeComponent.js +1 -1
- package/Libraries/Components/Popup/PopupNativeComponent.js +1 -0
- package/Libraries/Components/Pressable/Pressable.d.ts +8 -0
- package/Libraries/Components/Pressable/Pressable.js +10 -1
- package/Libraries/Components/Pressable/Pressable.windows.js +30 -2
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +13 -4
- package/Libraries/Components/ScrollView/ScrollView.windows.js +14 -5
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +2 -2
- package/Libraries/Components/Switch/Switch.js +2 -2
- package/Libraries/Components/Switch/Switch.windows.js +2 -2
- package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
- package/Libraries/Components/TextInput/TextInput.flow.windows.js +12 -5
- package/Libraries/Components/TextInput/TextInput.js +14 -5
- package/Libraries/Components/TextInput/TextInput.windows.js +23 -11
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.windows.js +1 -1
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -1
- package/Libraries/Components/View/View.js +81 -167
- package/Libraries/Components/View/View.windows.js +202 -302
- package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
- package/Libraries/Core/Devtools/loadBundleFromServer.windows.js +1 -1
- package/Libraries/Core/ExceptionsManager.js +4 -2
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +37 -10
- package/Libraries/Core/Timers/JSTimers.js +3 -1
- package/Libraries/Core/Timers/immediateShim.js +1 -1
- package/Libraries/Core/Timers/queueMicrotask.js +1 -0
- package/Libraries/Core/setUpPerformance.js +2 -1
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
- package/Libraries/Image/AssetSourceResolver.windows.js +2 -2
- package/Libraries/Image/Image.android.js +327 -111
- package/Libraries/Image/Image.ios.js +6 -1
- package/Libraries/Image/Image.windows.js +28 -61
- package/Libraries/Image/ImageSourceUtils.js +8 -2
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Image/resolveAssetSource.windows.js +1 -1
- package/Libraries/Interaction/InteractionManager.js +118 -167
- package/Libraries/Interaction/PanResponder.js +1 -1
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
- package/Libraries/Lists/FlatList.js +5 -6
- package/Libraries/LogBox/Data/LogBoxData.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/Modal/Modal.windows.js +2 -2
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/NativeComponent/ViewConfig.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.windows.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +20 -5
- package/Libraries/Network/convertRequestBody.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.windows.js +5 -5
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
- package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
- package/Libraries/ReactNative/PaperUIManager.windows.js +4 -4
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
- package/Libraries/ReactNative/RendererImplementation.js +116 -116
- package/Libraries/ReactNative/UIManager.js +3 -3
- package/Libraries/ReactNative/renderApplication.js +1 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
- package/Libraries/Share/Share.js +4 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.windows.js +2 -0
- package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
- package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
- package/Libraries/StyleSheet/flattenStyle.js +2 -2
- package/Libraries/StyleSheet/processAspectRatio.js +2 -0
- package/Libraries/StyleSheet/processFilter.js +5 -5
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
- package/Libraries/Text/Text.js +534 -234
- package/Libraries/Text/Text.windows.js +622 -265
- package/Libraries/Text/TextNativeComponent.js +2 -2
- package/Libraries/Utilities/Appearance.d.ts +3 -5
- package/Libraries/Utilities/Appearance.js +5 -17
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/Platform.android.js +3 -3
- package/Libraries/Utilities/Platform.d.ts +1 -0
- package/Libraries/Utilities/Platform.ios.js +1 -1
- package/Libraries/Utilities/Platform.windows.js +3 -3
- package/Libraries/Utilities/PlatformTypes.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +1 -1
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +32 -0
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +1 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
- package/Libraries/promiseRejectionTrackingOptions.js +17 -31
- package/Libraries/vendor/emitter/EventEmitter.js +1 -1
- package/Microsoft.ReactNative/App.xaml +5 -0
- package/Microsoft.ReactNative/Base/CxxReactIncludes.h +0 -3
- package/Microsoft.ReactNative/CompositionContext.idl +0 -2
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +0 -2
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +26 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +0 -69
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +1 -15
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +2 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +1 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +0 -31
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.h +0 -10
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +65 -32
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +8 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHelpers.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +0 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +2 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +4 -7
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +1 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +68 -53
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +1 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +20 -18
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +10 -3
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +30 -9
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +3 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +550 -4
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +16 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +0 -6
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +53 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +8 -1
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -30
- package/Microsoft.ReactNative/Fabric/Composition/Theme.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +36 -14
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +1 -1
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +8 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.h +3 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +0 -11
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +2 -1
- package/Microsoft.ReactNative/IReactContext.cpp +2 -25
- package/Microsoft.ReactNative/IReactContext.h +0 -7
- package/Microsoft.ReactNative/IReactContext.idl +4 -29
- package/Microsoft.ReactNative/IReactModuleBuilder.cpp +24 -140
- package/Microsoft.ReactNative/IReactModuleBuilder.h +0 -11
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +1 -16
- package/Microsoft.ReactNative/IReactPackageProvider.idl +0 -1
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +10 -0
- package/Microsoft.ReactNative/JsiApi.cpp +4 -3
- package/Microsoft.ReactNative/JsiApi.h +2 -3
- package/Microsoft.ReactNative/JsiApi.idl +3 -2
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +6 -214
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +0 -252
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +0 -37
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +2 -140
- package/Microsoft.ReactNative/Modules/AlertModule.h +0 -2
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +5 -10
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.h +0 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +1 -96
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +0 -14
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +0 -53
- package/Microsoft.ReactNative/Modules/AppStateModule.h +0 -5
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +5 -14
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +0 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +1 -9
- package/Microsoft.ReactNative/Modules/DevSettingsModule.cpp +0 -4
- package/Microsoft.ReactNative/Modules/DevSettingsModule.h +0 -2
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +16 -90
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +3 -8
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +11 -48
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.cpp +0 -3
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +30 -102
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +0 -7
- package/Microsoft.ReactNative/Modules/Timing.cpp +7 -9
- package/Microsoft.ReactNative/Pch/pch.h +0 -28
- package/Microsoft.ReactNative/ReactCoreInjection.h +0 -1
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +0 -8
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -15
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -2
- package/Microsoft.ReactNative/ReactHost/React.h +0 -44
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +10 -47
- package/Microsoft.ReactNative/ReactHost/ReactHost.h +1 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +30 -586
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +2 -37
- package/Microsoft.ReactNative/ReactHost/ReactNativeHeaders.h +0 -13
- package/Microsoft.ReactNative/ReactHost/React_Win.h +0 -1
- package/Microsoft.ReactNative/ReactInstanceSettings.cpp +0 -8
- package/Microsoft.ReactNative/ReactInstanceSettings.h +0 -13
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +7 -23
- package/Microsoft.ReactNative/ReactNativeHost.cpp +10 -35
- package/Microsoft.ReactNative/ReactNativeHost.h +0 -1
- package/Microsoft.ReactNative/ReactNativeIsland.idl +0 -4
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +9 -36
- package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -38
- package/Microsoft.ReactNative/RedBox.cpp +9 -362
- package/Microsoft.ReactNative/Theme.idl +0 -2
- package/Microsoft.ReactNative/Timer.cpp +3 -2
- package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -47
- package/Microsoft.ReactNative/Utils/Helpers.h +0 -5
- package/Microsoft.ReactNative/Utils/IcuUtils.cpp +84 -0
- package/Microsoft.ReactNative/Utils/IcuUtils.h +42 -0
- package/Microsoft.ReactNative/Utils/KeyboardUtils.cpp +0 -11
- package/Microsoft.ReactNative/Utils/ThemeUtils.cpp +0 -4
- package/Microsoft.ReactNative/Utils/ThemeUtils.h +1 -5
- package/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.h +0 -2
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -245
- package/Microsoft.ReactNative/Utils/ValueUtils.h +0 -23
- package/Microsoft.ReactNative/ViewProps.idl +0 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +2 -278
- package/Microsoft.ReactNative/Views/DevMenu.h +0 -5
- package/Microsoft.ReactNative/XamlApplication.cpp +71 -0
- package/Microsoft.ReactNative/XamlApplication.h +47 -0
- package/Microsoft.ReactNative/XamlApplication.idl +19 -0
- package/Microsoft.ReactNative/XamlUIService.cpp +0 -54
- package/Microsoft.ReactNative/XamlUIService.h +0 -12
- package/Microsoft.ReactNative/XamlUIService.idl +0 -12
- package/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h +0 -19
- package/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/decorator.h +191 -114
- package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +5 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +37 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +68 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi.h +77 -11
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +2 -2
- package/Microsoft.ReactNative.Cxx/NamespaceRedirect.h +0 -5
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +93 -1
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.cpp +4 -3
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +2 -2
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModuleUtils.cpp +2 -55
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModuleUtils.h +4 -8
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Class.h +5 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/timing/primitives.h +32 -4
- package/Microsoft.ReactNative.Cxx/ReactContext.h +0 -13
- package/Microsoft.ReactNative.Cxx/StructInfo.h +8 -1
- package/Microsoft.ReactNative.Cxx/UI.Composition.Effects.h +0 -4
- package/Microsoft.ReactNative.Cxx/UI.Composition.h +0 -4
- package/Microsoft.ReactNative.Cxx/UI.Input.h +0 -4
- package/Microsoft.ReactNative.Cxx/UI.Popups.h +0 -4
- package/Microsoft.ReactNative.Cxx/UI.Text.h +0 -4
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +0 -33
- package/Microsoft.ReactNative.Managed/JSValueReader.cs +0 -4
- package/Microsoft.ReactNative.Managed/Microsoft.ReactNative.Managed.csproj +0 -3
- package/Microsoft.ReactNative.Managed/ReactContext.cs +0 -5
- package/Microsoft.ReactNative.Managed/ReactContextGenerator.cs +0 -4
- package/Microsoft.ReactNative.Managed/ReactPackageBuilderExtensions.cs +0 -25
- package/Microsoft.ReactNative.Managed/ReactSettingsSnapshot.cs +0 -4
- package/Microsoft.ReactNative.Managed/ReflectionReactPackageProvider.cs +1 -2
- package/Microsoft.ReactNative.Managed.CodeGen/CodeAnalyzer.cs +0 -10
- package/Microsoft.ReactNative.Managed.CodeGen/CodeGenerator.ViewManager.cs +0 -36
- package/Microsoft.ReactNative.Managed.CodeGen/CodeGenerator.cs +0 -6
- package/Microsoft.ReactNative.Managed.CodeGen/Model/ReactAssembly.cs +0 -2
- package/Microsoft.ReactNative.Managed.CodeGen/Model/ReactTypes.cs +0 -2
- package/Microsoft.ReactNative.Managed.CodeGen/ReactNativeNames.cs +0 -2
- package/Mso/src/dispatchQueue/queueService.cpp +3 -1
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +2 -10
- package/PropertySheets/Bundle.Common.targets +1 -1
- package/PropertySheets/Bundle.props +3 -4
- package/PropertySheets/External/Microsoft.ReactNative.Common.props +0 -1
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/NuGet.LockFile.props +0 -8
- package/PropertySheets/OutputMSBuildProperties.targets +0 -1
- package/PropertySheets/React.Cpp.props +3 -5
- package/PropertySheets/WinUI.props +3 -3
- package/README.md +1 -5
- package/ReactCommon/ReactCommon.vcxproj +12 -31
- package/ReactCommon/ReactCommon.vcxproj.filters +0 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +3 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +5 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +20 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +113 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +14 -6
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/Utf8.h +1 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/tracing/RuntimeSamplingProfileTraceEventSerializer.cpp +351 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.cpp +42 -36
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.h +15 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +174 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +1 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +26 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ShadowNode.cpp +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +189 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/reactperflogger/reactperflogger/ReactPerfettoLogger.cpp +27 -8
- package/ReactCommon/cgmanifest.json +1 -1
- package/Scripts/Microsoft.ReactNative.nuspec +15 -33
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +23 -23
- package/Scripts/OfficeReact.Win32.nuspec +0 -3
- package/Scripts/creaternwapp.cmd +1 -1
- package/Shared/DevServerHelper.h +17 -21
- package/Shared/DevSettings.h +1 -25
- package/Shared/DevSupportManager.cpp +0 -50
- package/Shared/DevSupportManager.h +0 -4
- package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +5 -1
- package/Shared/HermesRuntimeHolder.cpp +0 -31
- package/Shared/HermesRuntimeHolder.h +0 -14
- package/Shared/IDevSupportManager.h +0 -6
- package/Shared/InstanceManager.cpp +0 -97
- package/Shared/InstanceManager.h +0 -53
- package/Shared/JSI/ScriptStore.h +1 -1
- package/Shared/Logging.cpp +1 -12
- package/Shared/Modules/CxxModuleUtilities.cpp +0 -9
- package/Shared/Modules/CxxModuleUtilities.h +0 -8
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +9 -1
- package/Shared/OInstance.cpp +144 -424
- package/Shared/OInstance.h +0 -81
- package/Shared/Shared.vcxitems +83 -203
- package/Shared/Shared.vcxitems.filters +8 -67
- package/Shared/Threading/MessageQueueThreadFactory.cpp +0 -6
- package/Shared/Threading/MessageQueueThreadFactory.h +0 -4
- package/Shared/TurboModuleManager.cpp +0 -4
- package/Shared/Utils.cpp +26 -0
- package/Shared/Utils.h +3 -0
- package/codegen/NativeDOMSpec.g.h +41 -35
- package/codegen/NativeIntersectionObserverSpec.g.h +9 -21
- package/codegen/NativePerformanceSpec.g.h +47 -35
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +177 -129
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +14 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +14 -0
- package/codegen/react/components/rnwcore/EventEmitters.cpp +25 -0
- package/codegen/react/components/rnwcore/EventEmitters.h +25 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +14 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +14 -0
- package/codegen/react/components/rnwcore/Props.cpp +41 -2
- package/codegen/react/components/rnwcore/Props.h +51 -2
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +14 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +14 -0
- package/codegen/react/components/rnwcore/Switch.g.h +14 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +14 -0
- package/codegen/react/components/rnwcore/VirtualView.g.h +18 -0
- package/codegen/react/components/rnwcore/VirtualViewExperimental.g.h +240 -0
- package/codegen/rnwcoreJSI-generated.cpp +106 -51
- package/codegen/rnwcoreJSI.h +148 -67
- package/fmt/cgmanifest.json +1 -1
- package/fmt/fmt.vcxproj +0 -8
- package/index.js +8 -2
- package/index.windows.js +8 -2
- package/jest/local-setup.js +2 -2
- package/jest/mock.js +1 -1
- package/jest/mockComponent.js +9 -9
- package/jest/mockNativeComponent.js +3 -2
- package/jest/mocks/Modal.js +1 -1
- package/jest/mocks/ScrollView.js +1 -1
- package/jest/mocks/ViewNativeComponent.js +1 -1
- package/jest/setup.js +23 -12
- package/just-task.js +14 -0
- package/package.json +31 -32
- package/src/private/animated/NativeAnimatedHelper.js +16 -5
- package/src/private/animated/createAnimatedPropsHook.js +11 -60
- package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
- package/src/private/components/virtualview/VirtualView.js +43 -12
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +80 -52
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +14 -6
- package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +0 -1
- package/src/private/types/HostInstance.js +4 -1
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
- package/src/private/webapis/geometry/DOMRectList.js +2 -2
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/performance/EventTiming.js +6 -10
- package/src/private/webapis/performance/Performance.js +309 -164
- package/src/private/webapis/performance/PerformanceEntry.js +20 -16
- package/src/private/webapis/performance/PerformanceObserver.js +8 -29
- package/src/private/webapis/performance/UserTiming.js +71 -18
- package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
- package/src/private/webapis/performance/internals/Utilities.js +9 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +21 -23
- package/src/private/webapis/structuredClone/structuredClone.js +10 -10
- package/stubs/double-conversion/README.md +1 -1
- package/template/cpp-lib/proj/MyLib.sln +0 -5
- package/template/cpp-lib/src/pch.h +0 -5
- package/template/cs-lib/proj/MyLib.sln +0 -5
- package/template/metro.config.js +1 -0
- package/templates/cpp-app/metro.config.js +2 -1
- package/templates/cpp-app/windows/MyApp.sln +0 -5
- package/templates/cpp-lib/example/metro.config.js +3 -4
- package/templates/cpp-lib/windows/MyLib.sln +0 -5
- package/Chakra/Chakra.vcxitems +0 -32
- package/Chakra/Chakra.vcxitems.filters +0 -54
- package/Chakra/ChakraHelpers.cpp +0 -468
- package/Chakra/ChakraHelpers.h +0 -146
- package/Chakra/ChakraInstanceArgs.h +0 -52
- package/Chakra/ChakraPlatform.cpp +0 -42
- package/Chakra/ChakraPlatform.h +0 -51
- package/Chakra/ChakraTracing.cpp +0 -275
- package/Chakra/ChakraTracing.h +0 -11
- package/Chakra/ChakraUtils.cpp +0 -190
- package/Chakra/ChakraUtils.h +0 -72
- package/Chakra/ChakraValue.cpp +0 -257
- package/Chakra/ChakraValue.h +0 -308
- package/Chakra/Utf8DebugExtensions.cpp +0 -62
- package/Chakra/Utf8DebugExtensions.h +0 -29
- package/Libraries/Interaction/InteractionManagerStub.js +0 -184
- package/Libraries/Interaction/TaskQueue.js +0 -183
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
- package/Microsoft.ReactNative/ABICxxModule.cpp +0 -51
- package/Microsoft.ReactNative/ABICxxModule.h +0 -38
- package/Microsoft.ReactNative/ABIViewManager.cpp +0 -263
- package/Microsoft.ReactNative/ABIViewManager.h +0 -100
- package/Microsoft.ReactNative/Base/CoreUIManagers.cpp +0 -55
- package/Microsoft.ReactNative/DevMenuControl.cpp +0 -14
- package/Microsoft.ReactNative/DevMenuControl.h +0 -20
- package/Microsoft.ReactNative/DevMenuControl.idl +0 -28
- package/Microsoft.ReactNative/DevMenuControl.xaml +0 -139
- package/Microsoft.ReactNative/GlyphViewManager.cpp +0 -167
- package/Microsoft.ReactNative/GlyphViewManager.h +0 -24
- package/Microsoft.ReactNative/INativeUIManager.h +0 -75
- package/Microsoft.ReactNative/IViewManager.idl +0 -120
- package/Microsoft.ReactNative/IViewManagerCore.idl +0 -45
- package/Microsoft.ReactNative/LayoutService.cpp +0 -51
- package/Microsoft.ReactNative/LayoutService.h +0 -32
- package/Microsoft.ReactNative/LayoutService.idl +0 -41
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +0 -1187
- package/Microsoft.ReactNative/Modules/NativeUIManager.h +0 -128
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +0 -891
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +0 -185
- package/Microsoft.ReactNative/NativeModulesProvider.cpp +0 -49
- package/Microsoft.ReactNative/NativeModulesProvider.h +0 -25
- package/Microsoft.ReactNative/ReactApplication.cpp +0 -276
- package/Microsoft.ReactNative/ReactApplication.h +0 -156
- package/Microsoft.ReactNative/ReactApplication.idl +0 -48
- package/Microsoft.ReactNative/ReactHost/ViewManagerProvider.h +0 -19
- package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +0 -55
- package/Microsoft.ReactNative/ReactPointerEventArgs.h +0 -32
- package/Microsoft.ReactNative/ReactPointerEventArgs.idl +0 -79
- package/Microsoft.ReactNative/ReactRootView.cpp +0 -592
- package/Microsoft.ReactNative/ReactRootView.h +0 -127
- package/Microsoft.ReactNative/ReactRootView.idl +0 -40
- package/Microsoft.ReactNative/TestHook.cpp +0 -99
- package/Microsoft.ReactNative/TestHook.h +0 -15
- package/Microsoft.ReactNative/Utils/AccessibilityUtils.cpp +0 -36
- package/Microsoft.ReactNative/Utils/AccessibilityUtils.h +0 -15
- package/Microsoft.ReactNative/Utils/BatchingEventEmitter.cpp +0 -171
- package/Microsoft.ReactNative/Utils/BatchingEventEmitter.h +0 -72
- package/Microsoft.ReactNative/Utils/PropertyHandlerUtils.h +0 -87
- package/Microsoft.ReactNative/Utils/PropertyUtils.h +0 -568
- package/Microsoft.ReactNative/Utils/ResourceBrushUtils.cpp +0 -182
- package/Microsoft.ReactNative/Utils/ResourceBrushUtils.h +0 -58
- package/Microsoft.ReactNative/Utils/ShadowNodeTypeUtils.h +0 -26
- package/Microsoft.ReactNative/Utils/XamlIslandUtils.cpp +0 -93
- package/Microsoft.ReactNative/Utils/XamlIslandUtils.h +0 -48
- package/Microsoft.ReactNative/ViewManagersProvider.cpp +0 -39
- package/Microsoft.ReactNative/ViewManagersProvider.h +0 -27
- package/Microsoft.ReactNative/Views/ActivityIndicatorViewManager.cpp +0 -62
- package/Microsoft.ReactNative/Views/ActivityIndicatorViewManager.h +0 -29
- package/Microsoft.ReactNative/Views/ConfigureBundlerDlg.cpp +0 -186
- package/Microsoft.ReactNative/Views/ConfigureBundlerDlg.h +0 -11
- package/Microsoft.ReactNative/Views/ControlViewManager.cpp +0 -143
- package/Microsoft.ReactNative/Views/ControlViewManager.h +0 -38
- package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.cpp +0 -53
- package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.h +0 -30
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +0 -586
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.h +0 -104
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +0 -330
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.h +0 -111
- package/Microsoft.ReactNative/Views/DynamicValueProvider.cpp +0 -59
- package/Microsoft.ReactNative/Views/DynamicValueProvider.h +0 -32
- package/Microsoft.ReactNative/Views/ExpressionAnimationStore.cpp +0 -61
- package/Microsoft.ReactNative/Views/ExpressionAnimationStore.h +0 -26
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +0 -559
- package/Microsoft.ReactNative/Views/FlyoutViewManager.h +0 -34
- package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +0 -126
- package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.h +0 -23
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +0 -957
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.h +0 -41
- package/Microsoft.ReactNative/Views/IXamlRootView.h +0 -17
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +0 -245
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.h +0 -45
- package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +0 -469
- package/Microsoft.ReactNative/Views/Image/ReactImage.h +0 -80
- package/Microsoft.ReactNative/Views/Image/ReactImageBrush.cpp +0 -247
- package/Microsoft.ReactNative/Views/Image/ReactImageBrush.h +0 -67
- package/Microsoft.ReactNative/Views/KeyboardEventHandler.cpp +0 -261
- package/Microsoft.ReactNative/Views/KeyboardEventHandler.h +0 -132
- package/Microsoft.ReactNative/Views/PaperShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Views/PaperShadowNode.h +0 -38
- package/Microsoft.ReactNative/Views/PopupViewManager.cpp +0 -349
- package/Microsoft.ReactNative/Views/PopupViewManager.h +0 -36
- package/Microsoft.ReactNative/Views/RawTextViewManager.cpp +0 -69
- package/Microsoft.ReactNative/Views/RawTextViewManager.h +0 -46
- package/Microsoft.ReactNative/Views/ReactViewInstance.cpp +0 -43
- package/Microsoft.ReactNative/Views/ReactViewInstance.h +0 -53
- package/Microsoft.ReactNative/Views/RefreshControlManager.cpp +0 -116
- package/Microsoft.ReactNative/Views/RefreshControlManager.h +0 -28
- package/Microsoft.ReactNative/Views/RootViewManager.cpp +0 -65
- package/Microsoft.ReactNative/Views/RootViewManager.h +0 -36
- package/Microsoft.ReactNative/Views/SIPEventHandler.cpp +0 -117
- package/Microsoft.ReactNative/Views/SIPEventHandler.h +0 -45
- package/Microsoft.ReactNative/Views/ScrollContentViewManager.cpp +0 -16
- package/Microsoft.ReactNative/Views/ScrollContentViewManager.h +0 -19
- package/Microsoft.ReactNative/Views/ScrollViewManager.cpp +0 -540
- package/Microsoft.ReactNative/Views/ScrollViewManager.h +0 -42
- package/Microsoft.ReactNative/Views/ShadowNodeBase.cpp +0 -228
- package/Microsoft.ReactNative/Views/ShadowNodeBase.h +0 -169
- package/Microsoft.ReactNative/Views/ShadowNodeRegistry.cpp +0 -68
- package/Microsoft.ReactNative/Views/ShadowNodeRegistry.h +0 -40
- package/Microsoft.ReactNative/Views/SliderViewManager.cpp +0 -97
- package/Microsoft.ReactNative/Views/SliderViewManager.h +0 -32
- package/Microsoft.ReactNative/Views/SwitchViewManager.cpp +0 -227
- package/Microsoft.ReactNative/Views/SwitchViewManager.h +0 -31
- package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.cpp +0 -52
- package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.h +0 -37
- package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.cpp +0 -348
- package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.h +0 -13
- package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.cpp +0 -76
- package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.h +0 -32
- package/Microsoft.ReactNative/Views/Text/TextParentVisitor.cpp +0 -12
- package/Microsoft.ReactNative/Views/Text/TextParentVisitor.h +0 -19
- package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.cpp +0 -75
- package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.h +0 -43
- package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.cpp +0 -21
- package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +0 -23
- package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.cpp +0 -70
- package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.h +0 -34
- package/Microsoft.ReactNative/Views/Text/TextVisitor.cpp +0 -56
- package/Microsoft.ReactNative/Views/Text/TextVisitor.h +0 -34
- package/Microsoft.ReactNative/Views/Text/TextVisitorScope.h +0 -35
- package/Microsoft.ReactNative/Views/Text/TextVisitors.h +0 -47
- package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +0 -1003
- package/Microsoft.ReactNative/Views/TextInputViewManager.h +0 -33
- package/Microsoft.ReactNative/Views/TextViewManager.cpp +0 -414
- package/Microsoft.ReactNative/Views/TextViewManager.h +0 -47
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +0 -608
- package/Microsoft.ReactNative/Views/TouchEventHandler.h +0 -116
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.cpp +0 -79
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.h +0 -27
- package/Microsoft.ReactNative/Views/ViewControl.cpp +0 -43
- package/Microsoft.ReactNative/Views/ViewControl.h +0 -32
- package/Microsoft.ReactNative/Views/ViewManager.h +0 -33
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +0 -487
- package/Microsoft.ReactNative/Views/ViewManagerBase.h +0 -121
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +0 -164
- package/Microsoft.ReactNative/Views/ViewPanel.h +0 -82
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +0 -507
- package/Microsoft.ReactNative/Views/ViewViewManager.h +0 -52
- package/Microsoft.ReactNative/Views/VirtualTextViewManager.cpp +0 -143
- package/Microsoft.ReactNative/Views/VirtualTextViewManager.h +0 -57
- package/Microsoft.ReactNative/Views/XamlFeatures.cpp +0 -11
- package/Microsoft.ReactNative/Views/XamlFeatures.h +0 -11
- package/Microsoft.ReactNative/Views/cppwinrt/AccessibilityAction.idl +0 -12
- package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +0 -231
- package/Microsoft.ReactNative/Views/cppwinrt/ViewPanel.idl +0 -48
- package/Microsoft.ReactNative/XamlHelper.cpp +0 -78
- package/Microsoft.ReactNative/XamlHelper.h +0 -54
- package/Microsoft.ReactNative/XamlHelper.idl +0 -30
- package/Microsoft.ReactNative/XamlLoadState.cpp +0 -217
- package/Microsoft.ReactNative/XamlLoadState.h +0 -44
- package/Microsoft.ReactNative/XamlView.cpp +0 -59
- package/Microsoft.ReactNative/XamlView.h +0 -58
- package/Microsoft.ReactNative/getLayoutProps.ps1 +0 -5
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Automation.Peers.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Automation.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Controls.Primitives.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Controls.h +0 -13
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Documents.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Hosting.DesktopWindowXamlSource.h +0 -11
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Hosting.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Input.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Markup.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Media.Imaging.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Media.Media3D.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Media.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Navigation.h +0 -10
- package/Microsoft.ReactNative.Cxx/UI.Xaml.Shapes.h +0 -10
- package/Microsoft.ReactNative.Managed/AttributedViewManager.cs +0 -527
- package/Microsoft.ReactNative.Managed/ViewManagerAttributes.cs +0 -91
- package/Microsoft.ReactNative.Managed/ViewManagerEvent.cs +0 -13
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityProps.cpp +0 -344
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/DynamicEventPayload.cpp +0 -42
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/YGEnums.h +0 -146
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +0 -2435
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/enums/ExperimentalFeature.h +0 -40
- package/Shared/BatchingMessageQueueThread.h +0 -20
- package/Shared/ChakraRuntimeHolder.cpp +0 -62
- package/Shared/ChakraRuntimeHolder.h +0 -46
- package/Shared/CreateInstance.h +0 -25
- package/Shared/Executors/WebSocketJSExecutor.cpp +0 -294
- package/Shared/Executors/WebSocketJSExecutor.h +0 -123
- package/Shared/Executors/WebSocketJSExecutorFactory.cpp +0 -25
- package/Shared/Hermes/HermesSamplingProfiler.cpp +0 -114
- package/Shared/Hermes/HermesSamplingProfiler.h +0 -26
- package/Shared/JSI/ChakraApi.cpp +0 -436
- package/Shared/JSI/ChakraApi.h +0 -474
- package/Shared/JSI/ChakraJsiRuntime_edgemode.cpp +0 -100
- package/Shared/JSI/ChakraRuntime.cpp +0 -1132
- package/Shared/JSI/ChakraRuntime.h +0 -512
- package/Shared/JSI/ChakraRuntimeArgs.h +0 -45
- package/Shared/JSI/ChakraRuntimeFactory.h +0 -15
- package/Shared/JSI/JSExecutorFactoryDelegate.h +0 -12
- package/Shared/JSI/JSExecutorFactorySettings.cpp +0 -30
- package/Shared/JSI/JSExecutorFactorySettings.h +0 -21
- package/Shared/NativeModuleProvider.h +0 -40
- package/Shared/SystemChakraRuntime.h +0 -38
- package/Shared/Threading/BatchingQueueThread.cpp +0 -128
- package/Shared/Threading/BatchingQueueThread.h +0 -59
- package/Shared/WebSocketJSExecutorFactory.h +0 -27
- package/fmt/TEMP_UntilFmtUpdate/core.h +0 -2925
- package/template/cpp-app/proj/MyApp.sln +0 -166
- package/template/cpp-app/proj/MyApp.vcxproj +0 -176
- package/template/cpp-app/proj/MyApp.vcxproj.filters +0 -62
- package/template/cpp-app/src/App.cpp +0 -93
- package/template/cpp-app/src/App.h +0 -21
- package/template/cpp-app/src/App.idl +0 -3
- package/template/cpp-app/src/AutolinkedNativeModules.g.cpp +0 -13
- package/template/cpp-app/src/AutolinkedNativeModules.g.h +0 -10
- package/template/cpp-app/src/MainPage.cpp +0 -20
- package/template/cpp-app/src/MainPage.h +0 -19
- package/template/cpp-app/src/MainPage.idl +0 -10
- package/template/cpp-app/src/PropertySheet.props +0 -16
- package/template/cpp-app/src/ReactPackageProvider.cpp +0 -15
- package/template/cpp-app/src/ReactPackageProvider.h +0 -13
- package/template/cpp-app/src/pch.cpp +0 -1
- package/template/cpp-app/src/pch.h +0 -24
- package/template/cs-app/proj/MyApp.csproj +0 -162
- package/template/cs-app/proj/MyApp.sln +0 -191
- package/template/cs-app/src/App.xaml.cs +0 -62
- package/template/cs-app/src/AutolinkedNativeModules.g.cs +0 -13
- package/template/cs-app/src/MainPage.xaml.cs +0 -34
- package/template/cs-app/src/Properties/AssemblyInfo.cs +0 -29
- package/template/cs-app/src/Properties/Default.rd.xml +0 -32
- package/template/cs-app/src/ReactPackageProvider.cs +0 -17
- package/template/shared-app/assets/LockScreenLogo.scale-200.png +0 -0
- package/template/shared-app/assets/SplashScreen.scale-200.png +0 -0
- package/template/shared-app/assets/Square150x150Logo.scale-200.png +0 -0
- package/template/shared-app/assets/Square44x44Logo.scale-200.png +0 -0
- package/template/shared-app/assets/Square44x44Logo.targetsize-24_altform-unplated.png +0 -0
- package/template/shared-app/assets/StoreLogo.png +0 -0
- package/template/shared-app/assets/Wide310x150Logo.scale-200.png +0 -0
- package/template/shared-app/proj/ExperimentalFeatures.props +0 -32
- package/template/shared-app/proj/NuGet_Config +0 -19
- package/template/shared-app/src/App.xaml +0 -10
- package/template/shared-app/src/AutolinkedNativeModules.g.props +0 -6
- package/template/shared-app/src/AutolinkedNativeModules.g.targets +0 -6
- package/template/shared-app/src/MainPage.xaml +0 -21
- package/template/shared-app/src/Package.appxmanifest +0 -50
- package/templates/old/uwp-cpp-app/template.config.js +0 -15
- package/templates/old/uwp-cs-app/template.config.js +0 -15
|
@@ -1,1187 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
#include "pch.h"
|
|
5
|
-
|
|
6
|
-
#include <QuirkSettings.h>
|
|
7
|
-
#include <UI.Xaml.Controls.h>
|
|
8
|
-
#include <UI.Xaml.Input.h>
|
|
9
|
-
#include <UI.Xaml.Media.h>
|
|
10
|
-
#include <Views/ShadowNodeBase.h>
|
|
11
|
-
#include <cxxreact/TraceSection.h>
|
|
12
|
-
#include "Modules/I18nManagerModule.h"
|
|
13
|
-
#include "NativeUIManager.h"
|
|
14
|
-
|
|
15
|
-
#include "CppWinRTIncludes.h"
|
|
16
|
-
#include "IXamlRootView.h"
|
|
17
|
-
#include "QuirkSettings.h"
|
|
18
|
-
#include "ReactRootViewTagGenerator.h"
|
|
19
|
-
#include "Unicode.h"
|
|
20
|
-
|
|
21
|
-
namespace winrt {
|
|
22
|
-
using namespace Windows::Foundation;
|
|
23
|
-
using namespace Windows::UI;
|
|
24
|
-
using namespace xaml;
|
|
25
|
-
using namespace xaml::Controls;
|
|
26
|
-
using namespace xaml::Media;
|
|
27
|
-
} // namespace winrt
|
|
28
|
-
|
|
29
|
-
using namespace facebook::react;
|
|
30
|
-
|
|
31
|
-
namespace Microsoft::ReactNative {
|
|
32
|
-
|
|
33
|
-
static YogaNodePtr make_yoga_node(YGConfigRef config) {
|
|
34
|
-
YogaNodePtr result(YGNodeNewWithConfig(config));
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static inline bool YogaFloatEquals(float x, float y) {
|
|
39
|
-
// Epsilon value of 0.0001f is taken from the YGFloatsEqual method in Yoga.
|
|
40
|
-
return std::fabs(x - y) < 0.0001f;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
#if defined(_DEBUG)
|
|
44
|
-
static int YogaLog(
|
|
45
|
-
const YGConfigConstRef /*config*/,
|
|
46
|
-
const YGNodeConstRef /*node*/,
|
|
47
|
-
YGLogLevel /*level*/,
|
|
48
|
-
const char *format,
|
|
49
|
-
va_list args) {
|
|
50
|
-
const int len = _vscprintf(format, args);
|
|
51
|
-
std::string buffer(len + 1, '\0');
|
|
52
|
-
vsnprintf_s(&buffer[0], len + 1, _TRUNCATE, format, args);
|
|
53
|
-
buffer.resize(len);
|
|
54
|
-
|
|
55
|
-
// OutputDebugString will truncate output around 4k, here
|
|
56
|
-
// we output a 1000 characters at a time.
|
|
57
|
-
int start = 0;
|
|
58
|
-
while (len - start > 1000) {
|
|
59
|
-
char tmp = buffer[start + 1000];
|
|
60
|
-
buffer[start + 1000] = '\0';
|
|
61
|
-
OutputDebugStringA(&buffer[start]);
|
|
62
|
-
buffer[start + 1000] = tmp;
|
|
63
|
-
start += 1000;
|
|
64
|
-
}
|
|
65
|
-
OutputDebugStringA(&buffer[start]);
|
|
66
|
-
OutputDebugStringA("\n");
|
|
67
|
-
|
|
68
|
-
return 0;
|
|
69
|
-
}
|
|
70
|
-
#endif
|
|
71
|
-
|
|
72
|
-
YGNodeRef NativeUIManager::GetYogaNode(int64_t tag) const {
|
|
73
|
-
auto iter = m_tagsToYogaNodes.find(tag);
|
|
74
|
-
if (iter == m_tagsToYogaNodes.end())
|
|
75
|
-
return nullptr;
|
|
76
|
-
return iter->second.get();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
void NativeUIManager::DirtyYogaNode(int64_t tag) {
|
|
80
|
-
ShadowNodeBase *pShadowNodeChild = static_cast<ShadowNodeBase *>(m_host->FindShadowNodeForTag(tag));
|
|
81
|
-
if (pShadowNodeChild != nullptr) {
|
|
82
|
-
auto *pViewManager = pShadowNodeChild->GetViewManager();
|
|
83
|
-
YGMeasureFunc func = pViewManager->GetYogaCustomMeasureFunc();
|
|
84
|
-
if (func != nullptr) {
|
|
85
|
-
// If there is a yoga node for this tag mark it as dirty
|
|
86
|
-
YGNodeRef yogaNodeChild = GetYogaNode(tag);
|
|
87
|
-
if (yogaNodeChild != nullptr) {
|
|
88
|
-
// Retrieve and dirty the yoga node
|
|
89
|
-
YGNodeMarkDirty(yogaNodeChild);
|
|
90
|
-
|
|
91
|
-
// Once we mark a node dirty we can stop because the yoga code will mark
|
|
92
|
-
// all parents anyway
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Since this node didn't meet the criteria, jump to parent in case it does
|
|
98
|
-
int64_t parentTag = pShadowNodeChild->GetParent();
|
|
99
|
-
if (parentTag >= 0)
|
|
100
|
-
DirtyYogaNode(parentTag);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
void NativeUIManager::AddBatchCompletedCallback(std::function<void()> callback) {
|
|
105
|
-
m_batchCompletedCallbacks.push_back(std::move(callback));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
winrt::XamlRoot NativeUIManager::tryGetXamlRoot() {
|
|
109
|
-
if (m_host) {
|
|
110
|
-
for (auto const tag : m_host->GetAllRootTags()) {
|
|
111
|
-
if (auto shadowNode = static_cast<ShadowNodeBase *>(m_host->FindShadowNodeForTag(tag))) {
|
|
112
|
-
if (auto uiElement10 = shadowNode->GetView().try_as<xaml::IUIElement10>()) {
|
|
113
|
-
return uiElement10.XamlRoot();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return nullptr;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
winrt::XamlRoot NativeUIManager::tryGetXamlRoot(int64_t rootTag) {
|
|
122
|
-
if (m_host) {
|
|
123
|
-
if (auto shadowNode = static_cast<ShadowNodeBase *>(m_host->FindShadowNodeForTag(rootTag))) {
|
|
124
|
-
if (auto uiElement10 = shadowNode->GetView().try_as<xaml::IUIElement10>()) {
|
|
125
|
-
return uiElement10.XamlRoot();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return nullptr;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
XamlView NativeUIManager::reactPeerOrContainerFrom(xaml::FrameworkElement fe) {
|
|
133
|
-
if (m_host) {
|
|
134
|
-
while (fe) {
|
|
135
|
-
if (auto value = GetTagAsPropertyValue(fe)) {
|
|
136
|
-
auto tag = GetTag(value);
|
|
137
|
-
if (auto shadowNode = static_cast<ShadowNodeBase *>(m_host->FindShadowNodeForTag(tag))) {
|
|
138
|
-
if (auto xamlView = shadowNode->GetView()) {
|
|
139
|
-
if (xamlView == fe) {
|
|
140
|
-
return xamlView;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
fe = fe.Parent().try_as<xaml::FrameworkElement>();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return nullptr;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
NativeUIManager::NativeUIManager(winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
152
|
-
: m_context(reactContext) {
|
|
153
|
-
m_yogaConfig = YGConfigNew();
|
|
154
|
-
if (React::implementation::QuirkSettings::GetUseWebFlexBasisBehavior(m_context.Properties()))
|
|
155
|
-
YGConfigSetExperimentalFeatureEnabled(m_yogaConfig, YGExperimentalFeatureWebFlexBasis, true);
|
|
156
|
-
auto errata = YGErrataAll;
|
|
157
|
-
if (!React::implementation::QuirkSettings::GetMatchAndroidAndIOSStretchBehavior(m_context.Properties()))
|
|
158
|
-
errata &= ~YGErrataStretchFlexBasis;
|
|
159
|
-
YGConfigSetErrata(m_yogaConfig, errata);
|
|
160
|
-
#if defined(_DEBUG)
|
|
161
|
-
YGConfigSetLogger(m_yogaConfig, &YogaLog);
|
|
162
|
-
|
|
163
|
-
// To Debug Yoga layout, uncomment the following line.
|
|
164
|
-
// YGConfigSetPrintTreeFlag(m_yogaConfig, true);
|
|
165
|
-
|
|
166
|
-
// Additional logging can be enabled editing CalculateLayout.cpp (e.g. gPrintChanges,
|
|
167
|
-
// gPrintSkips)
|
|
168
|
-
#endif
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
struct RootShadowNode final : public ShadowNodeBase {
|
|
172
|
-
RootShadowNode(const RootShadowNode &that) = delete;
|
|
173
|
-
RootShadowNode &operator=(RootShadowNode const &) = delete;
|
|
174
|
-
RootShadowNode() = delete;
|
|
175
|
-
|
|
176
|
-
RootShadowNode(facebook::react::IReactRootView *rootView, INativeUIManagerHost *host) {
|
|
177
|
-
auto reactRootView = static_cast<IXamlRootView *>(rootView);
|
|
178
|
-
m_view = reactRootView->GetXamlView();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
void createView(const winrt::Microsoft::ReactNative::JSValueObject &) override {
|
|
182
|
-
// ASSERT: The root view is created before react, so react should never tell
|
|
183
|
-
// the root view to be created.
|
|
184
|
-
assert(false);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
void AddView(ShadowNode &child, int64_t index) override {
|
|
188
|
-
auto panel(GetView().as<winrt::Microsoft::ReactNative::ReactRootView>());
|
|
189
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactRootView>(panel)->AddView(
|
|
190
|
-
static_cast<uint32_t>(index), static_cast<ShadowNodeBase &>(child).GetView().as<xaml::UIElement>());
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
void NativeUIManager::setHost(INativeUIManagerHost *host) {
|
|
195
|
-
m_host = host;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
ShadowNode *NativeUIManager::createRootShadowNode(facebook::react::IReactRootView *pReactRootView) {
|
|
199
|
-
return new RootShadowNode(pReactRootView, m_host);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
void NativeUIManager::destroyRootShadowNode(ShadowNode *node) {
|
|
203
|
-
delete node;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
int64_t NativeUIManager::AddMeasuredRootView(facebook::react::IReactRootView *rootView) {
|
|
207
|
-
auto tag = getNextRootViewTag();
|
|
208
|
-
|
|
209
|
-
int64_t width = rootView->GetActualWidth();
|
|
210
|
-
int64_t height = rootView->GetActualHeight();
|
|
211
|
-
|
|
212
|
-
m_host->RegisterRootView(rootView, tag, width, height);
|
|
213
|
-
|
|
214
|
-
return tag;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
void NativeUIManager::AddRootView(ShadowNode &shadowNode, facebook::react::IReactRootView *pReactRootView) {
|
|
218
|
-
TraceSection s("NativeUIManager::AddRootView");
|
|
219
|
-
auto xamlRootView = static_cast<IXamlRootView *>(pReactRootView);
|
|
220
|
-
XamlView view = xamlRootView->GetXamlView();
|
|
221
|
-
const auto rootTag = shadowNode.m_tag;
|
|
222
|
-
m_tagsToXamlReactControl.emplace(
|
|
223
|
-
rootTag,
|
|
224
|
-
winrt::weak_ref<winrt::Microsoft::ReactNative::ReactRootView>(
|
|
225
|
-
view.as<winrt::Microsoft::ReactNative::ReactRootView>()));
|
|
226
|
-
|
|
227
|
-
// Push the appropriate FlowDirection into the root view.
|
|
228
|
-
view.as<xaml::FrameworkElement>().FlowDirection(
|
|
229
|
-
I18nManager::IsRTL(m_context.Properties()) ? xaml::FlowDirection::RightToLeft : xaml::FlowDirection::LeftToRight);
|
|
230
|
-
|
|
231
|
-
m_tagsToYogaNodes.emplace(rootTag, make_yoga_node(m_yogaConfig));
|
|
232
|
-
|
|
233
|
-
auto element = view.as<xaml::FrameworkElement>();
|
|
234
|
-
Microsoft::ReactNative::SetTag(element, rootTag);
|
|
235
|
-
|
|
236
|
-
// Add listener to size change so we can redo the layout when that happens
|
|
237
|
-
m_sizeChangedMap.insert(
|
|
238
|
-
{rootTag,
|
|
239
|
-
view.as<xaml::FrameworkElement>().SizeChanged(
|
|
240
|
-
winrt::auto_revoke, [this, rootTag](auto &&, xaml::SizeChangedEventArgs const &args) {
|
|
241
|
-
ApplyLayout(rootTag, args.NewSize().Width, args.NewSize().Height);
|
|
242
|
-
})});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
void NativeUIManager::removeRootView(Microsoft::ReactNative::ShadowNode &shadow) {
|
|
246
|
-
TraceSection s("NativeUIManager::removeRootView");
|
|
247
|
-
m_tagsToXamlReactControl.erase(shadow.m_tag);
|
|
248
|
-
m_sizeChangedMap.erase(shadow.m_tag);
|
|
249
|
-
RemoveView(shadow, true);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
void NativeUIManager::onBatchComplete() {
|
|
253
|
-
TraceSection s("NativeUIManager::onBatchComplete");
|
|
254
|
-
if (m_inBatch) {
|
|
255
|
-
DoLayout();
|
|
256
|
-
m_inBatch = false;
|
|
257
|
-
|
|
258
|
-
const auto callbacks = m_batchCompletedCallbacks;
|
|
259
|
-
m_batchCompletedCallbacks.clear();
|
|
260
|
-
for (const auto &callback : callbacks) {
|
|
261
|
-
callback.operator()();
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
void NativeUIManager::ensureInBatch() {
|
|
267
|
-
if (!m_inBatch)
|
|
268
|
-
m_inBatch = true;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
bool NativeUIManager::isInBatch() {
|
|
272
|
-
return m_inBatch;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
static float NumberOrDefault(const winrt::Microsoft::ReactNative::JSValue &value, float defaultValue) {
|
|
276
|
-
float result = defaultValue;
|
|
277
|
-
|
|
278
|
-
if (value.Type() == winrt::Microsoft::ReactNative::JSValueType::Double ||
|
|
279
|
-
value.Type() == winrt::Microsoft::ReactNative::JSValueType::Int64)
|
|
280
|
-
result = value.AsSingle();
|
|
281
|
-
else if (value.IsNull())
|
|
282
|
-
result = defaultValue;
|
|
283
|
-
else if (value.Type() == winrt::Microsoft::ReactNative::JSValueType::String)
|
|
284
|
-
result = std::stof(value.AsString());
|
|
285
|
-
else
|
|
286
|
-
assert(false);
|
|
287
|
-
|
|
288
|
-
return result;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
static YGValue YGValueOrDefault(
|
|
292
|
-
const winrt::Microsoft::ReactNative::JSValue &value,
|
|
293
|
-
YGValue defaultValue,
|
|
294
|
-
ShadowNodeBase &shadowNode,
|
|
295
|
-
const std::string &key) {
|
|
296
|
-
YGValue result = defaultValue;
|
|
297
|
-
|
|
298
|
-
if (value.Type() == winrt::Microsoft::ReactNative::JSValueType::Double ||
|
|
299
|
-
value.Type() == winrt::Microsoft::ReactNative::JSValueType::Int64)
|
|
300
|
-
return YGValue{value.AsSingle(), YGUnitPoint};
|
|
301
|
-
|
|
302
|
-
if (value.IsNull())
|
|
303
|
-
return defaultValue;
|
|
304
|
-
|
|
305
|
-
if (value.Type() == winrt::Microsoft::ReactNative::JSValueType::String) {
|
|
306
|
-
std::string str = value.AsString();
|
|
307
|
-
if (str == "auto")
|
|
308
|
-
return YGValue{YGUndefined, YGUnitAuto};
|
|
309
|
-
if (str.length() > 0 && str.back() == '%') {
|
|
310
|
-
str.pop_back();
|
|
311
|
-
folly::dynamic pct(str);
|
|
312
|
-
return YGValue{static_cast<float>(pct.asDouble()), YGUnitPercent};
|
|
313
|
-
}
|
|
314
|
-
if (str.length() > 2 && (str.compare(str.length() - 2, 2, "pt") || str.compare(str.length() - 2, 2, "px"))) {
|
|
315
|
-
shadowNode.RedBox(
|
|
316
|
-
"Value '" + value.AsString() + "' for " + key + " is invalid. Cannot be converted to YGValue. '" +
|
|
317
|
-
str.substr((str.length() - 2), 2) + "' unit not needed. Simply use integer value.");
|
|
318
|
-
return defaultValue;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
shadowNode.RedBox(
|
|
323
|
-
"Value '" + value.AsString() + "' for " + key +
|
|
324
|
-
" is invalid. Cannot be converted to YGValue. Did you forget the %? Otherwise, simply use integer value.");
|
|
325
|
-
return defaultValue;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
typedef void (*YogaSetterFunc)(const YGNodeRef yogaNode, const YGEdge edge, const float value);
|
|
329
|
-
static void SetYogaValueHelper(
|
|
330
|
-
const YGNodeRef yogaNode,
|
|
331
|
-
const YGEdge edge,
|
|
332
|
-
const YGValue &value,
|
|
333
|
-
YogaSetterFunc normalSetter,
|
|
334
|
-
YogaSetterFunc percentSetter) {
|
|
335
|
-
switch (value.unit) {
|
|
336
|
-
case YGUnitAuto:
|
|
337
|
-
case YGUnitUndefined:
|
|
338
|
-
normalSetter(yogaNode, edge, YGUndefined);
|
|
339
|
-
break;
|
|
340
|
-
case YGUnitPoint:
|
|
341
|
-
normalSetter(yogaNode, edge, value.value);
|
|
342
|
-
break;
|
|
343
|
-
case YGUnitPercent:
|
|
344
|
-
percentSetter(yogaNode, edge, value.value);
|
|
345
|
-
break;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
typedef void (*YogaUnitSetterFunc)(const YGNodeRef yogaNode, const float value);
|
|
350
|
-
static void SetYogaUnitValueHelper(
|
|
351
|
-
const YGNodeRef yogaNode,
|
|
352
|
-
const YGValue &value,
|
|
353
|
-
YogaUnitSetterFunc normalSetter,
|
|
354
|
-
YogaUnitSetterFunc percentSetter) {
|
|
355
|
-
switch (value.unit) {
|
|
356
|
-
case YGUnitAuto:
|
|
357
|
-
case YGUnitUndefined:
|
|
358
|
-
normalSetter(yogaNode, YGUndefined);
|
|
359
|
-
break;
|
|
360
|
-
case YGUnitPoint:
|
|
361
|
-
normalSetter(yogaNode, value.value);
|
|
362
|
-
break;
|
|
363
|
-
case YGUnitPercent:
|
|
364
|
-
percentSetter(yogaNode, value.value);
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
typedef void (*YogaAutoUnitSetterFunc)(const YGNodeRef yogaNode);
|
|
370
|
-
static void SetYogaUnitValueAutoHelper(
|
|
371
|
-
const YGNodeRef yogaNode,
|
|
372
|
-
const YGValue &value,
|
|
373
|
-
YogaUnitSetterFunc normalSetter,
|
|
374
|
-
YogaUnitSetterFunc percentSetter,
|
|
375
|
-
YogaAutoUnitSetterFunc autoSetter) {
|
|
376
|
-
switch (value.unit) {
|
|
377
|
-
case YGUnitAuto:
|
|
378
|
-
autoSetter(yogaNode);
|
|
379
|
-
break;
|
|
380
|
-
case YGUnitUndefined:
|
|
381
|
-
normalSetter(yogaNode, YGUndefined);
|
|
382
|
-
break;
|
|
383
|
-
case YGUnitPoint:
|
|
384
|
-
normalSetter(yogaNode, value.value);
|
|
385
|
-
break;
|
|
386
|
-
case YGUnitPercent:
|
|
387
|
-
percentSetter(yogaNode, value.value);
|
|
388
|
-
break;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
typedef void (*YogaAutoSetterFunc)(const YGNodeRef yogaNode, const YGEdge edge);
|
|
393
|
-
static void SetYogaValueAutoHelper(
|
|
394
|
-
const YGNodeRef yogaNode,
|
|
395
|
-
const YGEdge edge,
|
|
396
|
-
const YGValue &value,
|
|
397
|
-
YogaSetterFunc normalSetter,
|
|
398
|
-
YogaSetterFunc percentSetter,
|
|
399
|
-
YogaAutoSetterFunc autoSetter) {
|
|
400
|
-
switch (value.unit) {
|
|
401
|
-
case YGUnitAuto:
|
|
402
|
-
autoSetter(yogaNode, edge);
|
|
403
|
-
break;
|
|
404
|
-
case YGUnitUndefined:
|
|
405
|
-
normalSetter(yogaNode, edge, YGUndefined);
|
|
406
|
-
break;
|
|
407
|
-
case YGUnitPoint:
|
|
408
|
-
normalSetter(yogaNode, edge, value.value);
|
|
409
|
-
break;
|
|
410
|
-
case YGUnitPercent:
|
|
411
|
-
percentSetter(yogaNode, edge, value.value);
|
|
412
|
-
break;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
static void StyleYogaNode(
|
|
417
|
-
ShadowNodeBase &shadowNode,
|
|
418
|
-
const YGNodeRef yogaNode,
|
|
419
|
-
const winrt::Microsoft::ReactNative::JSValueObject &props) {
|
|
420
|
-
for (const auto &pair : props) {
|
|
421
|
-
const std::string &key = pair.first;
|
|
422
|
-
const auto &value = pair.second;
|
|
423
|
-
|
|
424
|
-
if (key == "flexDirection") {
|
|
425
|
-
YGFlexDirection direction = YGFlexDirectionColumn;
|
|
426
|
-
|
|
427
|
-
if (value == "column" || value.IsNull())
|
|
428
|
-
direction = YGFlexDirectionColumn;
|
|
429
|
-
else if (value == "row")
|
|
430
|
-
direction = YGFlexDirectionRow;
|
|
431
|
-
else if (value == "column-reverse")
|
|
432
|
-
direction = YGFlexDirectionColumnReverse;
|
|
433
|
-
else if (value == "row-reverse")
|
|
434
|
-
direction = YGFlexDirectionRowReverse;
|
|
435
|
-
else
|
|
436
|
-
assert(false);
|
|
437
|
-
|
|
438
|
-
YGNodeStyleSetFlexDirection(yogaNode, direction);
|
|
439
|
-
} else if (key == "justifyContent") {
|
|
440
|
-
YGJustify justify = YGJustifyFlexStart;
|
|
441
|
-
|
|
442
|
-
if (value == "flex-start" || value.IsNull())
|
|
443
|
-
justify = YGJustifyFlexStart;
|
|
444
|
-
else if (value == "flex-end")
|
|
445
|
-
justify = YGJustifyFlexEnd;
|
|
446
|
-
else if (value == "center")
|
|
447
|
-
justify = YGJustifyCenter;
|
|
448
|
-
else if (value == "space-between")
|
|
449
|
-
justify = YGJustifySpaceBetween;
|
|
450
|
-
else if (value == "space-around")
|
|
451
|
-
justify = YGJustifySpaceAround;
|
|
452
|
-
else if (value == "space-evenly")
|
|
453
|
-
justify = YGJustifySpaceEvenly;
|
|
454
|
-
else
|
|
455
|
-
assert(false);
|
|
456
|
-
|
|
457
|
-
YGNodeStyleSetJustifyContent(yogaNode, justify);
|
|
458
|
-
} else if (key == "flexWrap") {
|
|
459
|
-
YGWrap wrap = YGWrapNoWrap;
|
|
460
|
-
|
|
461
|
-
if (value == "nowrap" || value.IsNull())
|
|
462
|
-
wrap = YGWrapNoWrap;
|
|
463
|
-
else if (value == "wrap")
|
|
464
|
-
wrap = YGWrapWrap;
|
|
465
|
-
else if (value == "wrap-reverse")
|
|
466
|
-
wrap = YGWrapWrapReverse;
|
|
467
|
-
else
|
|
468
|
-
assert(false);
|
|
469
|
-
|
|
470
|
-
YGNodeStyleSetFlexWrap(yogaNode, wrap);
|
|
471
|
-
} else if (key == "alignItems") {
|
|
472
|
-
YGAlign align = YGAlignStretch;
|
|
473
|
-
|
|
474
|
-
if (value == "stretch" || value.IsNull())
|
|
475
|
-
align = YGAlignStretch;
|
|
476
|
-
else if (value == "flex-start")
|
|
477
|
-
align = YGAlignFlexStart;
|
|
478
|
-
else if (value == "flex-end")
|
|
479
|
-
align = YGAlignFlexEnd;
|
|
480
|
-
else if (value == "center")
|
|
481
|
-
align = YGAlignCenter;
|
|
482
|
-
else if (value == "baseline")
|
|
483
|
-
align = YGAlignBaseline;
|
|
484
|
-
else
|
|
485
|
-
assert(false);
|
|
486
|
-
|
|
487
|
-
YGNodeStyleSetAlignItems(yogaNode, align);
|
|
488
|
-
} else if (key == "alignSelf") {
|
|
489
|
-
YGAlign align = YGAlignAuto;
|
|
490
|
-
|
|
491
|
-
if (value == "auto" || value.IsNull())
|
|
492
|
-
align = YGAlignAuto;
|
|
493
|
-
else if (value == "stretch")
|
|
494
|
-
align = YGAlignStretch;
|
|
495
|
-
else if (value == "flex-start")
|
|
496
|
-
align = YGAlignFlexStart;
|
|
497
|
-
else if (value == "flex-end")
|
|
498
|
-
align = YGAlignFlexEnd;
|
|
499
|
-
else if (value == "center")
|
|
500
|
-
align = YGAlignCenter;
|
|
501
|
-
else if (value == "baseline")
|
|
502
|
-
align = YGAlignBaseline;
|
|
503
|
-
else
|
|
504
|
-
assert(false);
|
|
505
|
-
|
|
506
|
-
YGNodeStyleSetAlignSelf(yogaNode, align);
|
|
507
|
-
} else if (key == "alignContent") {
|
|
508
|
-
YGAlign align = YGAlignFlexStart;
|
|
509
|
-
|
|
510
|
-
if (value == "stretch")
|
|
511
|
-
align = YGAlignStretch;
|
|
512
|
-
else if (value == "flex-start" || value.IsNull())
|
|
513
|
-
align = YGAlignFlexStart;
|
|
514
|
-
else if (value == "flex-end")
|
|
515
|
-
align = YGAlignFlexEnd;
|
|
516
|
-
else if (value == "center")
|
|
517
|
-
align = YGAlignCenter;
|
|
518
|
-
else if (value == "space-between")
|
|
519
|
-
align = YGAlignSpaceBetween;
|
|
520
|
-
else if (value == "space-around")
|
|
521
|
-
align = YGAlignSpaceAround;
|
|
522
|
-
else
|
|
523
|
-
assert(false);
|
|
524
|
-
|
|
525
|
-
YGNodeStyleSetAlignContent(yogaNode, align);
|
|
526
|
-
} else if (key == "flex") {
|
|
527
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
528
|
-
|
|
529
|
-
YGNodeStyleSetFlex(yogaNode, result);
|
|
530
|
-
} else if (key == "flexGrow") {
|
|
531
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
532
|
-
|
|
533
|
-
YGNodeStyleSetFlexGrow(yogaNode, result);
|
|
534
|
-
} else if (key == "flexShrink") {
|
|
535
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
536
|
-
|
|
537
|
-
YGNodeStyleSetFlexShrink(yogaNode, result);
|
|
538
|
-
} else if (key == "flexBasis") {
|
|
539
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
540
|
-
|
|
541
|
-
SetYogaUnitValueAutoHelper(
|
|
542
|
-
yogaNode, result, YGNodeStyleSetFlexBasis, YGNodeStyleSetFlexBasisPercent, YGNodeStyleSetFlexBasisAuto);
|
|
543
|
-
} else if (key == "position") {
|
|
544
|
-
YGPositionType position = YGPositionTypeRelative;
|
|
545
|
-
|
|
546
|
-
if (value == "relative" || value.IsNull())
|
|
547
|
-
position = YGPositionTypeRelative;
|
|
548
|
-
else if (value == "absolute")
|
|
549
|
-
position = YGPositionTypeAbsolute;
|
|
550
|
-
else if (value == "static")
|
|
551
|
-
position = YGPositionTypeStatic;
|
|
552
|
-
else
|
|
553
|
-
assert(false);
|
|
554
|
-
|
|
555
|
-
YGNodeStyleSetPositionType(yogaNode, position);
|
|
556
|
-
} else if (key == "overflow") {
|
|
557
|
-
YGOverflow overflow = YGOverflowVisible;
|
|
558
|
-
if (value == "visible" || value.IsNull())
|
|
559
|
-
overflow = YGOverflowVisible;
|
|
560
|
-
else if (value == "hidden")
|
|
561
|
-
overflow = YGOverflowHidden;
|
|
562
|
-
else if (value == "scroll")
|
|
563
|
-
overflow = YGOverflowScroll;
|
|
564
|
-
|
|
565
|
-
YGNodeStyleSetOverflow(yogaNode, overflow);
|
|
566
|
-
} else if (key == "display") {
|
|
567
|
-
YGDisplay display = YGDisplayFlex;
|
|
568
|
-
if (value == "flex" || value.IsNull())
|
|
569
|
-
display = YGDisplayFlex;
|
|
570
|
-
else if (value == "none")
|
|
571
|
-
display = YGDisplayNone;
|
|
572
|
-
|
|
573
|
-
YGNodeStyleSetDisplay(yogaNode, display);
|
|
574
|
-
} else if (key == "direction") {
|
|
575
|
-
// https://github.com/microsoft/react-native-windows/issues/4668
|
|
576
|
-
// In order to support the direction property, we tell yoga to always layout
|
|
577
|
-
// in LTR direction, then push the appropriate FlowDirection into XAML.
|
|
578
|
-
// This way XAML handles flipping in RTL mode, which works both for RN components
|
|
579
|
-
// as well as native components that have purely XAML sub-trees (eg ComboBox).
|
|
580
|
-
YGDirection direction = YGDirectionLTR;
|
|
581
|
-
|
|
582
|
-
YGNodeStyleSetDirection(yogaNode, direction);
|
|
583
|
-
} else if (key == "aspectRatio") {
|
|
584
|
-
float result = NumberOrDefault(value, 1.0f /*default*/);
|
|
585
|
-
|
|
586
|
-
YGNodeStyleSetAspectRatio(yogaNode, result);
|
|
587
|
-
} else if (key == "left") {
|
|
588
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
589
|
-
|
|
590
|
-
SetYogaValueHelper(yogaNode, YGEdgeLeft, result, YGNodeStyleSetPosition, YGNodeStyleSetPositionPercent);
|
|
591
|
-
} else if (key == "top") {
|
|
592
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
593
|
-
|
|
594
|
-
SetYogaValueHelper(yogaNode, YGEdgeTop, result, YGNodeStyleSetPosition, YGNodeStyleSetPositionPercent);
|
|
595
|
-
} else if (key == "right") {
|
|
596
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
597
|
-
|
|
598
|
-
SetYogaValueHelper(yogaNode, YGEdgeRight, result, YGNodeStyleSetPosition, YGNodeStyleSetPositionPercent);
|
|
599
|
-
} else if (key == "bottom") {
|
|
600
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
601
|
-
|
|
602
|
-
SetYogaValueHelper(yogaNode, YGEdgeBottom, result, YGNodeStyleSetPosition, YGNodeStyleSetPositionPercent);
|
|
603
|
-
} else if (key == "end") {
|
|
604
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
605
|
-
|
|
606
|
-
SetYogaValueHelper(yogaNode, YGEdgeEnd, result, YGNodeStyleSetPosition, YGNodeStyleSetPositionPercent);
|
|
607
|
-
} else if (key == "start") {
|
|
608
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
609
|
-
|
|
610
|
-
SetYogaValueHelper(yogaNode, YGEdgeStart, result, YGNodeStyleSetPosition, YGNodeStyleSetPositionPercent);
|
|
611
|
-
} else if (key == "width") {
|
|
612
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
613
|
-
|
|
614
|
-
SetYogaUnitValueAutoHelper(
|
|
615
|
-
yogaNode, result, YGNodeStyleSetWidth, YGNodeStyleSetWidthPercent, YGNodeStyleSetWidthAuto);
|
|
616
|
-
} else if (key == "minWidth") {
|
|
617
|
-
YGValue result = YGValueOrDefault(value, YGValue{0.0f, YGUnitPoint} /*default*/, shadowNode, key);
|
|
618
|
-
|
|
619
|
-
SetYogaUnitValueHelper(yogaNode, result, YGNodeStyleSetMinWidth, YGNodeStyleSetMinWidthPercent);
|
|
620
|
-
} else if (key == "maxWidth") {
|
|
621
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
622
|
-
|
|
623
|
-
SetYogaUnitValueHelper(yogaNode, result, YGNodeStyleSetMaxWidth, YGNodeStyleSetMaxWidthPercent);
|
|
624
|
-
} else if (key == "height") {
|
|
625
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
626
|
-
|
|
627
|
-
SetYogaUnitValueAutoHelper(
|
|
628
|
-
yogaNode, result, YGNodeStyleSetHeight, YGNodeStyleSetHeightPercent, YGNodeStyleSetHeightAuto);
|
|
629
|
-
} else if (key == "minHeight") {
|
|
630
|
-
YGValue result = YGValueOrDefault(value, YGValue{0.0f, YGUnitPoint} /*default*/, shadowNode, key);
|
|
631
|
-
|
|
632
|
-
SetYogaUnitValueHelper(yogaNode, result, YGNodeStyleSetMinHeight, YGNodeStyleSetMinHeightPercent);
|
|
633
|
-
} else if (key == "maxHeight") {
|
|
634
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
635
|
-
|
|
636
|
-
SetYogaUnitValueHelper(yogaNode, result, YGNodeStyleSetMaxHeight, YGNodeStyleSetMaxHeightPercent);
|
|
637
|
-
} else if (key == "rowGap") {
|
|
638
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
639
|
-
YGNodeStyleSetGap(yogaNode, YGGutterRow, result);
|
|
640
|
-
} else if (key == "columnGap") {
|
|
641
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
642
|
-
YGNodeStyleSetGap(yogaNode, YGGutterColumn, result);
|
|
643
|
-
} else if (key == "gap") {
|
|
644
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
645
|
-
YGNodeStyleSetGap(yogaNode, YGGutterAll, result);
|
|
646
|
-
} else if (key == "margin") {
|
|
647
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
648
|
-
|
|
649
|
-
SetYogaValueAutoHelper(
|
|
650
|
-
yogaNode, YGEdgeAll, result, YGNodeStyleSetMargin, YGNodeStyleSetMarginPercent, YGNodeStyleSetMarginAuto);
|
|
651
|
-
} else if (key == "marginLeft") {
|
|
652
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
653
|
-
|
|
654
|
-
SetYogaValueAutoHelper(
|
|
655
|
-
yogaNode, YGEdgeLeft, result, YGNodeStyleSetMargin, YGNodeStyleSetMarginPercent, YGNodeStyleSetMarginAuto);
|
|
656
|
-
} else if (key == "marginStart") {
|
|
657
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
658
|
-
|
|
659
|
-
SetYogaValueAutoHelper(
|
|
660
|
-
yogaNode, YGEdgeStart, result, YGNodeStyleSetMargin, YGNodeStyleSetMarginPercent, YGNodeStyleSetMarginAuto);
|
|
661
|
-
} else if (key == "marginTop") {
|
|
662
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
663
|
-
|
|
664
|
-
SetYogaValueAutoHelper(
|
|
665
|
-
yogaNode, YGEdgeTop, result, YGNodeStyleSetMargin, YGNodeStyleSetMarginPercent, YGNodeStyleSetMarginAuto);
|
|
666
|
-
} else if (key == "marginRight") {
|
|
667
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
668
|
-
|
|
669
|
-
SetYogaValueAutoHelper(
|
|
670
|
-
yogaNode, YGEdgeRight, result, YGNodeStyleSetMargin, YGNodeStyleSetMarginPercent, YGNodeStyleSetMarginAuto);
|
|
671
|
-
} else if (key == "marginEnd") {
|
|
672
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
673
|
-
|
|
674
|
-
SetYogaValueAutoHelper(
|
|
675
|
-
yogaNode, YGEdgeEnd, result, YGNodeStyleSetMargin, YGNodeStyleSetMarginPercent, YGNodeStyleSetMarginAuto);
|
|
676
|
-
} else if (key == "marginBottom") {
|
|
677
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
678
|
-
|
|
679
|
-
SetYogaValueAutoHelper(
|
|
680
|
-
yogaNode, YGEdgeBottom, result, YGNodeStyleSetMargin, YGNodeStyleSetMarginPercent, YGNodeStyleSetMarginAuto);
|
|
681
|
-
} else if (key == "marginHorizontal") {
|
|
682
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
683
|
-
|
|
684
|
-
SetYogaValueAutoHelper(
|
|
685
|
-
yogaNode,
|
|
686
|
-
YGEdgeHorizontal,
|
|
687
|
-
result,
|
|
688
|
-
YGNodeStyleSetMargin,
|
|
689
|
-
YGNodeStyleSetMarginPercent,
|
|
690
|
-
YGNodeStyleSetMarginAuto);
|
|
691
|
-
} else if (key == "marginVertical") {
|
|
692
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
693
|
-
|
|
694
|
-
SetYogaValueAutoHelper(
|
|
695
|
-
yogaNode,
|
|
696
|
-
YGEdgeVertical,
|
|
697
|
-
result,
|
|
698
|
-
YGNodeStyleSetMargin,
|
|
699
|
-
YGNodeStyleSetMarginPercent,
|
|
700
|
-
YGNodeStyleSetMarginAuto);
|
|
701
|
-
} else if (key == "padding") {
|
|
702
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
703
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
704
|
-
|
|
705
|
-
SetYogaValueHelper(yogaNode, YGEdgeAll, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
706
|
-
}
|
|
707
|
-
} else if (key == "paddingLeft") {
|
|
708
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
709
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
710
|
-
|
|
711
|
-
SetYogaValueHelper(yogaNode, YGEdgeLeft, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
712
|
-
}
|
|
713
|
-
} else if (key == "paddingStart") {
|
|
714
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
715
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
716
|
-
|
|
717
|
-
SetYogaValueHelper(yogaNode, YGEdgeStart, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
718
|
-
}
|
|
719
|
-
} else if (key == "paddingTop") {
|
|
720
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
721
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
722
|
-
|
|
723
|
-
SetYogaValueHelper(yogaNode, YGEdgeTop, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
724
|
-
}
|
|
725
|
-
} else if (key == "paddingRight") {
|
|
726
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
727
|
-
|
|
728
|
-
SetYogaValueHelper(yogaNode, YGEdgeRight, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
729
|
-
} else if (key == "paddingEnd") {
|
|
730
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
731
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
732
|
-
|
|
733
|
-
SetYogaValueHelper(yogaNode, YGEdgeEnd, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
734
|
-
}
|
|
735
|
-
} else if (key == "paddingBottom") {
|
|
736
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
737
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
738
|
-
|
|
739
|
-
SetYogaValueHelper(yogaNode, YGEdgeBottom, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
740
|
-
}
|
|
741
|
-
} else if (key == "paddingHorizontal") {
|
|
742
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
743
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
744
|
-
|
|
745
|
-
SetYogaValueHelper(yogaNode, YGEdgeHorizontal, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
746
|
-
}
|
|
747
|
-
} else if (key == "paddingVertical") {
|
|
748
|
-
if (!shadowNode.ImplementsPadding()) {
|
|
749
|
-
YGValue result = YGValueOrDefault(value, YGValue{YGUndefined, YGUnitPoint} /*default*/, shadowNode, key);
|
|
750
|
-
|
|
751
|
-
SetYogaValueHelper(yogaNode, YGEdgeVertical, result, YGNodeStyleSetPadding, YGNodeStyleSetPaddingPercent);
|
|
752
|
-
}
|
|
753
|
-
} else if (key == "borderWidth") {
|
|
754
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
755
|
-
|
|
756
|
-
YGNodeStyleSetBorder(yogaNode, YGEdgeAll, result);
|
|
757
|
-
} else if (key == "borderLeftWidth") {
|
|
758
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
759
|
-
|
|
760
|
-
YGNodeStyleSetBorder(yogaNode, YGEdgeLeft, result);
|
|
761
|
-
} else if (key == "borderStartWidth") {
|
|
762
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
763
|
-
|
|
764
|
-
YGNodeStyleSetBorder(yogaNode, YGEdgeStart, result);
|
|
765
|
-
} else if (key == "borderTopWidth") {
|
|
766
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
767
|
-
|
|
768
|
-
YGNodeStyleSetBorder(yogaNode, YGEdgeTop, result);
|
|
769
|
-
} else if (key == "borderRightWidth") {
|
|
770
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
771
|
-
|
|
772
|
-
YGNodeStyleSetBorder(yogaNode, YGEdgeRight, result);
|
|
773
|
-
} else if (key == "borderEndWidth") {
|
|
774
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
775
|
-
|
|
776
|
-
YGNodeStyleSetBorder(yogaNode, YGEdgeEnd, result);
|
|
777
|
-
} else if (key == "borderBottomWidth") {
|
|
778
|
-
float result = NumberOrDefault(value, 0.0f /*default*/);
|
|
779
|
-
|
|
780
|
-
YGNodeStyleSetBorder(yogaNode, YGEdgeBottom, result);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
void NativeUIManager::CreateView(ShadowNode &shadowNode, React::JSValueObject &props) {
|
|
786
|
-
TraceSection s("NativeUIManager::CreateView");
|
|
787
|
-
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
788
|
-
auto *pViewManager = node.GetViewManager();
|
|
789
|
-
|
|
790
|
-
if (pViewManager->RequiresYogaNode()) {
|
|
791
|
-
// Generate list of RN controls that need to have layout rerun on them.
|
|
792
|
-
if (node.NeedsForceLayout()) {
|
|
793
|
-
m_extraLayoutNodes.push_back(node.m_tag);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
auto result = m_tagsToYogaNodes.emplace(node.m_tag, make_yoga_node(m_yogaConfig));
|
|
797
|
-
if (result.second == true) {
|
|
798
|
-
YGNodeRef yogaNode = result.first->second.get();
|
|
799
|
-
StyleYogaNode(node, yogaNode, props);
|
|
800
|
-
|
|
801
|
-
YGMeasureFunc func = pViewManager->GetYogaCustomMeasureFunc();
|
|
802
|
-
if (func != nullptr) {
|
|
803
|
-
YGNodeSetMeasureFunc(yogaNode, func);
|
|
804
|
-
|
|
805
|
-
auto context = std::make_unique<Microsoft::ReactNative::YogaContext>(node.GetView());
|
|
806
|
-
YGNodeSetContext(yogaNode, reinterpret_cast<void *>(context.get()));
|
|
807
|
-
|
|
808
|
-
m_tagsToYogaContext.emplace(node.m_tag, std::move(context));
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
void NativeUIManager::AddView(ShadowNode &parentShadowNode, ShadowNode &childShadowNode, uint64_t index) {
|
|
815
|
-
ShadowNodeBase &parentNode = static_cast<ShadowNodeBase &>(parentShadowNode);
|
|
816
|
-
auto *pViewManager = parentNode.GetViewManager();
|
|
817
|
-
|
|
818
|
-
if (pViewManager->RequiresYogaNode() && !pViewManager->IsNativeControlWithSelfLayout()) {
|
|
819
|
-
YGNodeRef yogaNodeToManage = GetYogaNode(parentNode.m_tag);
|
|
820
|
-
ShadowNodeBase &childNode = static_cast<ShadowNodeBase &>(childShadowNode);
|
|
821
|
-
YGNodeRef yogaNodeToAdd = GetYogaNode(childNode.m_tag);
|
|
822
|
-
|
|
823
|
-
int64_t oldParentTag = childNode.GetParent();
|
|
824
|
-
YGNodeRef yogaOldParent = GetYogaNode(oldParentTag);
|
|
825
|
-
if (yogaOldParent != nullptr) {
|
|
826
|
-
YGNodeRemoveChild(yogaOldParent, yogaNodeToAdd);
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
YGNodeInsertChild(yogaNodeToManage, yogaNodeToAdd, static_cast<uint32_t>(index));
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
void NativeUIManager::RemoveView(ShadowNode &shadowNode, bool removeChildren /*= true*/) {
|
|
834
|
-
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
835
|
-
|
|
836
|
-
if (removeChildren) {
|
|
837
|
-
auto *pViewManager = node.GetViewManager();
|
|
838
|
-
|
|
839
|
-
YGNodeRef yogaNode = pViewManager->RequiresYogaNode() ? GetYogaNode(node.m_tag) : nullptr;
|
|
840
|
-
if (yogaNode != nullptr && !pViewManager->IsNativeControlWithSelfLayout()) {
|
|
841
|
-
auto childCount = YGNodeGetChildCount(yogaNode);
|
|
842
|
-
for (auto i = childCount; i > 0; --i) {
|
|
843
|
-
YGNodeRef yogaNodeToRemove = YGNodeGetChild(yogaNode, i - 1);
|
|
844
|
-
YGNodeRemoveChild(yogaNode, yogaNodeToRemove);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
m_tagsToYogaNodes.erase(node.m_tag);
|
|
850
|
-
m_tagsToYogaContext.erase(node.m_tag);
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
void NativeUIManager::ReplaceView(ShadowNode &shadowNode) {
|
|
854
|
-
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
855
|
-
auto *pViewManager = node.GetViewManager();
|
|
856
|
-
|
|
857
|
-
if (pViewManager->RequiresYogaNode()) {
|
|
858
|
-
auto it = m_tagsToYogaNodes.find(node.m_tag);
|
|
859
|
-
if (it != m_tagsToYogaNodes.end()) {
|
|
860
|
-
YGNodeRef yogaNode = it->second.get();
|
|
861
|
-
|
|
862
|
-
if (pViewManager->IsNativeControlWithSelfLayout()) {
|
|
863
|
-
auto context = std::make_unique<YogaContext>(node.GetView());
|
|
864
|
-
YGNodeSetContext(yogaNode, reinterpret_cast<void *>(context.get()));
|
|
865
|
-
|
|
866
|
-
m_tagsToYogaContext.erase(node.m_tag);
|
|
867
|
-
m_tagsToYogaContext.emplace(node.m_tag, std::move(context));
|
|
868
|
-
}
|
|
869
|
-
} else {
|
|
870
|
-
assert(false);
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
void NativeUIManager::UpdateView(ShadowNode &shadowNode, winrt::Microsoft::ReactNative::JSValueObject &props) {
|
|
877
|
-
TraceSection s("NativeUIManager::UpdateView");
|
|
878
|
-
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
879
|
-
auto *pViewManager = node.GetViewManager();
|
|
880
|
-
|
|
881
|
-
if (pViewManager->RequiresYogaNode()) {
|
|
882
|
-
YGNodeRef yogaNode = GetYogaNode(node.m_tag);
|
|
883
|
-
StyleYogaNode(node, yogaNode, props);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
void NativeUIManager::DoLayout() {
|
|
888
|
-
TraceSection s("NativeUIManager::DoLayout");
|
|
889
|
-
|
|
890
|
-
{
|
|
891
|
-
TraceSection s("NativeUIManager::DoLayout::UpdateLayout");
|
|
892
|
-
// Process vector of RN controls needing extra layout here.
|
|
893
|
-
const auto extraLayoutNodes = m_extraLayoutNodes;
|
|
894
|
-
for (const int64_t tag : extraLayoutNodes) {
|
|
895
|
-
ShadowNodeBase *node = static_cast<ShadowNodeBase *>(m_host->FindShadowNodeForTag(tag));
|
|
896
|
-
if (node) {
|
|
897
|
-
auto element = node->GetView().as<xaml::FrameworkElement>();
|
|
898
|
-
element.UpdateLayout();
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
// Values need to be cleared from the vector before next call to DoLayout.
|
|
902
|
-
m_extraLayoutNodes.clear();
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
auto &rootTags = m_host->GetAllRootTags();
|
|
906
|
-
for (int64_t rootTag : rootTags) {
|
|
907
|
-
ShadowNodeBase &rootShadowNode = static_cast<ShadowNodeBase &>(m_host->GetShadowNodeForTag(rootTag));
|
|
908
|
-
const auto rootElement = rootShadowNode.GetView().as<xaml::FrameworkElement>();
|
|
909
|
-
float actualWidth = static_cast<float>(rootElement.ActualWidth());
|
|
910
|
-
float actualHeight = static_cast<float>(rootElement.ActualHeight());
|
|
911
|
-
ApplyLayout(rootTag, actualWidth, actualHeight);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
void NativeUIManager::ApplyLayout(int64_t tag, float width, float height) {
|
|
916
|
-
if (YGNodeRef rootNode = GetYogaNode(tag)) {
|
|
917
|
-
TraceSection s("NativeUIManager::DoLayout::YGNodeCalculateLayout");
|
|
918
|
-
// We must always run layout in LTR mode, which might seem unintuitive.
|
|
919
|
-
// We will flip the root of the tree into RTL by forcing the root XAML node's FlowDirection to RightToLeft
|
|
920
|
-
// which will inherit down the XAML tree, allowing all native controls to pick it up.
|
|
921
|
-
YGNodeCalculateLayout(rootNode, width, height, YGDirectionLTR);
|
|
922
|
-
} else {
|
|
923
|
-
assert(false);
|
|
924
|
-
return;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
{
|
|
928
|
-
TraceSection s("NativeUIManager::DoLayout::SetLayoutProps");
|
|
929
|
-
SetLayoutPropsRecursive(tag);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
void NativeUIManager::SetLayoutPropsRecursive(int64_t tag) {
|
|
934
|
-
if (!m_host) {
|
|
935
|
-
return;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
auto *shadowNodePtr = m_host->FindShadowNodeForTag(tag);
|
|
939
|
-
if (!shadowNodePtr) {
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
ShadowNodeBase &shadowNode = static_cast<ShadowNodeBase &>(*shadowNodePtr);
|
|
944
|
-
auto *pViewManager = shadowNode.GetViewManager();
|
|
945
|
-
if (!pViewManager) {
|
|
946
|
-
return;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
if (!pViewManager->IsNativeControlWithSelfLayout()) {
|
|
950
|
-
for (const auto child : shadowNode.m_children) {
|
|
951
|
-
SetLayoutPropsRecursive(child);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
const auto tagToYogaNode = m_tagsToYogaNodes.find(tag);
|
|
956
|
-
if (auto yogaNode = GetYogaNode(tag)) {
|
|
957
|
-
if (!YGNodeGetHasNewLayout(yogaNode))
|
|
958
|
-
return;
|
|
959
|
-
YGNodeSetHasNewLayout(yogaNode, false);
|
|
960
|
-
|
|
961
|
-
float left = YGNodeLayoutGetLeft(yogaNode);
|
|
962
|
-
float top = YGNodeLayoutGetTop(yogaNode);
|
|
963
|
-
float width = YGNodeLayoutGetWidth(yogaNode);
|
|
964
|
-
float height = YGNodeLayoutGetHeight(yogaNode);
|
|
965
|
-
auto view = shadowNode.GetView();
|
|
966
|
-
auto pViewManager = shadowNode.GetViewManager();
|
|
967
|
-
|
|
968
|
-
if (pViewManager) {
|
|
969
|
-
pViewManager->SetLayoutProps(shadowNode, view, left, top, width, height);
|
|
970
|
-
if (shadowNode.m_onLayoutRegistered) {
|
|
971
|
-
const auto hasLayoutChanged = !YogaFloatEquals(left, shadowNode.m_layout.Left) ||
|
|
972
|
-
!YogaFloatEquals(top, shadowNode.m_layout.Top) || !YogaFloatEquals(width, shadowNode.m_layout.Width) ||
|
|
973
|
-
!YogaFloatEquals(height, shadowNode.m_layout.Height);
|
|
974
|
-
if (hasLayoutChanged) {
|
|
975
|
-
React::JSValueObject layout{{"x", left}, {"y", top}, {"height", height}, {"width", width}};
|
|
976
|
-
React::JSValueObject eventData{{"target", tag}, {"layout", std::move(layout)}};
|
|
977
|
-
pViewManager->DispatchCoalescingEvent(tag, L"topLayout", MakeJSValueWriter(std::move(eventData)));
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
shadowNode.m_layout = {left, top, width, height};
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
winrt::Windows::Foundation::Rect GetRectOfElementInParentCoords(
|
|
986
|
-
xaml::FrameworkElement element,
|
|
987
|
-
xaml::UIElement parent) {
|
|
988
|
-
if (parent == nullptr) {
|
|
989
|
-
assert(false);
|
|
990
|
-
return winrt::Windows::Foundation::Rect();
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
winrt::Rect anchorRect;
|
|
994
|
-
winrt::Point anchorTopLeft = winrt::Point(0, 0);
|
|
995
|
-
|
|
996
|
-
winrt::GeneralTransform transform = element.TransformToVisual(parent);
|
|
997
|
-
winrt::Point anchorTopLeftConverted = transform.TransformPoint(anchorTopLeft);
|
|
998
|
-
|
|
999
|
-
anchorRect.X = anchorTopLeftConverted.X;
|
|
1000
|
-
anchorRect.Y = anchorTopLeftConverted.Y;
|
|
1001
|
-
anchorRect.Width = (float)element.ActualWidth();
|
|
1002
|
-
anchorRect.Height = (float)element.ActualHeight();
|
|
1003
|
-
|
|
1004
|
-
return anchorRect;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
void NativeUIManager::measure(
|
|
1008
|
-
ShadowNode &shadowNode,
|
|
1009
|
-
ShadowNode &shadowRoot,
|
|
1010
|
-
std::function<void(double left, double top, double width, double height, double pageX, double pageY)> &&callback) {
|
|
1011
|
-
std::vector<folly::dynamic> args;
|
|
1012
|
-
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
1013
|
-
auto view = node.GetView();
|
|
1014
|
-
|
|
1015
|
-
auto feView = view.try_as<xaml::FrameworkElement>();
|
|
1016
|
-
if (feView == nullptr) {
|
|
1017
|
-
callback(0, 0, 0, 0, 0, 0);
|
|
1018
|
-
return;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
// Retrieve the XAML element for the root view containing this view
|
|
1022
|
-
auto feRootView = static_cast<ShadowNodeBase &>(shadowRoot).GetView().try_as<xaml::FrameworkElement>();
|
|
1023
|
-
if (feRootView == nullptr) {
|
|
1024
|
-
callback(0, 0, 0, 0, 0, 0);
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
winrt::Rect rectInParentCoords = GetRectOfElementInParentCoords(feView, feRootView);
|
|
1029
|
-
|
|
1030
|
-
// TODO: The first two params are for the local position. It's unclear what
|
|
1031
|
-
// this is exactly, but it is not used anyway.
|
|
1032
|
-
// Either codify this non-use or determine if and how we can send the needed
|
|
1033
|
-
// data.
|
|
1034
|
-
callback(0, 0, rectInParentCoords.Width, rectInParentCoords.Height, rectInParentCoords.X, rectInParentCoords.Y);
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
void NativeUIManager::measureInWindow(
|
|
1038
|
-
ShadowNode &shadowNode,
|
|
1039
|
-
std::function<void(double x, double y, double width, double height)> &&callback) {
|
|
1040
|
-
std::vector<folly::dynamic> args;
|
|
1041
|
-
|
|
1042
|
-
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
1043
|
-
|
|
1044
|
-
if (auto view = node.GetView().try_as<xaml::FrameworkElement>()) {
|
|
1045
|
-
// When supplied with nullptr, TransformToVisual will return the position
|
|
1046
|
-
// relative to the root XAML element.
|
|
1047
|
-
auto windowTransform = view.TransformToVisual(nullptr);
|
|
1048
|
-
auto positionInWindow = windowTransform.TransformPoint({0, 0});
|
|
1049
|
-
|
|
1050
|
-
callback(positionInWindow.X, positionInWindow.Y, view.ActualWidth(), view.ActualHeight());
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
callback(0, 0, 0, 0);
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
void NativeUIManager::measureLayout(
|
|
1058
|
-
ShadowNode &shadowNode,
|
|
1059
|
-
ShadowNode &ancestorNode,
|
|
1060
|
-
std::function<void(React::JSValue const &)> &&errorCallback,
|
|
1061
|
-
std::function<void(double left, double top, double width, double height)> &&callback) {
|
|
1062
|
-
std::vector<folly::dynamic> args;
|
|
1063
|
-
try {
|
|
1064
|
-
const auto &target = static_cast<ShadowNodeBase &>(shadowNode);
|
|
1065
|
-
const auto &ancestor = static_cast<ShadowNodeBase &>(ancestorNode);
|
|
1066
|
-
const auto targetElement = target.GetView().as<xaml::FrameworkElement>();
|
|
1067
|
-
const auto ancestorElement = ancestor.GetView().as<xaml::FrameworkElement>();
|
|
1068
|
-
|
|
1069
|
-
const auto ancestorTransform = targetElement.TransformToVisual(ancestorElement);
|
|
1070
|
-
const auto width = static_cast<float>(targetElement.ActualWidth());
|
|
1071
|
-
const auto height = static_cast<float>(targetElement.ActualHeight());
|
|
1072
|
-
const auto transformedBounds = ancestorTransform.TransformBounds(winrt::Rect(0, 0, width, height));
|
|
1073
|
-
|
|
1074
|
-
callback(transformedBounds.X, transformedBounds.Y, transformedBounds.Width, transformedBounds.Height);
|
|
1075
|
-
} catch (winrt::hresult_error const &e) {
|
|
1076
|
-
auto writer = React::MakeJSValueTreeWriter();
|
|
1077
|
-
writer.WriteString(e.message());
|
|
1078
|
-
errorCallback(React::TakeJSValue(writer));
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
void NativeUIManager::findSubviewIn(
|
|
1083
|
-
ShadowNode &shadowNode,
|
|
1084
|
-
float x,
|
|
1085
|
-
float y,
|
|
1086
|
-
std::function<void(double nativeViewTag, double left, double top, double width, double height)> &&callback) {
|
|
1087
|
-
ShadowNodeBase &node = static_cast<ShadowNodeBase &>(shadowNode);
|
|
1088
|
-
auto view = node.GetView();
|
|
1089
|
-
|
|
1090
|
-
auto rootUIView = view.try_as<xaml::UIElement>();
|
|
1091
|
-
if (rootUIView == nullptr) {
|
|
1092
|
-
callback(0, 0, 0, 0, 0);
|
|
1093
|
-
return;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
winrt::Point point{x, y};
|
|
1097
|
-
|
|
1098
|
-
// Transform the point to app window coordinates because
|
|
1099
|
-
// FindElementsInHostCoordinate() work in that metric
|
|
1100
|
-
auto appWindowTransform = rootUIView.TransformToVisual(nullptr);
|
|
1101
|
-
auto pointInAppWindow = appWindowTransform.TransformPoint(point);
|
|
1102
|
-
|
|
1103
|
-
// Perform hit test to find the top most z-index element that intersects with
|
|
1104
|
-
// the queried point
|
|
1105
|
-
auto hitTestElements = winrt::VisualTreeHelper::FindElementsInHostCoordinates(pointInAppWindow, rootUIView);
|
|
1106
|
-
|
|
1107
|
-
int64_t foundTag{};
|
|
1108
|
-
xaml::FrameworkElement foundElement = nullptr;
|
|
1109
|
-
|
|
1110
|
-
for (const auto &elem : hitTestElements) {
|
|
1111
|
-
if (foundElement = elem.try_as<xaml::FrameworkElement>()) {
|
|
1112
|
-
auto tag = GetTag(foundElement);
|
|
1113
|
-
if (tag != InvalidTag) {
|
|
1114
|
-
foundTag = tag;
|
|
1115
|
-
break;
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
if (foundElement == nullptr) {
|
|
1121
|
-
callback(0, 0, 0, 0, 0);
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
auto box = GetRectOfElementInParentCoords(foundElement, rootUIView);
|
|
1126
|
-
callback(static_cast<double>(foundTag), box.X, box.Y, box.Width, box.Height);
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
void NativeUIManager::focus(int64_t reactTag) {
|
|
1130
|
-
if (auto shadowNode = static_cast<ShadowNodeBase *>(m_host->FindShadowNodeForTag(reactTag))) {
|
|
1131
|
-
const auto view = shadowNode->GetView();
|
|
1132
|
-
|
|
1133
|
-
// Only allow focus on an element with a XamlRoot that matches the current XamlRoot or that
|
|
1134
|
-
// has a different CoreDispatcher for the XamlRoot, otherwise focusing the element will steal
|
|
1135
|
-
// window focus, which is generally not desired behavior.
|
|
1136
|
-
const auto properties = React::ReactPropertyBag(m_context.Properties());
|
|
1137
|
-
if (winrt::Microsoft::ReactNative::implementation::QuirkSettings::GetSuppressWindowFocusOnViewFocus(properties)) {
|
|
1138
|
-
if (const auto uiElement = view.try_as<xaml::UIElement>()) {
|
|
1139
|
-
if (const auto activeXamlRoot = React::XamlUIService::GetXamlRoot(properties.Handle())) {
|
|
1140
|
-
const auto activeDispatcher = activeXamlRoot.Content() ? activeXamlRoot.Content().Dispatcher() : nullptr;
|
|
1141
|
-
if (uiElement.XamlRoot() != activeXamlRoot && uiElement.Dispatcher() == activeDispatcher) {
|
|
1142
|
-
const auto suppressedFocusMessage = L"Suppressed focus on view in XamlRoot not currently in focus.";
|
|
1143
|
-
m_context.CallJSFunction(L"RCTLog", L"logToConsole", L"warn", suppressedFocusMessage);
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
xaml::Input::FocusManager::TryFocusAsync(view, winrt::FocusState::Programmatic);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
// Note: It's a known issue that blur on flyout/popup would dismiss them.
|
|
1155
|
-
void NativeUIManager::blur(int64_t reactTag) {
|
|
1156
|
-
if (auto shadowNode = static_cast<ShadowNodeBase *>(m_host->FindShadowNodeForTag(reactTag))) {
|
|
1157
|
-
// Only blur if current UI is focused to avoid problem described in PR #2687
|
|
1158
|
-
const auto xamlRoot = tryGetXamlRoot(shadowNode->m_rootTag);
|
|
1159
|
-
const auto focusedElement = xamlRoot ? xaml::Input::FocusManager::GetFocusedElement(xamlRoot)
|
|
1160
|
-
: xaml::Input::FocusManager::GetFocusedElement();
|
|
1161
|
-
if (shadowNode->GetView() == focusedElement) {
|
|
1162
|
-
if (auto reactControl = GetParentXamlReactControl(reactTag).get()) {
|
|
1163
|
-
reactControl.as<winrt::Microsoft::ReactNative::implementation::ReactRootView>()->blur(shadowNode->GetView());
|
|
1164
|
-
} else {
|
|
1165
|
-
assert(false);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
// The same react instance can be shared by multiple ReactControls.
|
|
1172
|
-
// To reduce the dependency between modules, IXamlReactControl other than
|
|
1173
|
-
// ReactControl is used here. To get the IXamlReactControl for any node, we
|
|
1174
|
-
// first iterate its parent until reaching the root node. Then look up
|
|
1175
|
-
// m_tagsToXamlReactControl to get the IXamlReactControl
|
|
1176
|
-
winrt::weak_ref<winrt::Microsoft::ReactNative::ReactRootView> NativeUIManager::GetParentXamlReactControl(
|
|
1177
|
-
int64_t tag) const {
|
|
1178
|
-
if (auto shadowNode = m_host->FindShadowNodeForTag(tag)) {
|
|
1179
|
-
auto it = m_tagsToXamlReactControl.find(shadowNode->m_rootTag);
|
|
1180
|
-
if (it != m_tagsToXamlReactControl.end()) {
|
|
1181
|
-
return it->second;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
return {};
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
} // namespace Microsoft::ReactNative
|