react-native-windows 0.77.0 → 0.78.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 +1 -1
- package/Chakra/ChakraTracing.cpp +1 -1
- package/Libraries/Animated/animations/Animation.js +22 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -0
- package/Libraries/Animated/animations/SpringAnimation.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
- package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
- package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
- package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
- package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
- package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/Animated/useAnimatedProps.js +0 -43
- package/Libraries/Components/Button.windows.js +3 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +9 -0
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
- package/Libraries/Components/View/View.windows.js +3 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
- package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +0 -9
- package/Libraries/Components/View/ViewPropTypes.windows.js +1 -9
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +1 -16
- package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
- package/Libraries/Image/AssetSourceResolver.js +11 -0
- package/Libraries/Image/AssetSourceResolver.windows.js +11 -0
- package/Libraries/Image/Image.windows.js +2 -0
- package/Libraries/Inspector/BorderBox.js +26 -14
- package/Libraries/Inspector/BoxInspector.js +60 -42
- package/Libraries/Inspector/ElementBox.js +55 -48
- package/Libraries/Inspector/StyleInspector.js +36 -30
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Modal/Modal.js +2 -0
- package/Libraries/Modal/Modal.windows.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +0 -2
- package/Libraries/Network/RCTNetworking.android.js +24 -16
- package/Libraries/Network/RCTNetworking.ios.js +1 -46
- package/Libraries/Network/RCTNetworking.windows.js +1 -46
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
- package/Libraries/ReactNative/UIManagerProperties.js +3 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
- package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
- package/Libraries/StyleSheet/processTransform.js +6 -0
- package/Libraries/Text/Text.d.ts +6 -1
- package/Libraries/Text/Text.windows.js +4 -0
- package/Libraries/Text/TextProps.js +2 -2
- package/Libraries/Text/TextProps.windows.js +3 -2
- package/Libraries/Utilities/BackHandler.android.js +5 -4
- package/Libraries/Utilities/BackHandler.ios.js +4 -5
- package/Libraries/Utilities/BackHandler.windows.js +5 -4
- package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +92 -17
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -33
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -10
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +11 -9
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +5 -10
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +138 -110
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +27 -27
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -33
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +0 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -16
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +9 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
- package/Microsoft.ReactNative/IReactContext.cpp +2 -2
- package/Microsoft.ReactNative/IReactContext.h +1 -1
- package/Microsoft.ReactNative/IReactContext.idl +2 -2
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +10 -10
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +24 -24
- package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
- package/Microsoft.ReactNative/ReactHost/React.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +39 -16
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +4 -2
- package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
- package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
- package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
- package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
- package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
- package/Microsoft.ReactNative/XamlUIService.h +4 -1
- package/Microsoft.ReactNative/XamlUIService.idl +2 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
- package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +3 -0
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +5 -4
- package/ReactCommon/ReactCommon.vcxproj +5 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
- package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
- package/Shared/HermesRuntimeHolder.cpp +2 -2
- package/Shared/Shared.vcxitems +8 -14
- package/Shared/Shared.vcxitems.filters +4 -16
- package/Shared/Threading/BatchingQueueThread.cpp +3 -3
- package/codegen/NativeCPUTimeSpec.g.h +41 -0
- package/codegen/NativeFantomSpec.g.h +78 -0
- package/codegen/NativePerformanceSpec.g.h +31 -43
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
- package/codegen/react/components/rnwcore/Switch.g.h +263 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
- package/codegen/rnwcoreJSI-generated.cpp +90 -57
- package/codegen/rnwcoreJSI.h +241 -104
- package/index.js +5 -0
- package/index.windows.js +5 -0
- package/just-task.js +1 -1
- package/package.json +25 -26
- package/src/private/animated/NativeAnimatedValidation.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +33 -27
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
- package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
- package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
- package/src/private/specs/modules/NativeFantom.js +37 -0
- package/src/private/utilities/ensureInstance.js +21 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/Performance.js +0 -12
- package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
- package/types/index.d.ts +1 -0
- package/Libraries/HeapCapture/HeapCapture.js +0 -29
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
- package/Libraries/Performance/SamplingProfiler.js +0 -39
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
- package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
- package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
3
|
<PropertyGroup Label="WebView2 versioning">
|
|
4
4
|
<!-- WinAppSDK 1.6+ has a dependency on Microsoft.Web.WebView2, there are a few places we need to pull in this package explicitly. -->
|
|
5
|
-
<WebView2PackageVersion>1.0.
|
|
5
|
+
<WebView2PackageVersion>1.0.2792.45</WebView2PackageVersion>
|
|
6
6
|
</PropertyGroup>
|
|
7
7
|
</Project>
|
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
<!--
|
|
6
6
|
Internal versions are located at: https://microsoft.visualstudio.com/DefaultCollection/ProjectReunion/_artifacts/feed/Project.Reunion.nuget.internal/NuGet/Microsoft.WindowsAppSDK/versions
|
|
7
|
-
For local testing of internal versions, modify
|
|
7
|
+
For local testing of internal versions, modify WinUI3ExperimentalVersion, and comment out the addition nuget source in NuGet.Config
|
|
8
8
|
-->
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
<WinUI3ExperimentalVersion Condition="'$(WinUI3ExperimentalVersion)'==''">1.7.250109001-experimental2</WinUI3ExperimentalVersion>
|
|
10
|
+
<!-- This value is also used by the CLI, see /packages/@react-native-windows/cli/.../autolinkWindows.ts -->
|
|
11
|
+
<WinUI3Version Condition="'$(WinUI3Version)'=='' AND '$(UseExperimentalWinUI3)'=='true'">$(WinUI3ExperimentalVersion)</WinUI3Version>
|
|
11
12
|
<WinUI3Version Condition="'$(WinUI3Version)'==''">1.6.240923002</WinUI3Version>
|
|
12
13
|
</PropertyGroup>
|
|
13
14
|
|
|
14
15
|
<PropertyGroup Label="WinUI2x versioning">
|
|
15
|
-
<!--This value is also used by the CLI, see /packages/@react-native-windows/
|
|
16
|
+
<!--This value is also used by the CLI, see /packages/@react-native-windows/cli/.../autolinkWindows.ts -->
|
|
16
17
|
<WinUI2xVersion Condition="'$(WinUI2xVersion)'==''">2.8.0</WinUI2xVersion>
|
|
17
18
|
</PropertyGroup>
|
|
18
19
|
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\NativeToJsBridge.h" />
|
|
115
115
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\ReactMarker.h" />
|
|
116
116
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\RecoverableError.h" />
|
|
117
|
-
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\
|
|
117
|
+
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\TraceSection.h" />
|
|
118
118
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSIExecutor.h" />
|
|
119
119
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSINativeModules.h" />
|
|
120
120
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorInterfaces.h" />
|
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSIExecutor.cpp" />
|
|
141
141
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSINativeModules.cpp" />
|
|
142
142
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorInterfaces.cpp" />
|
|
143
|
+
<ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorFlags.cpp" />
|
|
143
144
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\logger\react_native_log.cpp" />
|
|
144
145
|
<CLCompile Include="$(ReactNativeDir)\ReactCommon\reactperflogger\fusebox\FuseboxTracer.cpp" />
|
|
145
146
|
<CLCompile Include="$(ReactNativeDir)\ReactCommon\reactperflogger\reactperflogger\BridgeNativeModulePerfLogger.cpp" />
|
|
@@ -192,6 +193,9 @@
|
|
|
192
193
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\react\renderer\runtimescheduler\RuntimeScheduler_Modern.h" />
|
|
193
194
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\react\renderer\core\PropsParserContext.h" />
|
|
194
195
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\react\renderer\components\textinput\basePrimitives.h" />
|
|
196
|
+
<ClInclude Include="$(ReactNativeDir)\ReactCommon\react\renderer\components\textinput\TextInputState.h" />
|
|
197
|
+
<ClInclude Include="$(ReactNativeDir)\ReactCommon\react\renderer\components\textlayoutmanager\TextLayoutManager.h" />
|
|
198
|
+
<ClInclude Include="$(ReactNativeDir)\ReactCommon\react\renderer\imagemanager\platform\cxx\react\renderer\imagemanager\ImageRequestParams.h" />
|
|
195
199
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\react\bridging\LongLivedObject.cpp" />
|
|
196
200
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\core\ReactCommon\TurboCxxModule.cpp" />
|
|
197
201
|
<ClCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\core\ReactCommon\TurboModule.cpp" />
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\RecoverableError.h">
|
|
268
268
|
<Filter>cxxreact</Filter>
|
|
269
269
|
</ClInclude>
|
|
270
|
-
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\
|
|
270
|
+
<ClInclude Include="$(ReactNativeDir)\ReactCommon\cxxreact\TraceSection.h">
|
|
271
271
|
<Filter>cxxreact</Filter>
|
|
272
272
|
</ClInclude>
|
|
273
273
|
<ClInclude Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSIExecutor.h">
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
#include <folly/Conv.h>
|
|
13
13
|
#include <jsinspector-modern/ReactCdp.h>
|
|
14
|
-
#include <
|
|
14
|
+
#include <react/timing/primitives.h>
|
|
15
15
|
|
|
16
|
-
#include <
|
|
16
|
+
#include <chrono>
|
|
17
17
|
|
|
18
18
|
namespace facebook::react {
|
|
19
19
|
|
|
@@ -27,7 +27,7 @@ std::string JSExecutor::getSyntheticBundlePath(
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
double JSExecutor::performanceNow() {
|
|
30
|
-
return
|
|
30
|
+
return chronoToDOMHighResTimeStamp(std::chrono::steady_clock::now());
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
void JSExecutor::addConsoleMessage(jsi::Runtime& runtime, jsinspector_modern::ConsoleMessage message){
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
#include "ModuleRegistry.h"
|
|
22
22
|
#include "MoveWrapper.h"
|
|
23
23
|
#include "RAMBundleRegistry.h"
|
|
24
|
-
#include "
|
|
24
|
+
#include "TraceSection.h"
|
|
25
25
|
|
|
26
26
|
#include <memory>
|
|
27
27
|
|
|
@@ -194,7 +194,7 @@ void NativeToJsBridge::callFunction(
|
|
|
194
194
|
#ifdef WITH_FBSYSTRACE
|
|
195
195
|
FbSystraceAsyncFlow::end(
|
|
196
196
|
TRACE_TAG_REACT_CXX_BRIDGE, "JSCall", systraceCookie);
|
|
197
|
-
|
|
197
|
+
TraceSection s(
|
|
198
198
|
"NativeToJsBridge::callFunction", "module", module, "method", method);
|
|
199
199
|
#else
|
|
200
200
|
(void)(systraceCookie);
|
|
@@ -229,7 +229,7 @@ void NativeToJsBridge::invokeCallback(
|
|
|
229
229
|
#ifdef WITH_FBSYSTRACE
|
|
230
230
|
FbSystraceAsyncFlow::end(
|
|
231
231
|
TRACE_TAG_REACT_CXX_BRIDGE, "<callback>", systraceCookie);
|
|
232
|
-
|
|
232
|
+
TraceSection s("NativeToJsBridge::invokeCallback");
|
|
233
233
|
#else
|
|
234
234
|
(void)(systraceCookie);
|
|
235
235
|
#endif
|
|
@@ -1611,6 +1611,97 @@ TEST_P(JSITest, UTF16Test) {
|
|
|
1611
1611
|
}
|
|
1612
1612
|
Windows] */
|
|
1613
1613
|
|
|
1614
|
+
/*
|
|
1615
|
+
[Windows
|
|
1616
|
+
TEST_P(JSITest, GetStringDataTest) {
|
|
1617
|
+
// This Runtime Decorator is used to test the default getStringData
|
|
1618
|
+
// implementation for VMs that do not provide their own implementation
|
|
1619
|
+
class RD : public RuntimeDecorator<Runtime, Runtime> {
|
|
1620
|
+
public:
|
|
1621
|
+
RD(Runtime& rt) : RuntimeDecorator(rt) {}
|
|
1622
|
+
|
|
1623
|
+
void getStringData(
|
|
1624
|
+
const String& str,
|
|
1625
|
+
void* ctx,
|
|
1626
|
+
void (*cb)(void* ctx, bool ascii, const void* data, size_t num))
|
|
1627
|
+
override {
|
|
1628
|
+
Runtime::getStringData(str, ctx, cb);
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
RD rd = RD(rt);
|
|
1633
|
+
String str = String::createFromUtf8(rd, "hello👋");
|
|
1634
|
+
|
|
1635
|
+
std::u16string buf;
|
|
1636
|
+
auto cb = [&buf](bool ascii, const void* data, size_t num) {
|
|
1637
|
+
assert(!ascii && "Default implementation is always utf16");
|
|
1638
|
+
buf.append((const char16_t*)data, num);
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1641
|
+
str.getStringData(rd, cb);
|
|
1642
|
+
EXPECT_EQ(buf, str.utf16(rd));
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
TEST_P(JSITest, ObjectSetPrototype) {
|
|
1646
|
+
// This Runtime Decorator is used to test the default implementation of
|
|
1647
|
+
// Object.setPrototypeOf
|
|
1648
|
+
class RD : public RuntimeDecorator<Runtime, Runtime> {
|
|
1649
|
+
public:
|
|
1650
|
+
explicit RD(Runtime& rt) : RuntimeDecorator(rt) {}
|
|
1651
|
+
|
|
1652
|
+
void setPrototypeOf(const Object& object, const Value& prototype) override {
|
|
1653
|
+
return Runtime::setPrototypeOf(object, prototype);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
Value getPrototypeOf(const Object& object) override {
|
|
1657
|
+
return Runtime::getPrototypeOf(object);
|
|
1658
|
+
}
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1661
|
+
RD rd = RD(rt);
|
|
1662
|
+
Object child(rd);
|
|
1663
|
+
|
|
1664
|
+
// Tests null value as prototype
|
|
1665
|
+
child.setPrototype(rd, Value::null());
|
|
1666
|
+
EXPECT_TRUE(child.getPrototype(rd).isNull());
|
|
1667
|
+
|
|
1668
|
+
Object prototypeObj(rd);
|
|
1669
|
+
prototypeObj.setProperty(rd, "someProperty", 123);
|
|
1670
|
+
Value prototype(rd, prototypeObj);
|
|
1671
|
+
|
|
1672
|
+
child.setPrototype(rd, prototype);
|
|
1673
|
+
EXPECT_EQ(child.getProperty(rd, "someProperty").getNumber(), 123);
|
|
1674
|
+
|
|
1675
|
+
auto getPrototypeRes = child.getPrototype(rd).asObject(rd);
|
|
1676
|
+
EXPECT_EQ(getPrototypeRes.getProperty(rd, "someProperty").getNumber(), 123);
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
TEST_P(JSITest, ObjectCreateWithPrototype) {
|
|
1680
|
+
// This Runtime Decorator is used to test the default implementation of
|
|
1681
|
+
// Object.create(prototype)
|
|
1682
|
+
class RD : public RuntimeDecorator<Runtime, Runtime> {
|
|
1683
|
+
public:
|
|
1684
|
+
RD(Runtime& rt) : RuntimeDecorator(rt) {}
|
|
1685
|
+
|
|
1686
|
+
Object createObjectWithPrototype(const Value& prototype) override {
|
|
1687
|
+
return Runtime::createObjectWithPrototype(prototype);
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1691
|
+
RD rd = RD(rt);
|
|
1692
|
+
Object prototypeObj(rd);
|
|
1693
|
+
prototypeObj.setProperty(rd, "someProperty", 123);
|
|
1694
|
+
Value prototype(rd, prototypeObj);
|
|
1695
|
+
|
|
1696
|
+
Object child = Object::create(rd, prototype);
|
|
1697
|
+
EXPECT_EQ(child.getProperty(rd, "someProperty").getNumber(), 123);
|
|
1698
|
+
|
|
1699
|
+
// Tests null value as prototype
|
|
1700
|
+
child = Object::create(rd, Value::null());
|
|
1701
|
+
EXPECT_TRUE(child.getPrototype(rd).isNull());
|
|
1702
|
+
}
|
|
1703
|
+
Windows] */
|
|
1704
|
+
|
|
1614
1705
|
INSTANTIATE_TEST_CASE_P(
|
|
1615
1706
|
Runtimes,
|
|
1616
1707
|
JSITest,
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
#include "componentNameByReactViewName.h"
|
|
11
11
|
|
|
12
|
-
#include <react/config/ReactNativeConfig.h>
|
|
13
12
|
#include <react/debug/react_native_assert.h>
|
|
14
13
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
15
14
|
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.h>
|
|
@@ -85,17 +84,7 @@ const ComponentDescriptor& ComponentDescriptorRegistry::at(
|
|
|
85
84
|
|
|
86
85
|
if (it == _registryByName.end()) {
|
|
87
86
|
// [Windows ##14204
|
|
88
|
-
|
|
89
|
-
contextContainer_->at<std::shared_ptr<const ReactNativeConfig>>(
|
|
90
|
-
"ReactNativeConfig");
|
|
91
|
-
if (reactNativeConfig_->getBool(
|
|
92
|
-
"react_fabric:enabled_automatic_interop_android")) {
|
|
93
|
-
auto componentDescriptor = std::make_shared<
|
|
94
|
-
const UnstableLegacyViewManagerAutomaticComponentDescriptor>(
|
|
95
|
-
parameters_, unifiedComponentName);
|
|
96
|
-
registerComponentDescriptor(componentDescriptor);
|
|
97
|
-
return *_registryByName.find(unifiedComponentName)->second;
|
|
98
|
-
} else if (_fallbackComponentDescriptor == nullptr) {
|
|
87
|
+
if (_fallbackComponentDescriptor == nullptr) {
|
|
99
88
|
throw std::invalid_argument(
|
|
100
89
|
("Unable to find componentDescriptor for " + unifiedComponentName)
|
|
101
90
|
.c_str());
|
|
@@ -1,35 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
3
7
|
|
|
4
8
|
#pragma once
|
|
5
9
|
|
|
6
|
-
#include <
|
|
7
|
-
#include <react/renderer/attributedstring/AttributedString.h>
|
|
10
|
+
#include <react/renderer/attributedstring/AttributedStringBox.h>
|
|
8
11
|
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
|
9
|
-
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
10
|
-
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
11
12
|
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
|
12
13
|
|
|
14
|
+
#ifdef ANDROID
|
|
15
|
+
#include <folly/dynamic.h>
|
|
16
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
17
|
+
#endif
|
|
18
|
+
|
|
13
19
|
namespace facebook::react {
|
|
14
20
|
|
|
15
21
|
/*
|
|
16
|
-
* State for <
|
|
22
|
+
* State for <TextInput> component.
|
|
17
23
|
*/
|
|
18
|
-
class
|
|
24
|
+
class TextInputState final {
|
|
19
25
|
public:
|
|
20
|
-
|
|
26
|
+
TextInputState() = default;
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
TextInputState(
|
|
29
|
+
AttributedStringBox attributedStringBox,
|
|
30
|
+
AttributedString reactTreeAttributedString,
|
|
31
|
+
ParagraphAttributes paragraphAttributes,
|
|
32
|
+
int64_t mostRecentEventCount);
|
|
33
|
+
|
|
34
|
+
#ifdef ANDROID
|
|
35
|
+
TextInputState(
|
|
36
|
+
const TextInputState& previousState,
|
|
37
|
+
const folly::dynamic& data);
|
|
38
|
+
folly::dynamic getDynamic() const;
|
|
39
|
+
MapBuffer getMapBuffer() const;
|
|
40
|
+
#endif
|
|
27
41
|
|
|
28
42
|
/*
|
|
29
|
-
* All content of <TextInput> component
|
|
30
|
-
* Only set if changed from the React tree's perspective.
|
|
43
|
+
* All content of <TextInput> component.
|
|
31
44
|
*/
|
|
32
|
-
|
|
45
|
+
AttributedStringBox attributedStringBox;
|
|
33
46
|
|
|
34
47
|
/*
|
|
35
48
|
* All content of <TextInput> component represented as an `AttributedString`.
|
|
@@ -44,28 +57,17 @@ class WindowsTextInputState final {
|
|
|
44
57
|
* Represents all visual attributes of a paragraph of text represented as
|
|
45
58
|
* a ParagraphAttributes.
|
|
46
59
|
*/
|
|
47
|
-
ParagraphAttributes paragraphAttributes
|
|
60
|
+
ParagraphAttributes paragraphAttributes;
|
|
61
|
+
|
|
62
|
+
int64_t mostRecentEventCount{0};
|
|
63
|
+
|
|
48
64
|
|
|
49
65
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
66
|
+
* Stores an opaque cache ID used on the Java side to refer to a specific
|
|
67
|
+
* AttributedString for measurement purposes only.
|
|
52
68
|
*/
|
|
53
|
-
|
|
54
|
-
double defaultThemePaddingEnd{NAN};
|
|
55
|
-
double defaultThemePaddingTop{NAN};
|
|
56
|
-
double defaultThemePaddingBottom{NAN};
|
|
57
|
-
|
|
58
|
-
WindowsTextInputState(
|
|
59
|
-
int64_t mostRecentEventCount,
|
|
60
|
-
AttributedString attributedString,
|
|
61
|
-
AttributedString reactTreeAttributedString,
|
|
62
|
-
ParagraphAttributes paragraphAttributes,
|
|
63
|
-
double defaultThemePaddingStart,
|
|
64
|
-
double defaultThemePaddingEnd,
|
|
65
|
-
double defaultThemePaddingTop,
|
|
66
|
-
double defaultThemePaddingBottom);
|
|
69
|
+
int64_t cachedAttributedStringId{0};
|
|
67
70
|
|
|
68
|
-
WindowsTextInputState() = default;
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
} // namespace facebook::react
|
|
@@ -70,6 +70,7 @@ struct AccessibilityState {
|
|
|
70
70
|
std::optional<bool> selected{std::nullopt}; // [Windows] - Do not remove; required for Windows ISelectionItemProvider Implementation
|
|
71
71
|
bool busy{false};
|
|
72
72
|
std::optional<bool> expanded{std::nullopt};
|
|
73
|
+
std::optional<bool> readOnly{std::nullopt}; // [Windows] - Do not remove; required for Windows IRangeValueProvider and IValueProvider Implementation
|
|
73
74
|
std::optional<bool> multiselectable{std::nullopt}; // [Windows] - Do not remove; required for Windows ISelectionProvider Implementation
|
|
74
75
|
std::optional<bool> required{std::nullopt}; // [Windows] - Do not remove; required for Windows ISelectionProvider Implementation
|
|
75
76
|
enum { Unchecked, Checked, Mixed, None } checked{None};
|
|
@@ -171,6 +171,10 @@ inline void fromRawValue(
|
|
|
171
171
|
fromRawValue(context, expanded->second, result.expanded);
|
|
172
172
|
}
|
|
173
173
|
// [Windows] - DO NOT REMOVE - required for Windows ISelectionProvider Implementation
|
|
174
|
+
auto readOnly = map.find("readOnly");
|
|
175
|
+
if (readOnly != map.end()) {
|
|
176
|
+
fromRawValue(context, readOnly->second, result.readOnly);
|
|
177
|
+
}
|
|
174
178
|
auto multiselectable = map.find("multiselectable");
|
|
175
179
|
if (multiselectable != map.end()) {
|
|
176
180
|
fromRawValue(context, multiselectable->second, result.multiselectable);
|
package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <react/renderer/graphics/Float.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
class ImageRequestParams {
|
|
15
|
+
public:
|
|
16
|
+
ImageRequestParams() = default;
|
|
17
|
+
explicit ImageRequestParams(Float blurRadius) : blurRadius(blurRadius) {}
|
|
18
|
+
|
|
19
|
+
Float blurRadius{};
|
|
20
|
+
|
|
21
|
+
bool operator==(const ImageRequestParams& rhs) const {
|
|
22
|
+
return this->blurRadius == rhs.blurRadius;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
bool operator!=(const ImageRequestParams& rhs) const {
|
|
26
|
+
return !(*this == rhs);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
} // namespace facebook::react
|
|
@@ -31,10 +31,9 @@ static inline SchedulerPriority fromRawValue(double value) {
|
|
|
31
31
|
return SchedulerPriority::LowPriority;
|
|
32
32
|
case 5:
|
|
33
33
|
return SchedulerPriority::IdlePriority;
|
|
34
|
-
default:
|
|
35
|
-
react_native_assert(false && "Unsupported SchedulerPriority value");
|
|
36
|
-
return SchedulerPriority::NormalPriority;
|
|
37
34
|
}
|
|
35
|
+
react_native_assert(false && "Unsupported SchedulerPriority value");
|
|
36
|
+
return SchedulerPriority::NormalPriority;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
static inline std::chrono::milliseconds timeoutForSchedulerPriority(
|
|
@@ -54,6 +53,8 @@ static inline std::chrono::milliseconds timeoutForSchedulerPriority(
|
|
|
54
53
|
react_native_assert(false && "Unsupported SchedulerPriority value");
|
|
55
54
|
return std::chrono::seconds(5);
|
|
56
55
|
}
|
|
56
|
+
react_native_assert(false && "Unsupported SchedulerPriority value");
|
|
57
|
+
return std::chrono::seconds(5);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
} // namespace facebook::react
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <folly/dynamic.h>
|
|
11
|
+
#include <jsi/JSIDynamic.h>
|
|
12
|
+
#include <jsi/jsi.h>
|
|
13
|
+
#include <react/debug/react_native_assert.h>
|
|
14
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
15
|
+
|
|
16
|
+
namespace facebook::react {
|
|
17
|
+
|
|
18
|
+
using BackgroundExecutor =
|
|
19
|
+
std::function<void(std::function<void()>&& callback)>;
|
|
20
|
+
|
|
21
|
+
struct ShadowNodeListWrapper : public jsi::NativeState {
|
|
22
|
+
ShadowNodeListWrapper(ShadowNode::UnsharedListOfShared shadowNodeList)
|
|
23
|
+
: shadowNodeList(std::move(shadowNodeList)) {}
|
|
24
|
+
|
|
25
|
+
// The below method needs to be implemented out-of-line in order for the class
|
|
26
|
+
// to have at least one "key function" (see
|
|
27
|
+
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable)
|
|
28
|
+
~ShadowNodeListWrapper() override;
|
|
29
|
+
|
|
30
|
+
ShadowNode::UnsharedListOfShared shadowNodeList;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
inline static ShadowNode::Shared shadowNodeFromValue(
|
|
34
|
+
jsi::Runtime& runtime,
|
|
35
|
+
const jsi::Value& value) {
|
|
36
|
+
if (value.isNull()) {
|
|
37
|
+
return nullptr;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return value.getObject(runtime)
|
|
41
|
+
.getNativeState<ShadowNodeWrapper>(runtime)
|
|
42
|
+
->shadowNode;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
inline static jsi::Value valueFromShadowNode(
|
|
46
|
+
jsi::Runtime& runtime,
|
|
47
|
+
ShadowNode::Shared shadowNode,
|
|
48
|
+
bool assignRuntimeShadowNodeReference = false) {
|
|
49
|
+
// Wrap the shadow node so that we can update JS references from native
|
|
50
|
+
auto wrappedShadowNode =
|
|
51
|
+
std::make_shared<ShadowNodeWrapper>(std::move(shadowNode));
|
|
52
|
+
|
|
53
|
+
if (assignRuntimeShadowNodeReference) {
|
|
54
|
+
wrappedShadowNode->shadowNode->setRuntimeShadowNodeReference(
|
|
55
|
+
wrappedShadowNode);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
jsi::Object obj(runtime);
|
|
59
|
+
obj.setNativeState(runtime, std::move(wrappedShadowNode));
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// TODO: once we no longer need to mutate the return value (appendChildToSet)
|
|
64
|
+
// make this a SharedListOfShared
|
|
65
|
+
inline static ShadowNode::UnsharedListOfShared shadowNodeListFromValue(
|
|
66
|
+
jsi::Runtime& runtime,
|
|
67
|
+
const jsi::Value& value) {
|
|
68
|
+
// TODO: cleanup when passChildrenWhenCloningPersistedNodes is rolled out
|
|
69
|
+
jsi::Object object = value.asObject(runtime);
|
|
70
|
+
if (object.isArray(runtime)) {
|
|
71
|
+
auto jsArray = std::move(object).asArray(runtime);
|
|
72
|
+
size_t jsArrayLen = jsArray.length(runtime);
|
|
73
|
+
if (jsArrayLen > 0) {
|
|
74
|
+
auto shadowNodeArray = std::make_shared<ShadowNode::ListOfShared>();
|
|
75
|
+
shadowNodeArray->reserve(jsArrayLen);
|
|
76
|
+
|
|
77
|
+
for (size_t i = 0; i < jsArrayLen; i++) {
|
|
78
|
+
shadowNodeArray->push_back(
|
|
79
|
+
shadowNodeFromValue(runtime, jsArray.getValueAtIndex(runtime, i)));
|
|
80
|
+
}
|
|
81
|
+
return shadowNodeArray;
|
|
82
|
+
} else {
|
|
83
|
+
// TODO: return ShadowNode::emptySharedShadowNodeSharedList()
|
|
84
|
+
return std::make_shared<ShadowNode::ListOfShared>(
|
|
85
|
+
ShadowNode::ListOfShared({}));
|
|
86
|
+
;
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
return object.getNativeState<ShadowNodeListWrapper>(runtime)
|
|
90
|
+
->shadowNodeList;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
inline static jsi::Value valueFromShadowNodeList(
|
|
95
|
+
jsi::Runtime& runtime,
|
|
96
|
+
ShadowNode::UnsharedListOfShared shadowNodeList) {
|
|
97
|
+
auto wrapper =
|
|
98
|
+
std::make_shared<ShadowNodeListWrapper>(std::move(shadowNodeList));
|
|
99
|
+
// Use the wrapper for NativeState too, otherwise we can't implement
|
|
100
|
+
// the marker interface. Could be simplified to a simple struct wrapper.
|
|
101
|
+
jsi::Object obj(runtime);
|
|
102
|
+
obj.setNativeState(runtime, std::move(wrapper));
|
|
103
|
+
return obj;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
inline static ShadowNode::UnsharedListOfShared shadowNodeListFromWeakList(
|
|
107
|
+
const ShadowNode::UnsharedListOfWeak& weakShadowNodeList) {
|
|
108
|
+
auto result = std::make_shared<ShadowNode::ListOfShared>();
|
|
109
|
+
for (const auto& weakShadowNode : *weakShadowNodeList) {
|
|
110
|
+
auto sharedShadowNode = weakShadowNode.lock();
|
|
111
|
+
if (!sharedShadowNode) {
|
|
112
|
+
return nullptr;
|
|
113
|
+
}
|
|
114
|
+
result->push_back(sharedShadowNode);
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
inline static ShadowNode::UnsharedListOfWeak weakShadowNodeListFromValue(
|
|
120
|
+
jsi::Runtime& runtime,
|
|
121
|
+
const jsi::Value& value) {
|
|
122
|
+
auto shadowNodeList = shadowNodeListFromValue(runtime, value);
|
|
123
|
+
auto weakShadowNodeList = std::make_shared<ShadowNode::ListOfWeak>();
|
|
124
|
+
for (const auto& shadowNode : *shadowNodeList) {
|
|
125
|
+
weakShadowNodeList->push_back(shadowNode);
|
|
126
|
+
}
|
|
127
|
+
return weakShadowNodeList;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
inline static Tag tagFromValue(const jsi::Value& value) {
|
|
131
|
+
return (Tag)value.getNumber();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
inline static InstanceHandle::Shared instanceHandleFromValue(
|
|
135
|
+
jsi::Runtime& runtime,
|
|
136
|
+
const jsi::Value& instanceHandleValue,
|
|
137
|
+
const jsi::Value& tagValue) {
|
|
138
|
+
react_native_assert(!instanceHandleValue.isNull());
|
|
139
|
+
if (instanceHandleValue.isNull()) {
|
|
140
|
+
return nullptr;
|
|
141
|
+
}
|
|
142
|
+
return std::make_shared<InstanceHandle>(
|
|
143
|
+
runtime, instanceHandleValue, tagFromValue(tagValue));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
inline static SurfaceId surfaceIdFromValue(
|
|
147
|
+
jsi::Runtime& runtime,
|
|
148
|
+
const jsi::Value& value) {
|
|
149
|
+
return (SurfaceId)value.getNumber();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
inline static int displayModeToInt(const DisplayMode value) {
|
|
153
|
+
// the result of this method should be in sync with
|
|
154
|
+
// Libraries/ReactNative/DisplayMode.js
|
|
155
|
+
switch (value) {
|
|
156
|
+
case DisplayMode::Visible:
|
|
157
|
+
return 1;
|
|
158
|
+
case DisplayMode::Suspended:
|
|
159
|
+
return 2;
|
|
160
|
+
case DisplayMode::Hidden:
|
|
161
|
+
return 3;
|
|
162
|
+
default:
|
|
163
|
+
return -1;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
inline static std::string stringFromValue(
|
|
168
|
+
jsi::Runtime& runtime,
|
|
169
|
+
const jsi::Value& value) {
|
|
170
|
+
return value.getString(runtime).utf8(runtime);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
inline static folly::dynamic commandArgsFromValue(
|
|
174
|
+
jsi::Runtime& runtime,
|
|
175
|
+
const jsi::Value& value) {
|
|
176
|
+
return jsi::dynamicFromValue(runtime, value);
|
|
177
|
+
}
|
|
178
|
+
} // namespace facebook::react
|
|
179
|
+
|