react-native-windows 0.76.3 → 0.77.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +5 -1
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/NativeAnimatedAllowlist.js +20 -9
- package/Libraries/Animated/animations/Animation.js +60 -25
- package/Libraries/Animated/animations/DecayAnimation.js +26 -38
- package/Libraries/Animated/animations/SpringAnimation.js +33 -39
- package/Libraries/Animated/animations/TimingAnimation.js +34 -42
- package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
- package/Libraries/Animated/createAnimatedComponent.js +60 -33
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
- package/Libraries/Animated/nodes/AnimatedNode.js +39 -45
- package/Libraries/Animated/nodes/AnimatedObject.js +13 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +104 -46
- package/Libraries/Animated/nodes/AnimatedStyle.js +116 -39
- package/Libraries/Animated/nodes/AnimatedTransform.js +56 -23
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -3
- package/Libraries/Animated/useAnimatedProps.js +41 -35
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +77 -5
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +82 -5
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +4 -4
- package/Libraries/Components/Button.js +9 -4
- package/Libraries/Components/Button.windows.js +19 -5
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/Glyph/Glyph.js +2 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -0
- package/Libraries/Components/Popup/PopupNativeComponent.js +0 -1
- package/Libraries/Components/Pressable/Pressable.js +4 -4
- package/Libraries/Components/Pressable/Pressable.windows.js +10 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +13 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +3 -2
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +4 -4
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
- package/Libraries/Components/ScrollView/ScrollView.js +49 -88
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.windows.js +0 -5
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +8 -9
- package/Libraries/Components/Switch/Switch.js +8 -6
- package/Libraries/Components/Switch/Switch.windows.js +8 -6
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +4 -4
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +6 -4
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +27 -4
- package/Libraries/Components/TextInput/TextInput.flow.js +36 -19
- package/Libraries/Components/TextInput/TextInput.js +37 -13
- package/Libraries/Components/TextInput/TextInput.windows.js +47 -16
- package/Libraries/Components/TextInput/TextInputState.js +11 -13
- package/Libraries/Components/TextInput/TextInputState.windows.js +11 -13
- package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
- package/Libraries/Components/Touchable/Position.js +7 -2
- package/Libraries/Components/Touchable/Touchable.js +4 -0
- package/Libraries/Components/Touchable/Touchable.windows.js +4 -0
- package/Libraries/Components/Touchable/TouchableBounce.js +6 -2
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +227 -0
- package/Libraries/Components/Touchable/TouchableHighlight.js +5 -5
- package/Libraries/Components/Touchable/TouchableHighlight.windows.js +5 -5
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +371 -0
- package/Libraries/Components/Touchable/TouchableOpacity.js +6 -5
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +11 -5
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +9 -3
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -1
- package/Libraries/Components/View/View.js +4 -4
- package/Libraries/Components/View/View.windows.js +12 -5
- package/Libraries/Components/View/ViewAccessibility.d.ts +10 -0
- package/Libraries/Components/View/ViewAccessibility.windows.js +2 -0
- package/Libraries/Components/View/ViewNativeComponent.js +6 -98
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/Libraries/Components/View/ViewPropTypes.js +0 -3
- package/Libraries/Components/View/ViewPropTypes.windows.js +2 -3
- package/Libraries/Core/ExceptionsManager.js +50 -29
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -1
- package/Libraries/Core/setUpBatchedBridge.js +1 -10
- package/Libraries/Core/setUpDeveloperTools.js +1 -5
- package/Libraries/Core/setUpErrorHandling.js +20 -18
- package/Libraries/Core/setUpReactDevTools.js +107 -8
- package/Libraries/Core/setUpSegmentFetcher.js +1 -0
- package/Libraries/Core/setUpTimers.js +21 -18
- package/Libraries/Debugging/DebuggingOverlay.js +4 -5
- package/Libraries/Image/AssetSourceResolver.js +12 -1
- package/Libraries/Image/AssetSourceResolver.windows.js +12 -1
- package/Libraries/Image/Image.android.js +1 -5
- package/Libraries/Image/Image.d.ts +20 -29
- package/Libraries/Image/Image.ios.js +0 -2
- package/Libraries/Image/Image.windows.js +5 -1
- package/Libraries/Image/ImageBackground.js +2 -5
- package/Libraries/Image/ImageProps.js +7 -6
- package/Libraries/Image/ImageResizeMode.d.ts +8 -1
- package/Libraries/Image/ImageResizeMode.js +4 -1
- package/Libraries/Image/ImageSource.d.ts +0 -2
- package/Libraries/Image/ImageSource.js +0 -2
- package/Libraries/Image/ImageTypes.flow.js +11 -9
- package/Libraries/Image/ImageUtils.js +6 -3
- package/Libraries/Image/ImageViewNativeComponent.js +5 -3
- package/Libraries/Inspector/Inspector.js +1 -0
- package/Libraries/Inspector/NetworkOverlay.js +4 -0
- package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -14
- package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +3 -5
- package/Libraries/Interaction/InteractionManager.js +6 -1
- package/Libraries/Interaction/InteractionManagerStub.js +176 -0
- package/Libraries/Interaction/TouchHistoryMath.js +22 -19
- package/Libraries/JSInspector/NetworkAgent.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +1 -2
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +7 -7
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +2 -2
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +3 -3
- package/Libraries/LogBox/LogBox.js +18 -5
- package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
- package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.windows.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.windows.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +1 -1
- package/Libraries/LogBox/UI/LogBoxMessage.js +2 -2
- package/Libraries/Modal/Modal.d.ts +12 -0
- package/Libraries/Modal/Modal.js +31 -4
- package/Libraries/Modal/Modal.windows.js +18 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +72 -1
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -1
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -11
- package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -3
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -1
- package/Libraries/Network/FormData.js +11 -3
- package/Libraries/Network/XHRInterceptor.js +63 -14
- package/Libraries/Network/XMLHttpRequest.js +26 -1
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -4
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/Pressability.js +2 -3
- package/Libraries/Pressability/Pressability.windows.js +2 -3
- package/Libraries/Pressability/usePressability.js +4 -1
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/AppRegistry.js +1 -11
- package/Libraries/ReactNative/DisplayMode.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -3
- package/Libraries/ReactNative/RendererImplementation.js +18 -17
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -3
- package/Libraries/ReactNative/renderApplication.js +9 -8
- package/Libraries/ReactNative/requireNativeComponent.js +5 -2
- package/Libraries/Renderer/shims/ReactFabric.js +3 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +3 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +22 -35
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +5 -6
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/StyleSheet/StyleSheet.js +7 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +13 -2
- package/Libraries/StyleSheet/StyleSheetTypes.js +24 -6
- package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
- package/Libraries/StyleSheet/processTransform.js +3 -34
- package/Libraries/Text/Text.js +248 -249
- package/Libraries/Text/Text.windows.js +298 -292
- package/Libraries/Text/TextNativeComponent.js +0 -1
- package/Libraries/Text/TextProps.windows.js +2 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
- package/Libraries/Types/CoreEventTypes.d.ts +3 -10
- package/Libraries/Types/CoreEventTypes.js +4 -6
- package/Libraries/Types/CoreEventTypes.windows.js +4 -6
- package/Libraries/Utilities/Appearance.js +3 -1
- package/Libraries/Utilities/BackHandler.android.js +6 -18
- package/Libraries/Utilities/BackHandler.d.ts +0 -4
- package/Libraries/Utilities/BackHandler.ios.js +0 -7
- package/Libraries/Utilities/BackHandler.windows.js +6 -18
- package/Libraries/Utilities/HMRClient.js +3 -4
- package/Libraries/Utilities/Platform.flow.js +2 -2
- package/Libraries/Utilities/Platform.flow.windows.js +3 -2
- package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +26 -7
- package/Libraries/WebSocket/WebSocketEvent.js +4 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -5
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +9 -8
- package/Microsoft.ReactNative/AsynchronousEventBeat.h +5 -5
- package/Microsoft.ReactNative/FBReactNativeSpec/FBReactNativeSpecJSI.h +5 -0
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +197 -18
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +19 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +13 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +6 -8
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +3 -2
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +24 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +5 -0
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +12 -12
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +4 -4
- package/Microsoft.ReactNative/Fabric/ImageRequest.cpp +4 -8
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +16 -15
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +15 -0
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +9 -0
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +20 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +11 -6
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/SynchronousEventBeat.cpp +14 -4
- package/Microsoft.ReactNative/SynchronousEventBeat.h +4 -2
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +78 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.h +51 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +48 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.cpp +41 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.h +127 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.inc +125 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +16 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_win.cpp +23 -0
- package/Microsoft.ReactNative.Cxx/JSI/decorator.h +834 -0
- package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +117 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +366 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +560 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi.h +1611 -0
- package/Microsoft.ReactNative.Cxx/JSI/threadsafe.h +79 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +7 -11
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +1 -1
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +2878 -0
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +36 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/CallInvoker.h +64 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/SchedulerPriority.h +22 -0
- package/{ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core → Microsoft.ReactNative.Cxx}/ReactCommon/TurboModule.cpp +63 -63
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +165 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModuleUtils.cpp +105 -0
- package/{ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core → Microsoft.ReactNative.Cxx}/ReactCommon/TurboModuleUtils.h +57 -58
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/AString.h +42 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Array.h +151 -0
- package/{ReactCommon/TEMP_UntilReactCommonUpdate → Microsoft.ReactNative.Cxx/ReactCommon}/react/bridging/Base.h +177 -154
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bool.h +25 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bridging.h +21 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/CallbackWrapper.h +67 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Class.h +90 -0
- package/{ReactCommon/TEMP_UntilReactCommonUpdate → Microsoft.ReactNative.Cxx/ReactCommon}/react/bridging/Convert.h +170 -172
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Error.h +51 -0
- package/{ReactCommon/TEMP_UntilReactCommonUpdate → Microsoft.ReactNative.Cxx/ReactCommon}/react/bridging/EventEmitter.h +134 -136
- package/{ReactCommon/TEMP_UntilReactCommonUpdate → Microsoft.ReactNative.Cxx/ReactCommon}/react/bridging/Function.h +283 -283
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/LongLivedObject.cpp +63 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/LongLivedObject.h +61 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Object.h +93 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Promise.h +104 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Value.h +107 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/debug/flags.h +22 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/debug/react_native_assert.h +72 -0
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +553 -0
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +167 -0
- package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +186 -0
- package/Microsoft.ReactNative.Cxx/stubs/glog/logging.h +82 -0
- package/PropertySheets/Bundle.Common.targets +1 -1
- package/PropertySheets/Bundle.props +3 -0
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/ManagedCodeGen/Microsoft.ReactNative.Managed.CodeGen.targets +1 -1
- package/PropertySheets/OutputMSBuildProperties.targets +3 -1
- package/PropertySheets/React.Cpp.props +6 -0
- package/ReactCommon/ReactCommon.vcxproj +5 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +2 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +61 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +26 -23
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +150 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +252 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +795 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +59 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +227 -74
- package/Scripts/Microsoft.ReactNative.Managed.CodeGen.targets +1 -1
- package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +97 -62
- package/Shared/InspectorPackagerConnection.cpp +3 -6
- package/Shared/InspectorPackagerConnection.h +2 -2
- package/Shared/InstanceManager.h +1 -1
- package/Shared/OInstance.h +1 -1
- package/Shared/Shared.vcxitems +17 -2
- package/Shared/Shared.vcxitems.filters +3 -1
- package/Shared/TurboModuleManager.cpp +29 -4
- package/codegen/NativeAccessibilityInfoSpec.g.h +27 -9
- package/codegen/NativeAccessibilityManagerSpec.g.h +19 -13
- package/codegen/NativeActionSheetManagerSpec.g.h +4 -0
- package/codegen/NativeExceptionsManagerSpec.g.h +1 -7
- package/codegen/NativeIntersectionObserverSpec.g.h +2 -0
- package/codegen/NativePerformanceSpec.g.h +127 -3
- package/codegen/NativeReactDevToolsRuntimeSettingsModuleSpec.g.h +67 -0
- package/codegen/NativeReactDevToolsSettingsManagerSpec.g.h +41 -0
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +125 -137
- package/codegen/react/components/rnwcore/ComponentDescriptors.h +0 -1
- package/codegen/react/components/rnwcore/Props.cpp +1 -0
- package/codegen/react/components/rnwcore/Props.h +1 -0
- package/codegen/react/components/rnwcore/ShadowNodes.cpp +0 -1
- package/codegen/react/components/rnwcore/ShadowNodes.h +0 -11
- package/codegen/react/components/rnwcore/States.h +0 -12
- package/codegen/rnwcoreJSI-generated.cpp +219 -186
- package/codegen/rnwcoreJSI.h +942 -511
- package/index.js +10 -3
- package/index.windows.js +10 -3
- package/jest/setup.js +36 -1
- package/just-task.js +15 -0
- package/package.json +22 -22
- package/src/private/animated/NativeAnimatedHelper.js +18 -16
- package/src/private/animated/useAnimatedPropsMemo.js +356 -0
- package/src/private/components/HScrollViewNativeComponents.js +1 -27
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +11 -8
- package/src/private/components/VScrollViewNativeComponents.js +2 -25
- package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.windows.js +20 -0
- package/src/private/{fusebox → debugging}/setUpFuseboxReactDevToolsDispatcher.js +6 -0
- package/src/private/devmenu/DevMenu.d.ts +20 -0
- package/src/private/devmenu/DevMenu.js +31 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +95 -86
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +8 -2
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -19
- package/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js +34 -0
- package/src/private/setup/setUpDOM.js +14 -6
- package/src/private/setup/setUpMutationObserver.js +5 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +9 -0
- package/src/private/specs/modules/NativeAccessibilityManager.js +4 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
- package/src/private/specs/modules/NativeAppearance.js +4 -10
- package/src/private/specs/modules/NativeExceptionsManager.js +0 -12
- package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
- package/src/private/webapis/dom/geometry/DOMRect.js +2 -2
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +2 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -3
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +102 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
- package/src/private/webapis/performance/EventTiming.js +13 -8
- package/src/private/webapis/performance/Performance.js +66 -73
- package/src/private/webapis/performance/PerformanceEntry.js +2 -5
- package/src/private/webapis/performance/PerformanceObserver.js +65 -164
- package/src/private/webapis/performance/RawPerformanceEntry.js +1 -1
- package/src/private/webapis/performance/UserTiming.js +11 -7
- package/src/private/webapis/performance/Utilities.js +18 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +71 -2
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +267 -0
- package/templates/cpp-lib/template.config.js +13 -7
- package/templates/templateUtils.js +10 -0
- package/types/index.d.ts +1 -1
- package/types/public/ReactNativeTypes.d.ts +4 -8
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.windows.js +0 -35
- package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
- package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/CallbackWrapper.h +0 -101
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/scrollview/ScrollViewProps.cpp +0 -569
- package/codegen/NativeDevToolsSettingsManagerSpec.g.h +0 -53
- package/codegen/NativePerformanceObserverSpec.g.h +0 -131
- package/src/private/components/useSyncOnScroll.js +0 -48
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +0 -61
- package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +0 -67
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +0 -127
- package/types/experimental.d.ts +0 -59
- /package/src/private/{fusebox → debugging}/FuseboxSessionObserver.js +0 -0
|
@@ -56,8 +56,8 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
|
|
|
56
56
|
|
|
57
57
|
private:
|
|
58
58
|
void installFabricUIManager() noexcept;
|
|
59
|
-
void initiateTransaction(facebook::react::MountingCoordinator
|
|
60
|
-
void performTransaction(facebook::react::MountingCoordinator
|
|
59
|
+
void initiateTransaction(std::shared_ptr<const facebook::react::MountingCoordinator> mountingCoordinator);
|
|
60
|
+
void performTransaction(std::shared_ptr<const facebook::react::MountingCoordinator> const &mountingCoordinator);
|
|
61
61
|
void RCTPerformMountInstructions(
|
|
62
62
|
facebook::react::ShadowViewMutationList const &mutations,
|
|
63
63
|
// facebook::react::RCTComponentViewRegistry* registry,
|
|
@@ -82,9 +82,9 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
|
|
|
82
82
|
|
|
83
83
|
// Inherited via SchedulerDelegate
|
|
84
84
|
virtual void schedulerDidFinishTransaction(
|
|
85
|
-
const facebook::react::MountingCoordinator
|
|
85
|
+
const std::shared_ptr<const facebook::react::MountingCoordinator> &mountingCoordinator) override;
|
|
86
86
|
virtual void schedulerShouldRenderTransactions(
|
|
87
|
-
const facebook::react::MountingCoordinator
|
|
87
|
+
const std::shared_ptr<const facebook::react::MountingCoordinator> &mountingCoordinator) override;
|
|
88
88
|
virtual void schedulerDidRequestPreliminaryViewAllocation(const facebook::react::ShadowNode &shadowView) override;
|
|
89
89
|
virtual void schedulerDidDispatchCommand(
|
|
90
90
|
facebook::react::ShadowView const &shadowView,
|
|
@@ -10,15 +10,11 @@ namespace facebook::react {
|
|
|
10
10
|
ImageRequest::ImageRequest(
|
|
11
11
|
ImageSource imageSource,
|
|
12
12
|
std::shared_ptr<const ImageTelemetry> telemetry,
|
|
13
|
+
SharedFunction<> resumeFunction,
|
|
13
14
|
SharedFunction<> cancelationFunction)
|
|
14
|
-
: imageSource_(std::move(imageSource)),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
coordinator_ = std::make_shared<ImageResponseObserverCoordinator>();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
void ImageRequest::cancel() const {
|
|
21
|
-
cancelRequest_();
|
|
15
|
+
: imageSource_(std::move(imageSource)), telemetry_(std::move(telemetry)) {
|
|
16
|
+
coordinator_ =
|
|
17
|
+
std::make_shared<ImageResponseObserverCoordinator>(std::move(resumeFunction), std::move(cancelationFunction));
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
const ImageSource &ImageRequest::getImageSource() const {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
#include "HostPlatformViewProps.h"
|
|
5
5
|
|
|
6
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
6
7
|
#include <react/renderer/components/view/conversions.h>
|
|
7
8
|
#include <react/renderer/core/graphicsConversions.h>
|
|
8
9
|
#include <react/renderer/core/propsConversions.h>
|
|
9
|
-
#include <react/utils/CoreFeatures.h>
|
|
10
10
|
|
|
11
11
|
namespace facebook::react {
|
|
12
12
|
|
|
@@ -17,36 +17,37 @@ HostPlatformViewProps::HostPlatformViewProps(
|
|
|
17
17
|
bool shouldSetRawProps)
|
|
18
18
|
: BaseViewProps(context, sourceProps, rawProps),
|
|
19
19
|
windowsEvents(
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
21
|
+
? sourceProps.windowsEvents
|
|
22
|
+
: convertRawProp(context, rawProps, sourceProps.windowsEvents, {})),
|
|
22
23
|
enableFocusRing(
|
|
23
|
-
|
|
24
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
24
25
|
? sourceProps.enableFocusRing
|
|
25
26
|
: convertRawProp(context, rawProps, "enableFocusRing", sourceProps.enableFocusRing, true)),
|
|
26
27
|
focusable(
|
|
27
|
-
|
|
28
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
28
29
|
? sourceProps.focusable
|
|
29
30
|
: convertRawProp(context, rawProps, "focusable", sourceProps.focusable, {})),
|
|
30
31
|
tooltip(
|
|
31
|
-
|
|
32
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
32
33
|
? sourceProps.tooltip
|
|
33
34
|
: convertRawProp(context, rawProps, "tooltip", sourceProps.tooltip, {})),
|
|
34
35
|
accessibilityPosInSet(
|
|
35
|
-
|
|
36
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
36
37
|
? sourceProps.accessibilityPosInSet
|
|
37
38
|
: convertRawProp(context, rawProps, "accessibilityPosInSet", sourceProps.accessibilityPosInSet, 0)),
|
|
38
39
|
accessibilitySetSize(
|
|
39
|
-
|
|
40
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
|
40
41
|
? sourceProps.accessibilitySetSize
|
|
41
42
|
: convertRawProp(context, rawProps, "accessibilitySetSize", sourceProps.accessibilitySetSize, 0)),
|
|
42
43
|
accessibilityLiveRegion(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter() ? sourceProps.accessibilityLiveRegion
|
|
45
|
+
: convertRawProp(
|
|
46
|
+
context,
|
|
47
|
+
rawProps,
|
|
48
|
+
"accessibilityLiveRegion",
|
|
49
|
+
sourceProps.accessibilityLiveRegion,
|
|
50
|
+
"none")) {}
|
|
50
51
|
|
|
51
52
|
#define WINDOWS_VIEW_EVENT_CASE(eventType) \
|
|
52
53
|
case CONSTEXPR_RAW_PROPS_KEY_HASH("on" #eventType): { \
|
|
@@ -30,6 +30,16 @@ void AccessibilityInfo::isReduceMotionEnabled(std::function<void(bool)> const &o
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
void AccessibilityInfo::isInvertColorsEnabled(std::function<void(bool)> const &onSuccess) noexcept {
|
|
34
|
+
// TODO: implement ##14206
|
|
35
|
+
onSuccess(false);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void AccessibilityInfo::isHighTextContrastEnabled(std::function<void(bool)> const &onSuccess) noexcept {
|
|
39
|
+
// TODO: implement #14099
|
|
40
|
+
onSuccess(false);
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
void AccessibilityInfo::isTouchExplorationEnabled(std::function<void(bool)> const &onSuccess) noexcept {
|
|
34
44
|
onSuccess(UiaClientsAreListening());
|
|
35
45
|
}
|
|
@@ -76,6 +86,11 @@ void AccessibilityInfo::getRecommendedTimeoutMillis(
|
|
|
76
86
|
onSuccess(mSec);
|
|
77
87
|
}
|
|
78
88
|
|
|
89
|
+
void AccessibilityInfo::isGrayscaleEnabled(std::function<void(bool)> const &onSuccess) noexcept {
|
|
90
|
+
// TODO: implement #14207
|
|
91
|
+
onSuccess(false);
|
|
92
|
+
}
|
|
93
|
+
|
|
79
94
|
void AccessibilityInfo::isAccessibilityServiceEnabled(std::function<void(bool)> const &onSuccess) noexcept {
|
|
80
95
|
onSuccess(false);
|
|
81
96
|
}
|
|
@@ -17,6 +17,12 @@ struct AccessibilityInfo : public std::enable_shared_from_this<AccessibilityInfo
|
|
|
17
17
|
REACT_METHOD(isReduceMotionEnabled)
|
|
18
18
|
void isReduceMotionEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
19
19
|
|
|
20
|
+
REACT_METHOD(isInvertColorsEnabled)
|
|
21
|
+
void isInvertColorsEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
22
|
+
|
|
23
|
+
REACT_METHOD(isHighTextContrastEnabled)
|
|
24
|
+
void isHighTextContrastEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
25
|
+
|
|
20
26
|
REACT_METHOD(isTouchExplorationEnabled)
|
|
21
27
|
void isTouchExplorationEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
22
28
|
|
|
@@ -29,6 +35,9 @@ struct AccessibilityInfo : public std::enable_shared_from_this<AccessibilityInfo
|
|
|
29
35
|
REACT_METHOD(getRecommendedTimeoutMillis)
|
|
30
36
|
void getRecommendedTimeoutMillis(double mSec, std::function<void(double)> const &onSuccess) noexcept;
|
|
31
37
|
|
|
38
|
+
REACT_METHOD(isGrayscaleEnabled)
|
|
39
|
+
void isGrayscaleEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
40
|
+
|
|
32
41
|
REACT_METHOD(isAccessibilityServiceEnabled)
|
|
33
42
|
void isAccessibilityServiceEnabled(std::function<void(bool)> const &onSuccess) noexcept;
|
|
34
43
|
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
#include <ReactPropertyBag.h>
|
|
7
7
|
#include <winrt/Windows.Foundation.h>
|
|
8
8
|
|
|
9
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
10
|
+
#include <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
|
|
11
|
+
|
|
9
12
|
namespace Mso::React {
|
|
10
13
|
|
|
11
14
|
//=============================================================================================
|
|
@@ -277,6 +280,18 @@ bool ReactOptions::EnableDefaultCrashHandler() const noexcept {
|
|
|
277
280
|
return winrt::unbox_value_or<bool>(properties.Get(EnableDefaultCrashHandlerProperty()), false);
|
|
278
281
|
}
|
|
279
282
|
|
|
283
|
+
class ReactNativeWindowsFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
|
|
284
|
+
public:
|
|
285
|
+
bool disableEventLoopOnBridgeless() override {
|
|
286
|
+
return true; // Disable event loop until we are on a JSI version that supports microtasks
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
bool enableCppPropsIteratorSetter() override {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
std::once_flag g_FlagInitFeatureFlags;
|
|
280
295
|
//=============================================================================================
|
|
281
296
|
// ReactHost implementation
|
|
282
297
|
//=============================================================================================
|
|
@@ -284,7 +299,11 @@ bool ReactOptions::EnableDefaultCrashHandler() const noexcept {
|
|
|
284
299
|
ReactHost::ReactHost(Mso::DispatchQueue const &queue) noexcept
|
|
285
300
|
: Super{EnsureSerialQueue(queue)},
|
|
286
301
|
m_options{Queue(), m_mutex},
|
|
287
|
-
m_notifyWhenClosed{ReactHostRegistry::Register(*this), Queue(), m_mutex} {
|
|
302
|
+
m_notifyWhenClosed{ReactHostRegistry::Register(*this), Queue(), m_mutex} {
|
|
303
|
+
std::call_once(g_FlagInitFeatureFlags, []() noexcept {
|
|
304
|
+
facebook::react::ReactNativeFeatureFlags::override(std::make_unique<ReactNativeWindowsFeatureFlags>());
|
|
305
|
+
});
|
|
306
|
+
}
|
|
288
307
|
|
|
289
308
|
ReactHost::~ReactHost() noexcept {}
|
|
290
309
|
|
|
@@ -641,8 +641,10 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
|
|
|
641
641
|
auto timerManager = std::make_shared<facebook::react::TimerManager>(std::move(timerRegistry));
|
|
642
642
|
timerRegistryRaw->setTimerManager(timerManager);
|
|
643
643
|
|
|
644
|
-
auto jsErrorHandlingFunc = [this](
|
|
645
|
-
|
|
644
|
+
auto jsErrorHandlingFunc = [this](
|
|
645
|
+
facebook::jsi::Runtime &runtime,
|
|
646
|
+
const facebook::react::JsErrorHandler::ParsedError &error) noexcept {
|
|
647
|
+
OnJSError(runtime, std::move(error));
|
|
646
648
|
};
|
|
647
649
|
|
|
648
650
|
if (devSettings->useDirectDebugger) {
|
|
@@ -1263,16 +1265,19 @@ void ReactInstanceWin::OnError(const Mso::ErrorCode &errorCode) noexcept {
|
|
|
1263
1265
|
}
|
|
1264
1266
|
|
|
1265
1267
|
#ifdef USE_FABRIC
|
|
1266
|
-
void ReactInstanceWin::OnJSError(
|
|
1268
|
+
void ReactInstanceWin::OnJSError(
|
|
1269
|
+
facebook::jsi::Runtime &runtime,
|
|
1270
|
+
const facebook::react::JsErrorHandler::ParsedError &error) noexcept {
|
|
1267
1271
|
ErrorInfo errorInfo;
|
|
1268
1272
|
errorInfo.Message = error.message;
|
|
1269
1273
|
auto errorCode = Mso::React::ReactErrorProvider().MakeErrorCode(Mso::React::ReactError{errorInfo.Message.c_str()});
|
|
1270
1274
|
|
|
1271
|
-
for (const facebook::react::JsErrorHandler::ParsedError::StackFrame &frame : error.
|
|
1272
|
-
errorInfo.Callstack.push_back(
|
|
1275
|
+
for (const facebook::react::JsErrorHandler::ParsedError::StackFrame &frame : error.stack) {
|
|
1276
|
+
errorInfo.Callstack.push_back(
|
|
1277
|
+
{frame.file.value(), frame.methodName, frame.lineNumber.value(), frame.column.value()});
|
|
1273
1278
|
}
|
|
1274
1279
|
|
|
1275
|
-
errorInfo.Id = error.
|
|
1280
|
+
errorInfo.Id = error.id;
|
|
1276
1281
|
|
|
1277
1282
|
bool isFatal = error.isFatal;
|
|
1278
1283
|
|
|
@@ -141,7 +141,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
|
|
|
141
141
|
void OnError(const Mso::ErrorCode &errorcode) noexcept;
|
|
142
142
|
void OnErrorWithMessage(const std::string &errorMessage) noexcept;
|
|
143
143
|
#ifdef USE_FABRIC
|
|
144
|
-
void OnJSError(const facebook::react::JsErrorHandler::ParsedError &error) noexcept;
|
|
144
|
+
void OnJSError(facebook::jsi::Runtime &runtime, const facebook::react::JsErrorHandler::ParsedError &error) noexcept;
|
|
145
145
|
#endif
|
|
146
146
|
void OnLiveReload() noexcept;
|
|
147
147
|
void OnWaitingForDebugger() noexcept;
|
|
@@ -6,17 +6,27 @@
|
|
|
6
6
|
namespace Microsoft::ReactNative {
|
|
7
7
|
|
|
8
8
|
SynchronousEventBeat::SynchronousEventBeat(
|
|
9
|
-
facebook::react::EventBeat::
|
|
9
|
+
std::shared_ptr<facebook::react::EventBeat::OwnerBox> const ownerBox,
|
|
10
10
|
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
11
11
|
facebook::react::RuntimeExecutor runtimeExecutor,
|
|
12
12
|
std::shared_ptr<facebook::react::RuntimeScheduler> runtimeScheduler)
|
|
13
|
-
: EventBeat(ownerBox),
|
|
13
|
+
: EventBeat(ownerBox, *runtimeScheduler),
|
|
14
14
|
m_context(context),
|
|
15
15
|
m_runtimeExecutor(runtimeExecutor),
|
|
16
16
|
m_runtimeScheduler(std::move(runtimeScheduler)) {}
|
|
17
17
|
|
|
18
|
+
void SynchronousEventBeat::beat(facebook::jsi::Runtime &runtime) const {
|
|
19
|
+
if (!this->isEventBeatRequested_) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
isEventBeatRequested_ = false;
|
|
23
|
+
if (beatCallback_) {
|
|
24
|
+
beatCallback_(runtime);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
void SynchronousEventBeat::induce() const {
|
|
19
|
-
if (!
|
|
29
|
+
if (!isEventBeatRequested_) {
|
|
20
30
|
return;
|
|
21
31
|
}
|
|
22
32
|
|
|
@@ -26,7 +36,7 @@ void SynchronousEventBeat::induce() const {
|
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
void SynchronousEventBeat::lockExecutorAndBeat() const {
|
|
29
|
-
if (!this->
|
|
39
|
+
if (!this->isEventBeatRequested_) {
|
|
30
40
|
return;
|
|
31
41
|
}
|
|
32
42
|
|
|
@@ -11,12 +11,14 @@ namespace Microsoft::ReactNative {
|
|
|
11
11
|
class SynchronousEventBeat final : public facebook::react::EventBeat {
|
|
12
12
|
public:
|
|
13
13
|
SynchronousEventBeat(
|
|
14
|
-
facebook::react::EventBeat::
|
|
14
|
+
std::shared_ptr<facebook::react::EventBeat::OwnerBox> const ownerBox,
|
|
15
15
|
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
16
16
|
facebook::react::RuntimeExecutor runtimeExecutor,
|
|
17
17
|
std::shared_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
|
18
18
|
|
|
19
|
-
void
|
|
19
|
+
void beat(facebook::jsi::Runtime &runtime) const;
|
|
20
|
+
|
|
21
|
+
void induce() const;
|
|
20
22
|
|
|
21
23
|
void lockExecutorAndBeat() const;
|
|
22
24
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "JSRuntimeApi.h"
|
|
5
|
+
|
|
6
|
+
EXTERN_C_START
|
|
7
|
+
|
|
8
|
+
// Default JSR function implementations if they are not found in the engine DLL.
|
|
9
|
+
extern napi_status NAPI_CDECL default_jsr_open_napi_env_scope(napi_env env, jsr_napi_env_scope *scope);
|
|
10
|
+
extern napi_status NAPI_CDECL default_jsr_close_napi_env_scope(napi_env env, jsr_napi_env_scope scope);
|
|
11
|
+
extern napi_status NAPI_CDECL default_jsr_get_description(napi_env env, const char **result);
|
|
12
|
+
extern napi_status NAPI_CDECL default_jsr_drain_microtasks(napi_env env, int32_t max_count_hint, bool *result);
|
|
13
|
+
extern napi_status NAPI_CDECL default_jsr_is_inspectable(napi_env env, bool *result);
|
|
14
|
+
|
|
15
|
+
extern napi_status NAPI_CDECL default_jsr_create_prepared_script(
|
|
16
|
+
napi_env env,
|
|
17
|
+
const uint8_t *script_utf8,
|
|
18
|
+
size_t script_length,
|
|
19
|
+
jsr_data_delete_cb script_delete_cb,
|
|
20
|
+
void *deleter_data,
|
|
21
|
+
const char *source_url,
|
|
22
|
+
jsr_prepared_script *result);
|
|
23
|
+
extern napi_status NAPI_CDECL default_jsr_delete_prepared_script(napi_env env, jsr_prepared_script prepared_script);
|
|
24
|
+
extern napi_status NAPI_CDECL
|
|
25
|
+
default_jsr_prepared_script_run(napi_env env, jsr_prepared_script prepared_script, napi_value *result);
|
|
26
|
+
|
|
27
|
+
EXTERN_C_END
|
|
28
|
+
|
|
29
|
+
namespace Microsoft::NodeApiJsi {
|
|
30
|
+
|
|
31
|
+
namespace {
|
|
32
|
+
|
|
33
|
+
struct JSRuntimeApiNames {
|
|
34
|
+
#define JSR_FUNC(func) static constexpr const char func[] = #func;
|
|
35
|
+
#define JSR_JSI_FUNC JSR_FUNC
|
|
36
|
+
#define JSR_PREPARED_SCRIPT JSR_FUNC
|
|
37
|
+
#include "JSRuntimeApi.inc"
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Prepared script functions either should be all loaded or we use all default functions.
|
|
41
|
+
void loadPreparedScriptFuncs() {
|
|
42
|
+
JSRuntimeApi *current = JSRuntimeApi::current();
|
|
43
|
+
bool useDefault = false;
|
|
44
|
+
#define JSR_PREPARED_SCRIPT(func) \
|
|
45
|
+
decltype(::func) *loaded_##func = \
|
|
46
|
+
reinterpret_cast<decltype(::func) *>(current->getFuncPtr(JSRuntimeApiNames::func)); \
|
|
47
|
+
useDefault = useDefault || loaded_##func == nullptr;
|
|
48
|
+
#include "JSRuntimeApi.inc"
|
|
49
|
+
#define JSR_PREPARED_SCRIPT(func) \
|
|
50
|
+
size_t offset_##func = offsetof(JSRuntimeApi, func); \
|
|
51
|
+
*reinterpret_cast<decltype(::func) **>(reinterpret_cast<char *>(current) + offset_##func) = \
|
|
52
|
+
useDefault ? &default_##func : loaded_##func;
|
|
53
|
+
#include "JSRuntimeApi.inc"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
} // namespace
|
|
57
|
+
|
|
58
|
+
thread_local JSRuntimeApi *JSRuntimeApi::current_{};
|
|
59
|
+
|
|
60
|
+
JSRuntimeApi::JSRuntimeApi(IFuncResolver *funcResolver)
|
|
61
|
+
: NodeApi(funcResolver)
|
|
62
|
+
#define JSR_FUNC(func) \
|
|
63
|
+
, \
|
|
64
|
+
func(&ApiFuncResolver<JSRuntimeApi, decltype(::func) *, JSRuntimeApiNames::func, offsetof(JSRuntimeApi, func)>:: \
|
|
65
|
+
stub)
|
|
66
|
+
#define JSR_JSI_FUNC(func) \
|
|
67
|
+
, \
|
|
68
|
+
func(&ApiFuncResolver<JSRuntimeApi, decltype(::func) *, JSRuntimeApiNames::func, offsetof(JSRuntimeApi, func)>:: \
|
|
69
|
+
optionalStub<&default_##func>)
|
|
70
|
+
#define JSR_PREPARED_SCRIPT(func) \
|
|
71
|
+
, \
|
|
72
|
+
func(&ApiFuncResolver<JSRuntimeApi, decltype(::func) *, JSRuntimeApiNames::func, offsetof(JSRuntimeApi, func)>:: \
|
|
73
|
+
preloadStub<&loadPreparedScriptFuncs>)
|
|
74
|
+
#include "JSRuntimeApi.inc"
|
|
75
|
+
{
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
} // namespace Microsoft::NodeApiJsi
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#ifndef APILOADERS_JSRUNTIMEAPI_H_
|
|
5
|
+
#define APILOADERS_JSRUNTIMEAPI_H_
|
|
6
|
+
|
|
7
|
+
#include <js_runtime_api.h>
|
|
8
|
+
#include "NodeApi.h"
|
|
9
|
+
|
|
10
|
+
namespace Microsoft::NodeApiJsi {
|
|
11
|
+
|
|
12
|
+
class JSRuntimeApi : public NodeApi {
|
|
13
|
+
public:
|
|
14
|
+
JSRuntimeApi(IFuncResolver *funcResolver);
|
|
15
|
+
|
|
16
|
+
static JSRuntimeApi *current() {
|
|
17
|
+
return current_;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static void setCurrent(JSRuntimeApi *current) {
|
|
21
|
+
NodeApi::setCurrent(current);
|
|
22
|
+
current_ = current;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class Scope : public NodeApi::Scope {
|
|
26
|
+
public:
|
|
27
|
+
Scope(JSRuntimeApi *api) : NodeApi::Scope(api), prevJSRuntimeApi_(JSRuntimeApi::current_) {
|
|
28
|
+
JSRuntimeApi::current_ = api;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
~Scope() {
|
|
32
|
+
JSRuntimeApi::current_ = prevJSRuntimeApi_;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private:
|
|
36
|
+
JSRuntimeApi *prevJSRuntimeApi_;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
#define JSR_FUNC(func) decltype(::func) *const func;
|
|
41
|
+
#define JSR_JSI_FUNC JSR_FUNC
|
|
42
|
+
#define JSR_PREPARED_SCRIPT JSR_FUNC
|
|
43
|
+
#include "JSRuntimeApi.inc"
|
|
44
|
+
|
|
45
|
+
private:
|
|
46
|
+
static thread_local JSRuntimeApi *current_;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace Microsoft::NodeApiJsi
|
|
50
|
+
|
|
51
|
+
#endif // !APILOADERS_JSRUNTIMEAPI_H_
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#ifndef JSR_FUNC
|
|
5
|
+
#define JSR_FUNC(func)
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#ifndef JSR_JSI_FUNC
|
|
9
|
+
#define JSR_JSI_FUNC(func)
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#ifndef JSR_PREPARED_SCRIPT
|
|
13
|
+
#define JSR_PREPARED_SCRIPT(func)
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// The JS runtime functions sorted alphabetically.
|
|
17
|
+
JSR_FUNC(jsr_collect_garbage)
|
|
18
|
+
JSR_FUNC(jsr_config_enable_gc_api)
|
|
19
|
+
JSR_FUNC(jsr_config_enable_inspector)
|
|
20
|
+
JSR_FUNC(jsr_config_set_inspector_break_on_start)
|
|
21
|
+
JSR_FUNC(jsr_config_set_inspector_port)
|
|
22
|
+
JSR_FUNC(jsr_config_set_inspector_runtime_name)
|
|
23
|
+
JSR_FUNC(jsr_config_set_script_cache)
|
|
24
|
+
JSR_FUNC(jsr_config_set_task_runner)
|
|
25
|
+
JSR_FUNC(jsr_create_config)
|
|
26
|
+
JSR_FUNC(jsr_create_runtime)
|
|
27
|
+
JSR_FUNC(jsr_delete_config)
|
|
28
|
+
JSR_FUNC(jsr_delete_runtime)
|
|
29
|
+
JSR_FUNC(jsr_get_and_clear_last_unhandled_promise_rejection)
|
|
30
|
+
JSR_FUNC(jsr_has_unhandled_promise_rejection)
|
|
31
|
+
JSR_FUNC(jsr_run_script)
|
|
32
|
+
JSR_FUNC(jsr_runtime_get_node_api_env)
|
|
33
|
+
|
|
34
|
+
// The JS runtime functions needed for JSI.
|
|
35
|
+
JSR_JSI_FUNC(jsr_close_napi_env_scope)
|
|
36
|
+
JSR_JSI_FUNC(jsr_drain_microtasks)
|
|
37
|
+
JSR_JSI_FUNC(jsr_get_description)
|
|
38
|
+
JSR_JSI_FUNC(jsr_is_inspectable)
|
|
39
|
+
JSR_JSI_FUNC(jsr_open_napi_env_scope)
|
|
40
|
+
|
|
41
|
+
// The JS runtime functions needed for prepared script.
|
|
42
|
+
JSR_PREPARED_SCRIPT(jsr_create_prepared_script)
|
|
43
|
+
JSR_PREPARED_SCRIPT(jsr_delete_prepared_script)
|
|
44
|
+
JSR_PREPARED_SCRIPT(jsr_prepared_script_run)
|
|
45
|
+
|
|
46
|
+
#undef JSR_FUNC
|
|
47
|
+
#undef JSR_JSI_FUNC
|
|
48
|
+
#undef JSR_PREPARED_SCRIPT
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "NodeApi.h"
|
|
5
|
+
|
|
6
|
+
namespace Microsoft::NodeApiJsi {
|
|
7
|
+
|
|
8
|
+
namespace {
|
|
9
|
+
|
|
10
|
+
struct NodeApiNames {
|
|
11
|
+
#define NODE_API_FUNC(func) static constexpr const char func[] = #func;
|
|
12
|
+
#include "NodeApi.inc"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
} // namespace
|
|
16
|
+
|
|
17
|
+
LibFuncResolver::LibFuncResolver(const char *libName) : libHandle_(LibLoader::loadLib(libName)) {}
|
|
18
|
+
|
|
19
|
+
FuncPtr LibFuncResolver::getFuncPtr(const char *funcName) {
|
|
20
|
+
return LibLoader::getFuncPtr(libHandle_, funcName);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
DelayLoadedApi::DelayLoadedApi(IFuncResolver *funcResolver) : funcResolver_(funcResolver) {}
|
|
24
|
+
|
|
25
|
+
DelayLoadedApi::~DelayLoadedApi() = default;
|
|
26
|
+
|
|
27
|
+
FuncPtr DelayLoadedApi::getFuncPtr(const char *funcName) {
|
|
28
|
+
return funcResolver_->getFuncPtr(funcName);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
thread_local NodeApi *NodeApi::current_{};
|
|
32
|
+
|
|
33
|
+
NodeApi::NodeApi(IFuncResolver *funcResolver)
|
|
34
|
+
: DelayLoadedApi(funcResolver)
|
|
35
|
+
#define NODE_API_FUNC(func) \
|
|
36
|
+
, func(&ApiFuncResolver<NodeApi, decltype(::func) *, NodeApiNames::func, offsetof(NodeApi, func)>::stub)
|
|
37
|
+
#include "NodeApi.inc"
|
|
38
|
+
{
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
} // namespace Microsoft::NodeApiJsi
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
#ifndef APILOADERS_NODEAPI_H_
|
|
6
|
+
#define APILOADERS_NODEAPI_H_
|
|
7
|
+
|
|
8
|
+
#include <js_native_api.h>
|
|
9
|
+
|
|
10
|
+
namespace Microsoft::NodeApiJsi {
|
|
11
|
+
|
|
12
|
+
using LibHandle = struct LibHandle_t *;
|
|
13
|
+
using FuncPtr = struct FuncPtr_t *;
|
|
14
|
+
|
|
15
|
+
class LibLoader {
|
|
16
|
+
public:
|
|
17
|
+
static LibHandle loadLib(const char *libName);
|
|
18
|
+
static FuncPtr getFuncPtr(LibHandle libHandle, const char *funcName);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
template <typename TApi, typename T, const char *funcName, size_t offset>
|
|
22
|
+
struct ApiFuncResolver;
|
|
23
|
+
|
|
24
|
+
template <typename TApi, typename TResult, const char *funcName, size_t offset, typename... TArgs>
|
|
25
|
+
struct ApiFuncResolver<TApi, TResult(NAPI_CDECL *)(TArgs...), funcName, offset> {
|
|
26
|
+
// Stub is a special function that loads the targeting function on the first call,
|
|
27
|
+
// replaces function pointer field with the loaded function, and executes the function.
|
|
28
|
+
// After this all future calls to the loaded function are going to be directly from
|
|
29
|
+
// the field and not use this Stub.
|
|
30
|
+
static TResult NAPI_CDECL stub(TArgs... args) {
|
|
31
|
+
using TFunc = TResult(NAPI_CDECL *)(TArgs...);
|
|
32
|
+
TApi *current = TApi::current();
|
|
33
|
+
TFunc func = reinterpret_cast<TFunc>(current->getFuncPtr(funcName));
|
|
34
|
+
*reinterpret_cast<TFunc *>(reinterpret_cast<char *>(current) + offset) = func;
|
|
35
|
+
return (*func)(args...);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Optional stub tries to load target function on the first call and set it
|
|
39
|
+
// as the function pointer. If loading fails, then it uses provided default
|
|
40
|
+
// function implementation. The default function can either do the required
|
|
41
|
+
// work or return a failure.
|
|
42
|
+
template <TResult(NAPI_CDECL *defaultFunc)(TArgs...)>
|
|
43
|
+
static TResult NAPI_CDECL optionalStub(TArgs... args) {
|
|
44
|
+
using TFunc = TResult(NAPI_CDECL *)(TArgs...);
|
|
45
|
+
TApi *current = TApi::current();
|
|
46
|
+
TFunc func = reinterpret_cast<TFunc>(current->getFuncPtr(funcName));
|
|
47
|
+
if (func == nullptr) {
|
|
48
|
+
func = defaultFunc;
|
|
49
|
+
}
|
|
50
|
+
*reinterpret_cast<TFunc *>(reinterpret_cast<char *>(current) + offset) = func;
|
|
51
|
+
return (*func)(args...);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
template <void (*preloadFunc)()>
|
|
55
|
+
static TResult NAPI_CDECL preloadStub(TArgs... args) {
|
|
56
|
+
using TFunc = TResult(NAPI_CDECL *)(TArgs...);
|
|
57
|
+
preloadFunc();
|
|
58
|
+
TApi *current = TApi::current();
|
|
59
|
+
TFunc func = *reinterpret_cast<TFunc *>(reinterpret_cast<char *>(current) + offset);
|
|
60
|
+
return (*func)(args...);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
struct IFuncResolver {
|
|
65
|
+
virtual FuncPtr getFuncPtr(const char *funcName) = 0;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
class LibFuncResolver : public IFuncResolver {
|
|
69
|
+
public:
|
|
70
|
+
LibFuncResolver(const char *libName);
|
|
71
|
+
FuncPtr getFuncPtr(const char *funcName) override;
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
LibHandle libHandle_;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
class DelayLoadedApi {
|
|
78
|
+
public:
|
|
79
|
+
DelayLoadedApi(IFuncResolver *funcResolver);
|
|
80
|
+
~DelayLoadedApi();
|
|
81
|
+
|
|
82
|
+
FuncPtr getFuncPtr(const char *funcName);
|
|
83
|
+
|
|
84
|
+
DelayLoadedApi(const DelayLoadedApi &) = delete;
|
|
85
|
+
DelayLoadedApi &operator=(const DelayLoadedApi &) = delete;
|
|
86
|
+
|
|
87
|
+
private:
|
|
88
|
+
IFuncResolver *funcResolver_;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
class NodeApi : public DelayLoadedApi {
|
|
92
|
+
public:
|
|
93
|
+
NodeApi(IFuncResolver *funcResolver);
|
|
94
|
+
|
|
95
|
+
static NodeApi *current() {
|
|
96
|
+
return current_;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static void setCurrent(NodeApi *current) {
|
|
100
|
+
current_ = current;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
class Scope {
|
|
104
|
+
public:
|
|
105
|
+
Scope(NodeApi *nodeApi) : prevNodeApi_(NodeApi::current_) {
|
|
106
|
+
NodeApi::current_ = nodeApi;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
~Scope() {
|
|
110
|
+
NodeApi::current_ = prevNodeApi_;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private:
|
|
114
|
+
NodeApi *prevNodeApi_;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
public:
|
|
118
|
+
#define NODE_API_FUNC(func) decltype(::func) *const func;
|
|
119
|
+
#include "NodeApi.inc"
|
|
120
|
+
|
|
121
|
+
private:
|
|
122
|
+
static thread_local NodeApi *current_;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
} // namespace Microsoft::NodeApiJsi
|
|
126
|
+
|
|
127
|
+
#endif // !APILOADERS_NODEAPI_H_
|