react-native-windows 0.75.4 → 0.76.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 +6 -4
- package/Directory.Build.props +4 -0
- package/Directory.Build.targets +5 -0
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Alert/Alert.windows.js +3 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +7 -7
- package/Libraries/Animated/NativeAnimatedAllowlist.js +111 -0
- package/Libraries/Animated/animations/Animation.js +11 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -1
- package/Libraries/Animated/animations/SpringAnimation.js +1 -1
- package/Libraries/Animated/animations/TimingAnimation.js +2 -1
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/createAnimatedComponent.js +10 -9
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +3 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +42 -33
- package/Libraries/Animated/nodes/AnimatedObject.js +56 -50
- package/Libraries/Animated/nodes/AnimatedProps.js +77 -40
- package/Libraries/Animated/nodes/AnimatedStyle.js +103 -59
- package/Libraries/Animated/nodes/AnimatedTracking.js +1 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +102 -67
- package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +21 -22
- package/Libraries/Animated/useAnimatedProps.js +142 -7
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/FileReader.js +1 -1
- package/Libraries/Blob/URL.js +2 -62
- package/Libraries/Blob/URLSearchParams.js +71 -0
- package/Libraries/Components/Button.windows.js +0 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.js +131 -169
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
- package/Libraries/Components/TextInput/TextInput.js +230 -94
- package/Libraries/Components/TextInput/TextInput.windows.js +230 -105
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +22 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.windows.js +2 -0
- package/Libraries/Components/View/View.windows.js +32 -30
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewNativeComponent.js +0 -1
- package/Libraries/Components/View/ViewPropTypes.js +14 -0
- package/Libraries/Components/View/ViewPropTypes.windows.js +14 -0
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/InitializeCore.js +3 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
- package/Libraries/Core/ReactNativeVersion.js +4 -4
- package/Libraries/Core/setUpErrorHandling.js +7 -1
- package/Libraries/Core/setUpGlobals.js +1 -0
- package/Libraries/Core/setUpReactRefresh.js +0 -4
- package/Libraries/Image/AssetSourceResolver.js +28 -1
- package/Libraries/Image/AssetSourceResolver.windows.js +28 -1
- package/Libraries/Image/Image.android.js +9 -14
- package/Libraries/Image/Image.ios.js +11 -22
- package/Libraries/Image/Image.windows.js +11 -22
- package/Libraries/Image/ImageBackground.js +1 -8
- package/Libraries/Image/ImageUtils.js +9 -9
- package/Libraries/Image/ImageViewNativeComponent.js +1 -0
- package/Libraries/Inspector/Inspector.js +3 -2
- package/Libraries/Inspector/InspectorPanel.js +16 -10
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/Lists/FlatList.js +1 -1
- package/Libraries/Lists/SectionList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +3 -3
- package/Libraries/LogBox/Data/LogBoxData.js +24 -3
- package/Libraries/LogBox/LogBoxNotificationContainer.js +3 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +9 -8
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.windows.js +9 -8
- package/Libraries/Modal/Modal.js +0 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +8 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +7 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +22 -22
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -21
- package/Libraries/Network/XMLHttpRequest.js +4 -2
- package/Libraries/ReactNative/AppContainer-dev.js +1 -5
- package/Libraries/ReactNative/AppContainer-prod.js +1 -5
- package/Libraries/ReactNative/AppContainer.js +1 -2
- package/Libraries/ReactNative/AppRegistry.d.ts +0 -4
- package/Libraries/ReactNative/AppRegistry.js +1 -7
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
- package/Libraries/ReactNative/RendererImplementation.js +26 -4
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
- package/Libraries/ReactNative/renderApplication.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +11 -4
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +57 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +60 -5
- package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
- package/Libraries/StyleSheet/processBoxShadow.js +211 -0
- package/Libraries/StyleSheet/processFilter.js +231 -42
- package/Libraries/Text/Text.js +394 -196
- package/Libraries/Text/Text.windows.js +476 -300
- package/Libraries/Text/TextNativeComponent.js +2 -1
- package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
- package/Libraries/Types/CodegenTypes.js +3 -1
- package/Libraries/Utilities/Appearance.js +108 -84
- package/Libraries/Utilities/DevLoadingView.js +2 -4
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +0 -9
- package/Libraries/Utilities/stringifyViewConfig.js +22 -0
- package/Libraries/Utilities/useColorScheme.js +3 -3
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +6 -5
- package/Microsoft.ReactNative/ComponentView.idl +11 -0
- package/Microsoft.ReactNative/Composition.Input.idl +1 -0
- package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +9 -9
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +9 -9
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +7 -9
- package/Microsoft.ReactNative/Fabric/ComponentView.h +5 -6
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +44 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +42 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +81 -63
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -3
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +8 -6
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +20 -6
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +13 -6
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +2 -3
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +72 -54
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +14 -4
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +26 -8
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +18 -7
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +6 -6
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +97 -140
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +8 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +18 -11
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +5 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -13
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +29 -4
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +28 -12
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +33 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +26 -9
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +10 -4
- package/Microsoft.ReactNative/IReactModuleBuilder.cpp +5 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.h +1 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.idl +9 -0
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +8 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +3 -1
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppearanceModule.h +7 -1
- package/Microsoft.ReactNative/Modules/DevSettingsModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/DevSettingsModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +9 -0
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +121 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.h +90 -0
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -7
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -5
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +5 -1
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +59 -0
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +23 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +179 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.h +35 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +69 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +82 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.h +38 -0
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +45 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +2 -1
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +25 -16
- package/Microsoft.ReactNative/packages.fabric.lock.json +159 -0
- package/Microsoft.ReactNative/packages.lock.json +11 -12
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +3 -4
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +3 -0
- package/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp +2 -2
- package/Microsoft.ReactNative.Cxx/ModuleRegistration.h +62 -4
- package/Microsoft.ReactNative.Cxx/NativeModules.h +131 -14
- package/Microsoft.ReactNative.Managed/packages.lock.json +9 -9
- package/Microsoft.ReactNative.Managed.CodeGen/ReactNativeNames.cs +10 -2
- package/PropertySheets/Autolink.props +1 -1
- package/PropertySheets/Bundle.props +1 -1
- package/PropertySheets/Codegen.props +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/NuGet.LockFile.props +18 -0
- package/README.md +29 -29
- package/ReactCommon/ReactCommon.vcxproj +5 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +11 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +2 -7
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +441 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +266 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/Utf8.h +56 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Base.h +3 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Bridging.h +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/CallbackWrapper.h +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Convert.h +172 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/EventEmitter.h +4 -5
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Function.h +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +3 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/scrollview/ScrollViewProps.cpp +9 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +363 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/JSRuntimeFactory.h +22 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +118 -51
- package/ReactCommon/packages.lock.json +2 -2
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +8 -1
- package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +2 -2
- package/Shared/Modules/WebSocketModule.cpp +1 -2
- package/Shared/Networking/WinRTWebSocketResource.cpp +4 -1
- package/Shared/Shared.vcxitems +38 -2
- package/Shared/Shared.vcxitems.filters +6 -1
- package/Shared/TurboModuleManager.cpp +0 -3
- package/codegen/NativeLinkingManagerSpec.g.h +3 -3
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +198 -54
- package/codegen/NativeSampleTurboModuleSpec.g.h +35 -0
- package/codegen/rnwcoreJSI-generated.cpp +245 -101
- package/codegen/rnwcoreJSI.h +847 -548
- package/index.js +3 -1
- package/index.windows.js +3 -1
- package/jest/mockComponent.js +4 -1
- package/jest/mockModal.js +1 -3
- package/jest/mockScrollView.js +1 -1
- package/jest/renderer.js +2 -2
- package/jest/setup.js +16 -13
- package/package.json +29 -29
- package/src/private/animated/NativeAnimatedHelper.js +438 -0
- package/src/private/animated/NativeAnimatedValidation.js +64 -0
- package/src/private/components/HScrollViewNativeComponents.js +56 -0
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +27 -0
- package/src/private/components/VScrollViewNativeComponents.js +48 -0
- package/src/private/components/useSyncOnScroll.js +48 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +166 -16
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +29 -5
- package/src/private/fusebox/FuseboxSessionObserver.js +42 -0
- package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +14 -4
- package/src/private/setup/setUpDOM.js +28 -0
- package/src/private/setup/setUpIntersectionObserver.js +27 -0
- package/src/private/setup/setUpMutationObserver.js +26 -0
- package/src/private/setup/setUpPerformanceObserver.js +64 -0
- package/src/private/specs/modules/NativeAppearance.js +3 -3
- package/src/private/specs/modules/NativeLinkingManager.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsWindows.js +7 -0
- package/src/private/specs/modules/NativeSampleTurboModule.js +14 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +5 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +14 -17
- package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +5 -3
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +24 -15
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
- package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
- package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
- package/src/private/webapis/performance/LongTasks.js +39 -0
- package/src/private/webapis/performance/Performance.js +22 -9
- package/src/private/webapis/performance/PerformanceEntry.js +36 -18
- package/src/private/webapis/performance/PerformanceObserver.js +29 -43
- package/src/private/webapis/performance/RawPerformanceEntry.js +24 -1
- package/src/private/webapis/performance/UserTiming.js +17 -12
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
- package/template/cpp-app/src/AutolinkedNativeModules.g.cpp +1 -1
- package/template/cpp-app/src/AutolinkedNativeModules.g.h +1 -1
- package/template/cs-app/src/AutolinkedNativeModules.g.cs +1 -1
- package/template/index.windows.bundle +1 -1
- package/template/metro.config.js +2 -2
- package/template/shared-app/src/AutolinkedNativeModules.g.props +1 -1
- package/template/shared-app/src/AutolinkedNativeModules.g.targets +1 -1
- package/templates/cpp-app/metro.config.js +2 -2
- package/templates/cpp-app/template.config.js +5 -5
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.cpp +1 -1
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.h +1 -1
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +2 -0
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +1 -1
- package/templates/cpp-lib/example/metro.config.js +2 -2
- package/templates/cpp-lib/template.config.js +3 -3
- package/templates/cpp-lib/windows/MyLib/MyLib.h +3 -3
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
- package/types/experimental.d.ts +20 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +0 -615
- package/Libraries/Core/setUpIntersectionObserver.js +0 -16
- package/Libraries/Core/setUpMutationObserver.js +0 -16
- package/Libraries/Core/setUpPerformanceObserver.js +0 -18
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
- package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -135
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +0 -2396
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.cpp +0 -136
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +0 -92
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.cpp +0 -48
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +0 -122
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +0 -388
- package/src/private/core/setUpDOM.js +0 -18
- package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
- /package/src/private/{core → styles}/composeStyles.js +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "SampleTurboModule.h"
|
|
6
|
+
|
|
7
|
+
namespace Microsoft::ReactNative {
|
|
8
|
+
|
|
9
|
+
void SampleTurboModule::Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
10
|
+
m_reactContext = reactContext;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ReactNativeSpecs::SampleTurboModuleSpec_Constants SampleTurboModule::GetConstants() noexcept {
|
|
14
|
+
ReactNativeSpecs::SampleTurboModuleSpec_Constants constants;
|
|
15
|
+
constants.const1 = true;
|
|
16
|
+
constants.const2 = 375;
|
|
17
|
+
constants.const3 = "something";
|
|
18
|
+
return constants;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
void SampleTurboModule::voidFunc() noexcept {
|
|
22
|
+
onPress();
|
|
23
|
+
onClick("click");
|
|
24
|
+
|
|
25
|
+
ReactNativeSpecs::SampleTurboModuleSpec_ObjectStruct obj;
|
|
26
|
+
obj.a = 1;
|
|
27
|
+
obj.b = "two";
|
|
28
|
+
onChange(obj);
|
|
29
|
+
ReactNativeSpecs::SampleTurboModuleSpec_ObjectStruct obj2;
|
|
30
|
+
obj2.a = 3;
|
|
31
|
+
obj2.b = "four";
|
|
32
|
+
auto writer = winrt::Microsoft::ReactNative::MakeJSValueTreeWriter();
|
|
33
|
+
writer.WriteArrayBegin();
|
|
34
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, obj);
|
|
35
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, obj2);
|
|
36
|
+
writer.WriteArrayEnd();
|
|
37
|
+
onSubmit(winrt::Microsoft::ReactNative::TakeJSValue(writer).MoveArray());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
bool SampleTurboModule::getBool(bool arg) noexcept {
|
|
41
|
+
return arg;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
double SampleTurboModule::getEnum(double arg) noexcept {
|
|
45
|
+
return arg;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
double SampleTurboModule::getNumber(double arg) noexcept {
|
|
49
|
+
return arg;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
std::string SampleTurboModule::getString(std::string arg) noexcept {
|
|
53
|
+
return std::string(arg);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
::React::JSValueArray SampleTurboModule::getArray(::React::JSValueArray &&arg) noexcept {
|
|
57
|
+
return arg.Copy();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
::React::JSValue SampleTurboModule::getObject(::React::JSValue &&arg) noexcept {
|
|
61
|
+
assert(arg.Type() == ::React::JSValueType::Object);
|
|
62
|
+
return arg.Copy();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
::React::JSValue SampleTurboModule::getUnsafeObject(::React::JSValue &&arg) noexcept {
|
|
66
|
+
assert(arg.Type() == ::React::JSValueType::Object);
|
|
67
|
+
return arg.Copy();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
double SampleTurboModule::getRootTag(double arg) noexcept {
|
|
71
|
+
// TODO: Proper impl
|
|
72
|
+
return arg;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
::React::JSValue SampleTurboModule::getValue(double x, std::string y, ::React::JSValue &&z) noexcept {
|
|
76
|
+
return ::React::JSValueObject{
|
|
77
|
+
{"x", x},
|
|
78
|
+
{"y", y},
|
|
79
|
+
{"z", z.Copy()},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
void SampleTurboModule::getValueWithCallback(std::function<void(std::string)> const &callback) noexcept {
|
|
84
|
+
callback("value from callback!");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void SampleTurboModule::getValueWithPromise(bool error, ::React::ReactPromise<std::string> &&result) noexcept {
|
|
88
|
+
if (error) {
|
|
89
|
+
result.Reject("intentional promise rejection");
|
|
90
|
+
} else {
|
|
91
|
+
result.Resolve("result!");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void SampleTurboModule::voidFuncThrows() noexcept {
|
|
96
|
+
// TODO: Proper impl
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
::React::JSValue SampleTurboModule::getObjectThrows(::React::JSValue &&arg) noexcept {
|
|
100
|
+
// TODO: Proper impl
|
|
101
|
+
return nullptr;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void SampleTurboModule::promiseThrows(::React::ReactPromise<void> &&result) noexcept {
|
|
105
|
+
// TODO: Proper impl
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
void SampleTurboModule::voidFuncAssert() noexcept {
|
|
109
|
+
// TODO: Proper impl
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
::React::JSValue SampleTurboModule::getObjectAssert(::React::JSValue &&arg) noexcept {
|
|
113
|
+
// TODO: Proper impl
|
|
114
|
+
return nullptr;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void SampleTurboModule::promiseAssert(::React::ReactPromise<void> &&result) noexcept {
|
|
118
|
+
// TODO: Proper impl
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include "codegen/NativeSampleTurboModuleSpec.g.h"
|
|
6
|
+
#include <NativeModules.h>
|
|
7
|
+
|
|
8
|
+
namespace Microsoft::ReactNative {
|
|
9
|
+
|
|
10
|
+
REACT_TURBO_MODULE(SampleTurboModule)
|
|
11
|
+
struct SampleTurboModule {
|
|
12
|
+
using ModuleSpec = ReactNativeSpecs::SampleTurboModuleSpec;
|
|
13
|
+
|
|
14
|
+
REACT_INIT(Initialize)
|
|
15
|
+
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
16
|
+
|
|
17
|
+
REACT_EVENT(onPress)
|
|
18
|
+
std::function<void()> onPress;
|
|
19
|
+
|
|
20
|
+
REACT_EVENT(onClick)
|
|
21
|
+
std::function<void(std::string)> onClick;
|
|
22
|
+
|
|
23
|
+
REACT_EVENT(onChange)
|
|
24
|
+
std::function<void(ReactNativeSpecs::SampleTurboModuleSpec_ObjectStruct)> onChange;
|
|
25
|
+
|
|
26
|
+
REACT_EVENT(onSubmit)
|
|
27
|
+
std::function<void(winrt::Microsoft::ReactNative::JSValueArray)> onSubmit;
|
|
28
|
+
|
|
29
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
30
|
+
ReactNativeSpecs::SampleTurboModuleSpec_Constants GetConstants() noexcept;
|
|
31
|
+
|
|
32
|
+
REACT_METHOD(voidFunc)
|
|
33
|
+
void voidFunc() noexcept;
|
|
34
|
+
|
|
35
|
+
REACT_SYNC_METHOD(getBool)
|
|
36
|
+
bool getBool(bool arg) noexcept;
|
|
37
|
+
|
|
38
|
+
REACT_SYNC_METHOD(getEnum)
|
|
39
|
+
double getEnum(double arg) noexcept;
|
|
40
|
+
|
|
41
|
+
REACT_SYNC_METHOD(getNumber)
|
|
42
|
+
double getNumber(double arg) noexcept;
|
|
43
|
+
|
|
44
|
+
REACT_SYNC_METHOD(getString)
|
|
45
|
+
std::string getString(std::string arg) noexcept;
|
|
46
|
+
|
|
47
|
+
REACT_SYNC_METHOD(getArray)
|
|
48
|
+
::React::JSValueArray getArray(::React::JSValueArray &&arg) noexcept;
|
|
49
|
+
|
|
50
|
+
REACT_SYNC_METHOD(getObject)
|
|
51
|
+
::React::JSValue getObject(::React::JSValue &&arg) noexcept;
|
|
52
|
+
|
|
53
|
+
REACT_SYNC_METHOD(getUnsafeObject)
|
|
54
|
+
::React::JSValue getUnsafeObject(::React::JSValue &&arg) noexcept;
|
|
55
|
+
|
|
56
|
+
REACT_SYNC_METHOD(getRootTag)
|
|
57
|
+
double getRootTag(double arg) noexcept;
|
|
58
|
+
|
|
59
|
+
REACT_SYNC_METHOD(getValue)
|
|
60
|
+
::React::JSValue getValue(double x, std::string y, ::React::JSValue &&z) noexcept;
|
|
61
|
+
|
|
62
|
+
REACT_METHOD(getValueWithCallback)
|
|
63
|
+
void getValueWithCallback(std::function<void(std::string)> const &callback) noexcept;
|
|
64
|
+
|
|
65
|
+
REACT_METHOD(getValueWithPromise)
|
|
66
|
+
void getValueWithPromise(bool error, ::React::ReactPromise<std::string> &&result) noexcept;
|
|
67
|
+
|
|
68
|
+
REACT_METHOD(voidFuncThrows)
|
|
69
|
+
void voidFuncThrows() noexcept;
|
|
70
|
+
|
|
71
|
+
REACT_SYNC_METHOD(getObjectThrows)
|
|
72
|
+
::React::JSValue getObjectThrows(::React::JSValue &&arg) noexcept;
|
|
73
|
+
|
|
74
|
+
REACT_METHOD(promiseThrows)
|
|
75
|
+
void promiseThrows(::React::ReactPromise<void> &&result) noexcept;
|
|
76
|
+
|
|
77
|
+
REACT_METHOD(voidFuncAssert)
|
|
78
|
+
void voidFuncAssert() noexcept;
|
|
79
|
+
|
|
80
|
+
REACT_SYNC_METHOD(getObjectAssert)
|
|
81
|
+
::React::JSValue getObjectAssert(::React::JSValue &&arg) noexcept;
|
|
82
|
+
|
|
83
|
+
REACT_METHOD(promiseAssert)
|
|
84
|
+
void promiseAssert(::React::ReactPromise<void> &&result) noexcept;
|
|
85
|
+
|
|
86
|
+
private:
|
|
87
|
+
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
} // namespace Microsoft::ReactNative
|
|
@@ -170,13 +170,6 @@ ReactContext::ReactContext(
|
|
|
170
170
|
m_properties{winrt::make<WeakRefPropertyBag>(properties)},
|
|
171
171
|
m_notifications{notifications} {}
|
|
172
172
|
|
|
173
|
-
void ReactContext::Destroy() noexcept {
|
|
174
|
-
if (auto notificationService =
|
|
175
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNotificationService>(m_notifications)) {
|
|
176
|
-
notificationService->UnsubscribeAll();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
173
|
winrt::Microsoft::ReactNative::IReactPropertyBag ReactContext::Properties() const noexcept {
|
|
181
174
|
return m_properties;
|
|
182
175
|
}
|
|
@@ -45,11 +45,6 @@ class ReactContext final : public Mso::UnknownObject<IReactContext> {
|
|
|
45
45
|
winrt::Microsoft::ReactNative::IReactPropertyBag const &properties,
|
|
46
46
|
winrt::Microsoft::ReactNative::IReactNotificationService const ¬ifications) noexcept;
|
|
47
47
|
|
|
48
|
-
// ReactContext may have longer lifespan than ReactInstance.
|
|
49
|
-
// The ReactInstance uses the Destroy method to enforce the ReactContext cleanup
|
|
50
|
-
// when the ReactInstance is destroyed.
|
|
51
|
-
void Destroy() noexcept;
|
|
52
|
-
|
|
53
48
|
public: // IReactContext
|
|
54
49
|
winrt::Microsoft::ReactNative::IReactPropertyBag Properties() const noexcept override;
|
|
55
50
|
winrt::Microsoft::ReactNative::IReactNotificationService Notifications() const noexcept override;
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
#include "Modules/ExceptionsManager.h"
|
|
40
40
|
#include "Modules/PlatformConstantsWinModule.h"
|
|
41
41
|
#include "Modules/ReactRootViewTagGenerator.h"
|
|
42
|
+
#include "Modules/SampleTurboModule.h"
|
|
42
43
|
#include "Modules/SourceCode.h"
|
|
43
44
|
#include "Modules/StatusBarManager.h"
|
|
44
45
|
#include "Modules/Timing.h"
|
|
@@ -399,6 +400,10 @@ void ReactInstanceWin::LoadModules(
|
|
|
399
400
|
}
|
|
400
401
|
#endif
|
|
401
402
|
|
|
403
|
+
registerTurboModule(
|
|
404
|
+
L"SampleTurboModule",
|
|
405
|
+
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::SampleTurboModule>());
|
|
406
|
+
|
|
402
407
|
if (devSettings->useTurboModulesOnly) {
|
|
403
408
|
::Microsoft::ReactNative::ExceptionsManager::SetRedBoxHander(
|
|
404
409
|
winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), m_redboxHandler);
|
|
@@ -413,7 +418,6 @@ void ReactInstanceWin::LoadModules(
|
|
|
413
418
|
registerTurboModule(
|
|
414
419
|
L"PlatformConstants",
|
|
415
420
|
winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::PlatformConstants>());
|
|
416
|
-
|
|
417
421
|
uint32_t hermesBytecodeVersion = 0;
|
|
418
422
|
#if defined(USE_HERMES) && defined(ENABLE_DEVSERVER_HBCBUNDLES)
|
|
419
423
|
hermesBytecodeVersion = ::hermes::hbc::BYTECODE_VERSION;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "ReactInstanceSettingsBuilder.h"
|
|
3
|
+
#include "ReactInstanceSettingsBuilder.g.cpp"
|
|
4
|
+
#include "ReactInstanceSettings.h"
|
|
5
|
+
|
|
6
|
+
namespace winrt::ReactNative {
|
|
7
|
+
using namespace winrt::Microsoft::ReactNative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
namespace winrt::UI {
|
|
11
|
+
using namespace winrt::Microsoft::UI;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
15
|
+
ReactInstanceSettingsBuilder::ReactInstanceSettingsBuilder() {
|
|
16
|
+
m_reactInstanceSettings = winrt::make<winrt::ReactNative::implementation::ReactInstanceSettings>();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
winrt::ReactNative::ReactInstanceSettings ReactInstanceSettingsBuilder::ReactInstanceSettings() {
|
|
20
|
+
return m_reactInstanceSettings;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::UseDirectDebugger(bool const &state) {
|
|
24
|
+
m_reactInstanceSettings.UseDirectDebugger(state);
|
|
25
|
+
|
|
26
|
+
return *this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::UseDeveloperSupport(bool const &state) {
|
|
30
|
+
m_reactInstanceSettings.UseDeveloperSupport(state);
|
|
31
|
+
|
|
32
|
+
return *this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::BundleRootPath(hstring const &path) {
|
|
36
|
+
m_reactInstanceSettings.BundleRootPath(std::wstring(L"file://").append(path.c_str()).append(L"\\Bundle\\").c_str());
|
|
37
|
+
|
|
38
|
+
return *this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::DebugBundlePath(hstring const &path) {
|
|
42
|
+
m_reactInstanceSettings.DebugBundlePath(path.c_str());
|
|
43
|
+
|
|
44
|
+
return *this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::JavaScriptBundleFile(
|
|
48
|
+
hstring const &file) {
|
|
49
|
+
m_reactInstanceSettings.JavaScriptBundleFile(file.c_str());
|
|
50
|
+
|
|
51
|
+
return *this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::UseFastRefresh(bool const &state) {
|
|
55
|
+
m_reactInstanceSettings.UseFastRefresh(state);
|
|
56
|
+
|
|
57
|
+
return *this;
|
|
58
|
+
}
|
|
59
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "ReactInstanceSettingsBuilder.g.h"
|
|
3
|
+
|
|
4
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
5
|
+
struct ReactInstanceSettingsBuilder : ReactInstanceSettingsBuilderT<ReactInstanceSettingsBuilder> {
|
|
6
|
+
ReactInstanceSettingsBuilder();
|
|
7
|
+
|
|
8
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettings ReactInstanceSettings();
|
|
9
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder UseDirectDebugger(bool const &state);
|
|
10
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder UseDeveloperSupport(bool const &state);
|
|
11
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder BundleRootPath(hstring const &path);
|
|
12
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder DebugBundlePath(hstring const &path);
|
|
13
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder JavaScriptBundleFile(hstring const &file);
|
|
14
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder UseFastRefresh(bool const &state);
|
|
15
|
+
|
|
16
|
+
private:
|
|
17
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettings m_reactInstanceSettings{nullptr};
|
|
18
|
+
};
|
|
19
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
20
|
+
namespace winrt::Microsoft::ReactNative::factory_implementation {
|
|
21
|
+
struct ReactInstanceSettingsBuilder
|
|
22
|
+
: ReactInstanceSettingsBuilderT<ReactInstanceSettingsBuilder, implementation::ReactInstanceSettingsBuilder> {};
|
|
23
|
+
} // namespace winrt::Microsoft::ReactNative::factory_implementation
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "ReactNativeAppBuilder.h"
|
|
3
|
+
#include "ReactNativeAppBuilder.g.cpp"
|
|
4
|
+
#include "IReactDispatcher.h"
|
|
5
|
+
#include "ReactNativeHost.h"
|
|
6
|
+
#include "ReactNativeWin32App.h"
|
|
7
|
+
#include "winrt/Microsoft.UI.Composition.h"
|
|
8
|
+
#include "winrt/Microsoft.UI.Dispatching.h"
|
|
9
|
+
#include "winrt/Microsoft.UI.Windowing.h"
|
|
10
|
+
#include "winrt/microsoft.UI.Interop.h"
|
|
11
|
+
|
|
12
|
+
// Scaling factor for the window's content based on the DPI of the display where the window is located.
|
|
13
|
+
float ScaleFactor(HWND hwnd) noexcept {
|
|
14
|
+
return GetDpiForWindow(hwnd) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
void UpdateRootViewSizeToAppWindow(
|
|
18
|
+
winrt::Microsoft::ReactNative::ReactNativeIsland const &rootView,
|
|
19
|
+
winrt::Microsoft::UI::Windowing::AppWindow const &window) {
|
|
20
|
+
auto hwnd = winrt::Microsoft::UI::GetWindowFromWindowId(window.Id());
|
|
21
|
+
auto scaleFactor = ScaleFactor(hwnd);
|
|
22
|
+
winrt::Windows::Foundation::Size size{
|
|
23
|
+
window.ClientSize().Width / scaleFactor, window.ClientSize().Height / scaleFactor};
|
|
24
|
+
// Do not relayout when minimized
|
|
25
|
+
if (window.Presenter().as<winrt::Microsoft::UI::Windowing::OverlappedPresenter>().State() !=
|
|
26
|
+
winrt::Microsoft::UI::Windowing::OverlappedPresenterState::Minimized) {
|
|
27
|
+
winrt::Microsoft::ReactNative::LayoutConstraints constraints;
|
|
28
|
+
constraints.LayoutDirection = winrt::Microsoft::ReactNative::LayoutDirection::Undefined;
|
|
29
|
+
constraints.MaximumSize = constraints.MinimumSize = size;
|
|
30
|
+
rootView.Arrange(constraints, {0, 0});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
namespace winrt::ReactNative {
|
|
35
|
+
using namespace winrt::Microsoft::ReactNative;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
namespace winrt::UI {
|
|
39
|
+
using namespace winrt::Microsoft::UI;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
43
|
+
ReactNativeAppBuilder::ReactNativeAppBuilder() {
|
|
44
|
+
m_reactNativeWin32App = winrt::make<implementation::ReactNativeWin32App>();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ReactNativeAppBuilder::~ReactNativeAppBuilder() {}
|
|
48
|
+
|
|
49
|
+
winrt::ReactNative::ReactNativeAppBuilder ReactNativeAppBuilder::AddPackageProviders(
|
|
50
|
+
winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::IReactPackageProvider> const
|
|
51
|
+
&packageProviders) {
|
|
52
|
+
for (auto const &provider : packageProviders) {
|
|
53
|
+
m_reactNativeWin32App.ReactNativeHost().PackageProviders().Append(provider);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return *this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
winrt::ReactNative::ReactNativeAppBuilder ReactNativeAppBuilder::SetReactInstanceSettings(
|
|
60
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettings const &settings) {
|
|
61
|
+
m_reactNativeWin32App.ReactNativeHost().InstanceSettings(settings);
|
|
62
|
+
|
|
63
|
+
return *this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
winrt::ReactNative::ReactNativeAppBuilder ReactNativeAppBuilder::SetCompositor(
|
|
67
|
+
winrt::Microsoft::UI::Composition::Compositor const &compositor) {
|
|
68
|
+
m_reactNativeWin32App.as<implementation::ReactNativeWin32App>().get()->Compositor(compositor);
|
|
69
|
+
return *this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
winrt::ReactNative::ReactNativeAppBuilder ReactNativeAppBuilder::SetAppWindow(
|
|
73
|
+
winrt::Microsoft::UI::Windowing::AppWindow const &appWindow) {
|
|
74
|
+
m_reactNativeWin32App.as<implementation::ReactNativeWin32App>().get()->AppWindow(appWindow);
|
|
75
|
+
|
|
76
|
+
return *this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
winrt::Microsoft::ReactNative::ReactNativeAppBuilder ReactNativeAppBuilder::SetReactViewOptions(
|
|
80
|
+
winrt::Microsoft::ReactNative::ReactViewOptions const &reactViewOptions) {
|
|
81
|
+
m_reactViewOptions = reactViewOptions;
|
|
82
|
+
|
|
83
|
+
return *this;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
winrt::ReactNative::ReactNativeWin32App ReactNativeAppBuilder::Build() {
|
|
87
|
+
if (m_reactNativeWin32App.Compositor() == nullptr) {
|
|
88
|
+
// Create a DispatcherQueue for this thread. This is needed for Composition, Content, and
|
|
89
|
+
// Input APIs.
|
|
90
|
+
auto dispatcherQueueController =
|
|
91
|
+
winrt::Microsoft::UI::Dispatching::DispatcherQueueController::CreateOnCurrentThread();
|
|
92
|
+
|
|
93
|
+
m_reactNativeWin32App.as<implementation::ReactNativeWin32App>().get()->DispatchQueueController(
|
|
94
|
+
dispatcherQueueController);
|
|
95
|
+
|
|
96
|
+
// Create the compositor on behalf of the App Developer
|
|
97
|
+
auto compositor = winrt::Microsoft::UI::Composition::Compositor();
|
|
98
|
+
m_reactNativeWin32App.as<implementation::ReactNativeWin32App>().get()->Compositor(compositor);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Create the AppWindow if the developer doesn't provide one
|
|
102
|
+
if (m_reactNativeWin32App.AppWindow() == nullptr) {
|
|
103
|
+
auto appWindow = winrt::Microsoft::UI::Windowing::AppWindow::Create();
|
|
104
|
+
appWindow.Title(L"SampleApplication");
|
|
105
|
+
appWindow.Resize({1000, 1000});
|
|
106
|
+
appWindow.Show();
|
|
107
|
+
|
|
108
|
+
m_reactNativeWin32App.as<implementation::ReactNativeWin32App>().get()->AppWindow(appWindow);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Currently set the property to use current thread dispatcher as a default UI dispatcher.
|
|
112
|
+
// TODO: Provision for setting dispatcher based on the thread dispatcherQueueController is created.
|
|
113
|
+
m_reactNativeWin32App.ReactNativeHost().InstanceSettings().Properties().Set(
|
|
114
|
+
ReactDispatcherHelper::UIDispatcherProperty(), ReactDispatcherHelper::UIThreadDispatcher());
|
|
115
|
+
|
|
116
|
+
auto hwnd{winrt::UI::GetWindowFromWindowId(m_reactNativeWin32App.AppWindow().Id())};
|
|
117
|
+
|
|
118
|
+
winrt::ReactNative::ReactCoreInjection::SetTopLevelWindowId(
|
|
119
|
+
m_reactNativeWin32App.ReactNativeHost().InstanceSettings().Properties(), reinterpret_cast<uint64_t>(hwnd));
|
|
120
|
+
|
|
121
|
+
winrt::ReactNative::Composition::CompositionUIService::SetCompositor(
|
|
122
|
+
m_reactNativeWin32App.ReactNativeHost().InstanceSettings(), m_reactNativeWin32App.Compositor());
|
|
123
|
+
|
|
124
|
+
// Start the react-native instance, which will create a JavaScript runtime and load the applications bundle.
|
|
125
|
+
m_reactNativeWin32App.ReactNativeHost().ReloadInstance();
|
|
126
|
+
|
|
127
|
+
// Create a RootView which will present a react-native component
|
|
128
|
+
auto reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland(m_reactNativeWin32App.Compositor());
|
|
129
|
+
reactNativeIsland.ReactViewHost(winrt::Microsoft::ReactNative::ReactCoreInjection::MakeViewHost(
|
|
130
|
+
m_reactNativeWin32App.ReactNativeHost(), m_reactViewOptions));
|
|
131
|
+
|
|
132
|
+
m_reactNativeWin32App.as<implementation::ReactNativeWin32App>().get()->ReactNativeIsland(
|
|
133
|
+
std::move(reactNativeIsland));
|
|
134
|
+
|
|
135
|
+
// Update the size of the RootView when the AppWindow changes size
|
|
136
|
+
m_reactNativeWin32App.AppWindow().Changed(
|
|
137
|
+
[wkRootView = winrt::make_weak(m_reactNativeWin32App.ReactNativeIsland())](
|
|
138
|
+
winrt::Microsoft::UI::Windowing::AppWindow const &window,
|
|
139
|
+
winrt::Microsoft::UI::Windowing::AppWindowChangedEventArgs const &args) {
|
|
140
|
+
if (args.DidSizeChange() || args.DidVisibilityChange()) {
|
|
141
|
+
if (auto rootView = wkRootView.get()) {
|
|
142
|
+
UpdateRootViewSizeToAppWindow(rootView, window);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Quit application when main window is closed
|
|
148
|
+
m_reactNativeWin32App.AppWindow().Destroying([this](
|
|
149
|
+
winrt::Microsoft::UI::Windowing::AppWindow const &window,
|
|
150
|
+
winrt::Windows::Foundation::IInspectable const & /*args*/) {
|
|
151
|
+
// Before we shutdown the application - unload the ReactNativeHost to give the javascript a chance to save any
|
|
152
|
+
// state
|
|
153
|
+
auto async = m_reactNativeWin32App.ReactNativeHost().UnloadInstance();
|
|
154
|
+
async.Completed([this](auto asyncInfo, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
|
|
155
|
+
assert(asyncStatus == winrt::Windows::Foundation::AsyncStatus::Completed);
|
|
156
|
+
m_reactNativeWin32App.ReactNativeHost().InstanceSettings().UIDispatcher().Post([]() { PostQuitMessage(0); });
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// DesktopChildSiteBridge create a ContentSite that can host the RootView ContentIsland
|
|
161
|
+
auto desktopChildSiteBridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
|
|
162
|
+
m_reactNativeWin32App.Compositor(), m_reactNativeWin32App.AppWindow().Id());
|
|
163
|
+
|
|
164
|
+
desktopChildSiteBridge.Connect(m_reactNativeWin32App.ReactNativeIsland().Island());
|
|
165
|
+
|
|
166
|
+
desktopChildSiteBridge.ResizePolicy(winrt::Microsoft::UI::Content::ContentSizePolicy::ResizeContentToParentWindow);
|
|
167
|
+
|
|
168
|
+
auto scaleFactor = ScaleFactor(hwnd);
|
|
169
|
+
m_reactNativeWin32App.ReactNativeIsland().ScaleFactor(scaleFactor);
|
|
170
|
+
|
|
171
|
+
UpdateRootViewSizeToAppWindow(reactNativeIsland, m_reactNativeWin32App.AppWindow());
|
|
172
|
+
|
|
173
|
+
m_reactNativeWin32App.as<implementation::ReactNativeWin32App>().get()->DesktopChildSiteBridge(
|
|
174
|
+
std::move(desktopChildSiteBridge));
|
|
175
|
+
|
|
176
|
+
return m_reactNativeWin32App;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "ReactNativeAppBuilder.g.h"
|
|
3
|
+
#include <winrt/Microsoft.UI.Content.h>
|
|
4
|
+
|
|
5
|
+
namespace winrt::Microsoft::ReactNative::implementation {
|
|
6
|
+
struct ReactNativeAppBuilder : ReactNativeAppBuilderT<ReactNativeAppBuilder> {
|
|
7
|
+
ReactNativeAppBuilder();
|
|
8
|
+
|
|
9
|
+
~ReactNativeAppBuilder();
|
|
10
|
+
|
|
11
|
+
winrt::Microsoft::ReactNative::ReactNativeAppBuilder AddPackageProviders(
|
|
12
|
+
winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::IReactPackageProvider> const
|
|
13
|
+
&packageProviders);
|
|
14
|
+
winrt::Microsoft::ReactNative::ReactNativeAppBuilder SetReactInstanceSettings(
|
|
15
|
+
winrt::Microsoft::ReactNative::ReactInstanceSettings const &settings);
|
|
16
|
+
|
|
17
|
+
// TODO: Currently, SetCompositor API is not exposed to the developer.
|
|
18
|
+
// Compositor depends on the DispatcherQueue created by DispatcherQueueController on a current thread
|
|
19
|
+
// or dedicated thread. So we also have to make a provision for setting DispatcherQueueController.
|
|
20
|
+
winrt::Microsoft::ReactNative::ReactNativeAppBuilder SetCompositor(
|
|
21
|
+
winrt::Microsoft::UI::Composition::Compositor const &compositor);
|
|
22
|
+
winrt::Microsoft::ReactNative::ReactNativeAppBuilder SetAppWindow(
|
|
23
|
+
winrt::Microsoft::UI::Windowing::AppWindow const &appWindow);
|
|
24
|
+
winrt::Microsoft::ReactNative::ReactNativeAppBuilder SetReactViewOptions(
|
|
25
|
+
winrt::Microsoft::ReactNative::ReactViewOptions const &reactViewOptions);
|
|
26
|
+
winrt::Microsoft::ReactNative::ReactNativeWin32App Build();
|
|
27
|
+
|
|
28
|
+
private:
|
|
29
|
+
winrt::Microsoft::ReactNative::ReactViewOptions m_reactViewOptions{};
|
|
30
|
+
winrt::Microsoft::ReactNative::ReactNativeWin32App m_reactNativeWin32App{nullptr};
|
|
31
|
+
};
|
|
32
|
+
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
33
|
+
namespace winrt::Microsoft::ReactNative::factory_implementation {
|
|
34
|
+
struct ReactNativeAppBuilder : ReactNativeAppBuilderT<ReactNativeAppBuilder, implementation::ReactNativeAppBuilder> {};
|
|
35
|
+
} // namespace winrt::Microsoft::ReactNative::factory_implementation
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
|
|
2
|
+
import "ReactNativeHost.idl";
|
|
3
|
+
import "ReactNativeIsland.idl";
|
|
4
|
+
import "ReactInstanceSettings.idl";
|
|
5
|
+
import "IReactPackageProvider.idl";
|
|
6
|
+
|
|
7
|
+
#include "DocString.h"
|
|
8
|
+
|
|
9
|
+
namespace Microsoft.ReactNative {
|
|
10
|
+
|
|
11
|
+
[experimental]
|
|
12
|
+
DOC_STRING("ReactNativeWin32App is used to manage resources appropriately to be able to host ReactNative component in a contentIsland.")
|
|
13
|
+
runtimeclass ReactNativeWin32App {
|
|
14
|
+
// Properties
|
|
15
|
+
Microsoft.UI.Windowing.AppWindow AppWindow {get;};
|
|
16
|
+
|
|
17
|
+
Microsoft.UI.Composition.Compositor Compositor {get;};
|
|
18
|
+
|
|
19
|
+
Microsoft.UI.Content.DesktopChildSiteBridge DesktopChildSiteBridge {get;};
|
|
20
|
+
|
|
21
|
+
ReactNativeHost ReactNativeHost {get;};
|
|
22
|
+
|
|
23
|
+
ReactNativeIsland ReactNativeIsland {get;};
|
|
24
|
+
|
|
25
|
+
// Methods
|
|
26
|
+
void Start();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[experimental]
|
|
30
|
+
DOC_STRING("This is the builder for creating ReactInstanceSettings.")
|
|
31
|
+
runtimeclass ReactInstanceSettingsBuilder
|
|
32
|
+
{
|
|
33
|
+
ReactInstanceSettingsBuilder();
|
|
34
|
+
|
|
35
|
+
// Properties
|
|
36
|
+
ReactInstanceSettings ReactInstanceSettings {get;};
|
|
37
|
+
|
|
38
|
+
// Methods
|
|
39
|
+
ReactInstanceSettingsBuilder UseDirectDebugger(Boolean state);
|
|
40
|
+
|
|
41
|
+
ReactInstanceSettingsBuilder UseDeveloperSupport(Boolean state);
|
|
42
|
+
|
|
43
|
+
ReactInstanceSettingsBuilder BundleRootPath(String path);
|
|
44
|
+
|
|
45
|
+
ReactInstanceSettingsBuilder DebugBundlePath(String path);
|
|
46
|
+
|
|
47
|
+
ReactInstanceSettingsBuilder JavaScriptBundleFile(String file);
|
|
48
|
+
|
|
49
|
+
ReactInstanceSettingsBuilder UseFastRefresh(Boolean state);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[experimental]
|
|
53
|
+
DOC_STRING("ReactNativeAppBuilder initializes all the required infrastructure for a Win32 Fabric Application.")
|
|
54
|
+
runtimeclass ReactNativeAppBuilder
|
|
55
|
+
{
|
|
56
|
+
ReactNativeAppBuilder();
|
|
57
|
+
|
|
58
|
+
// Methods
|
|
59
|
+
ReactNativeAppBuilder AddPackageProviders(Windows.Foundation.Collections.IVector<Microsoft.ReactNative.IReactPackageProvider> packageProviders);
|
|
60
|
+
|
|
61
|
+
ReactNativeAppBuilder SetReactInstanceSettings(ReactInstanceSettings settings);
|
|
62
|
+
|
|
63
|
+
ReactNativeAppBuilder SetAppWindow(Microsoft.UI.Windowing.AppWindow appWindow);
|
|
64
|
+
|
|
65
|
+
ReactNativeAppBuilder SetReactViewOptions(Microsoft.ReactNative.ReactViewOptions reactViewOptions);
|
|
66
|
+
|
|
67
|
+
ReactNativeWin32App Build();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -98,6 +98,8 @@ namespace Microsoft.ReactNative
|
|
|
98
98
|
DOC_STRING("ScaleFactor for this windows (DPI/96)")
|
|
99
99
|
Single ScaleFactor {get; set;};
|
|
100
100
|
|
|
101
|
+
Single FontSizeMultiplier { get; };
|
|
102
|
+
|
|
101
103
|
DOC_STRING("Move focus to this @ReactNativeIsland")
|
|
102
104
|
FocusNavigationResult NavigateFocus(FocusNavigationRequest request);
|
|
103
105
|
|