react-native-windows 0.79.4 → 0.80.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 +12 -3
- package/Directory.Build.props +5 -2
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Alert/Alert.windows.js +3 -0
- package/Libraries/Alert/RCTAlertManager.js +17 -0
- package/Libraries/Animated/Animated.js.flow +1 -3
- package/Libraries/Animated/AnimatedEvent.js +4 -3
- package/Libraries/Animated/AnimatedExports.js +2 -2
- package/Libraries/Animated/AnimatedExports.js.flow +140 -0
- package/Libraries/Animated/AnimatedImplementation.js +2 -123
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/animations/Animation.js +8 -4
- package/Libraries/Animated/components/AnimatedFlatList.js +7 -6
- package/Libraries/Animated/components/AnimatedScrollView.js +48 -42
- package/Libraries/Animated/components/AnimatedSectionList.js +11 -7
- package/Libraries/Animated/createAnimatedComponent.js +105 -57
- package/Libraries/Animated/nodes/AnimatedNode.js +4 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +46 -26
- package/Libraries/Animated/nodes/AnimatedValue.js +16 -7
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/AppState/AppState.js +7 -2
- package/Libraries/BatchedBridge/MessageQueue.js +2 -2
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/BlobManager.js +1 -0
- package/Libraries/Blob/FileReader.js +219 -8
- package/Libraries/Blob/URL.js +37 -12
- package/Libraries/Blob/URLSearchParams.js +106 -31
- package/Libraries/Blob/URLSearchParams.js.flow +12 -7
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -0
- package/Libraries/Components/Button.d.ts +3 -0
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.windows.js +27 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
- package/Libraries/{NewAppScreen/components/Colors.js → Components/DrawerAndroid/DrawerLayoutAndroid.ios.js} +6 -10
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
- package/Libraries/Components/Flyout/Flyout.js +11 -0
- package/Libraries/Components/Keyboard/Keyboard.js +5 -3
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/Popup/Popup.js +11 -0
- package/Libraries/Components/Pressable/Pressable.js +20 -4
- package/Libraries/Components/Pressable/Pressable.windows.js +20 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +25 -3
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/RefreshControl/RefreshControl.windows.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
- package/Libraries/Components/ScrollView/ScrollView.js +132 -122
- package/Libraries/Components/ScrollView/ScrollView.windows.js +131 -122
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/Switch/Switch.d.ts +3 -0
- package/Libraries/Components/Switch/Switch.js +8 -4
- package/Libraries/Components/Switch/Switch.windows.js +17 -4
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -4
- package/Libraries/Components/TextInput/TextInput.d.ts +70 -33
- package/Libraries/Components/TextInput/TextInput.flow.js +100 -51
- package/Libraries/Components/TextInput/TextInput.flow.windows.js +1246 -0
- package/Libraries/Components/TextInput/TextInput.js +88 -1027
- package/Libraries/Components/TextInput/TextInput.windows.js +104 -1092
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.windows.js +1 -1
- package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +2 -1
- package/Libraries/{Modal/ModalInjection.js → Components/ToastAndroid/ToastAndroid.ios.js} +3 -5
- package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
- package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
- package/Libraries/Components/Touchable/Touchable.js +5 -5
- package/Libraries/Components/Touchable/Touchable.windows.js +5 -5
- package/Libraries/Components/Touchable/TouchableBounce.js +14 -7
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +14 -7
- package/Libraries/Components/Touchable/TouchableHighlight.js +10 -7
- package/Libraries/Components/Touchable/TouchableHighlight.windows.js +10 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -6
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +6 -6
- package/Libraries/Components/Touchable/TouchableOpacity.js +13 -6
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +13 -6
- package/Libraries/Components/View/View.js +18 -21
- package/Libraries/Components/View/View.windows.js +39 -41
- package/Libraries/Components/View/ViewAccessibility.d.ts +8 -0
- package/Libraries/Components/View/ViewAccessibility.js +25 -1
- package/Libraries/Components/View/ViewAccessibility.windows.js +9 -1
- package/Libraries/Components/View/ViewPropTypes.js +49 -3
- package/Libraries/Components/View/ViewPropTypes.windows.js +50 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpReactDevTools.js +5 -5
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
- package/Libraries/EventEmitter/NativeEventEmitter.js +9 -4
- package/Libraries/Image/AssetSourceResolver.js +17 -4
- package/Libraries/Image/AssetSourceResolver.windows.js +17 -4
- package/Libraries/Image/Image.d.ts +26 -10
- package/Libraries/Image/Image.js +17 -0
- package/Libraries/Image/Image.js.flow +5 -5
- package/Libraries/Image/Image.windows.js +13 -1
- package/Libraries/Image/ImageBackground.js +2 -0
- package/Libraries/Image/ImageInjection.js +1 -1
- package/Libraries/Image/ImageProps.js +22 -17
- package/Libraries/Image/ImageSource.js +3 -1
- package/Libraries/Image/ImageSourceUtils.js +4 -2
- package/Libraries/Image/ImageTypes.flow.js +1 -1
- package/Libraries/Interaction/InteractionManager.d.ts +13 -0
- package/Libraries/Interaction/InteractionManager.js +1 -1
- package/Libraries/Interaction/PanResponder.js +3 -3
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -2
- package/Libraries/Lists/FlatList.js +8 -11
- package/Libraries/Lists/SectionList.js +39 -42
- package/Libraries/Lists/SectionListModern.js +25 -34
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +1 -0
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
- package/Libraries/Modal/Modal.js +33 -7
- package/Libraries/Modal/Modal.windows.js +33 -10
- package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
- package/Libraries/NativeModules/specs/NativeDevMenu.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js +17 -0
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworking.windows.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +781 -10
- package/Libraries/Performance/Systrace.js +7 -7
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.windows.js +1 -1
- package/Libraries/ReactNative/AppContainer-dev.js +5 -4
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/FabricUIManager.js +10 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/ReactNative/RendererImplementation.js +10 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -0
- package/Libraries/ReactNative/renderApplication.js +9 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +3 -3
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +51 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4840 -4748
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +4947 -4829
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3998 -3888
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5005 -4948
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2744 -2652
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5020 -4933
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
- package/Libraries/Settings/Settings.ios.js +1 -0
- package/Libraries/Settings/Settings.js +13 -19
- package/Libraries/Settings/SettingsFallback.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/Rect.js +1 -0
- package/Libraries/StyleSheet/StyleSheet.js +31 -200
- package/Libraries/StyleSheet/StyleSheet.js.flow +188 -0
- package/Libraries/StyleSheet/StyleSheetExports.js +210 -0
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +112 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +130 -52
- package/Libraries/StyleSheet/flattenStyle.js +14 -4
- package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
- package/Libraries/StyleSheet/processBackgroundImage.js +670 -214
- package/Libraries/Text/Text.d.ts +2 -5
- package/Libraries/Text/Text.js +3 -3
- package/Libraries/Text/Text.windows.js +3 -3
- package/Libraries/Text/TextNativeComponent.js +0 -4
- package/Libraries/Text/TextProps.js +5 -33
- package/Libraries/Text/TextProps.windows.js +5 -32
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/{Blob/__mocks__/BlobModule.js → Types/CodegenTypesNamespace.js} +4 -6
- package/Libraries/Types/CoreEventTypes.d.ts +6 -1
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.windows.js +1 -1
- package/Libraries/Utilities/Appearance.js +2 -0
- package/Libraries/Utilities/BackHandler.js +17 -0
- package/Libraries/Utilities/DeviceInfo.js +2 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Platform.js +17 -0
- package/Libraries/Utilities/PlatformTypes.js +11 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +2 -2
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/WebSocket/WebSocket.js +313 -8
- package/Libraries/vendor/core/ErrorUtils.js +28 -2
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/Microsoft.ReactNative/CompositionSwitcher.idl +8 -0
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +0 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +197 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +34 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -0
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +36 -33
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +81 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +5 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +148 -14
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +29 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +17 -34
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +9 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -0
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +16 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +1 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +9 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +1 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +4 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +36 -96
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +1 -1
- package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.h +3 -0
- package/Microsoft.ReactNative/TurboModulesProvider.h +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/React.Cpp.props +4 -0
- package/README.md +2 -2
- package/ReactCommon/ReactCommon.vcxproj +9 -4
- package/ReactCommon/ReactCommon.vcxproj.filters +6 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +253 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +5 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +4 -8
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +184 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +22 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +2 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleWithJSIBindings.cpp +27 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +3 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityProps.cpp +308 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/DynamicEventPayload.cpp +42 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/css/CSSTokenizer.h +7 -51
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +10 -5
- package/Scripts/creaternwapp.cmd +9 -3
- package/Shared/Shared.vcxitems +3 -2
- package/Shared/Shared.vcxitems.filters +2 -1
- package/codegen/NativeAnimatedModuleSpec.g.h +2 -0
- package/codegen/NativeAnimatedTurboModuleSpec.g.h +2 -0
- package/codegen/NativePerformanceSpec.g.h +14 -0
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +151 -127
- package/codegen/NativeSampleTurboModuleSpec.g.h +14 -8
- package/codegen/react/components/rnwcore/EventEmitters.cpp +48 -48
- package/codegen/rnwcoreJSI-generated.cpp +159 -129
- package/codegen/rnwcoreJSI.h +534 -408
- package/index.js +51 -331
- package/index.windows.js +70 -352
- package/interface.js +0 -4
- package/jest/resolver.js +31 -0
- package/jest/setup.js +6 -2
- package/package.json +29 -28
- package/src/private/animated/NativeAnimatedHelper.js +21 -8
- package/src/private/animated/createAnimatedPropsHook.js +11 -16
- package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
- package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
- package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
- package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
- package/src/private/{devmenu → devsupport/devmenu}/DevMenu.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BorderBox.js +3 -3
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BoxInspector.js +6 -5
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementBox.js +8 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementProperties.js +11 -10
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/Inspector.js +14 -12
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorOverlay.js +5 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorPanel.js +9 -8
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/NetworkOverlay.js +10 -9
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ReactDevToolsOverlay.js +7 -7
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/StyleInspector.js +7 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/XHRInterceptor.js +2 -2
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/getInspectorDataForViewAtPoint.js +4 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/resolveBoxStyle.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/perfmonitor}/PerformanceOverlay.js +6 -5
- package/src/private/{specs_DEPRECATED/modules → devsupport/devmenu/specs}/NativeDevMenu.js +2 -2
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.android.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.ios.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.windows.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/setUpFuseboxReactDevToolsDispatcher.js +1 -1
- package/src/private/{fusebox → devsupport/rndevtools}/specs/NativeReactDevToolsRuntimeSettingsModule.js +2 -2
- package/src/private/{specs_DEPRECATED/modules → devsupport/rndevtools/specs}/NativeReactDevToolsSettingsManager.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +82 -80
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +12 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -13
- package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +3 -0
- package/src/private/styles/composeStyles.js +12 -5
- package/src/private/types/HostComponent.js +1 -1
- package/src/private/types/HostInstance.js +67 -1
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/private/webapis/performance/Performance.js +1 -3
- package/src/private/webapis/performance/PerformanceEntry.js +6 -1
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +10 -1
- package/src/types/globals.d.ts +42 -0
- package/stubs/double-conversion/double-conversion.h +3 -1
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +4 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +4 -0
- package/types/index.d.ts +6 -3
- package/types/public/ReactNativeTypes.d.ts +2 -2
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +0 -38
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +0 -22
- package/Libraries/Blob/FileReader_new.js +0 -231
- package/Libraries/Blob/FileReader_old.js +0 -186
- package/Libraries/Blob/__mocks__/FileReaderModule.js +0 -20
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +0 -32
- package/Libraries/Core/__mocks__/ErrorUtils.js +0 -33
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -19
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +0 -49
- package/Libraries/Events/CustomEvent.js +0 -32
- package/Libraries/Events/EventPolyfill.js +0 -239
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +0 -118
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +0 -134
- package/Libraries/Network/XMLHttpRequest_new.js +0 -794
- package/Libraries/Network/XMLHttpRequest_old.js +0 -701
- package/Libraries/NewAppScreen/components/DebugInstructions.js +0 -41
- package/Libraries/NewAppScreen/components/DebugInstructions.windows.js +0 -30
- package/Libraries/NewAppScreen/components/Header.js +0 -77
- package/Libraries/NewAppScreen/components/HermesBadge.js +0 -53
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +0 -148
- package/Libraries/NewAppScreen/components/ReloadInstructions.js +0 -39
- package/Libraries/NewAppScreen/components/ReloadInstructions.windows.js +0 -31
- package/Libraries/NewAppScreen/components/logo.png +0 -0
- package/Libraries/NewAppScreen/index.js +0 -25
- package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +0 -58
- package/Libraries/Utilities/__mocks__/BackHandler.js +0 -45
- package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +0 -16
- package/Libraries/Utilities/__mocks__/PixelRatio.js +0 -25
- package/Libraries/WebSocket/WebSocketEvent.js +0 -30
- package/Libraries/WebSocket/WebSocket_new.js +0 -325
- package/Libraries/WebSocket/WebSocket_old.js +0 -297
- package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +0 -30
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +0 -81
- package/jest/__tests__/setup-test.js +0 -18
- package/src/private/components/VScrollViewNativeComponents.js +0 -25
- package/src/private/utilities/ensureInstance.js +0 -21
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +0 -267
- package/types/modules/LaunchScreen.d.ts +0 -18
- /package/src/private/{devmenu → devsupport/devmenu}/DevMenu.d.ts +0 -0
- /package/src/private/{debugging → devsupport/rndevtools}/FuseboxSessionObserver.js +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
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
|
+
#include "CxxNativeModule.h"
|
|
9
|
+
#include "Instance.h"
|
|
10
|
+
|
|
11
|
+
#include <folly/json.h>
|
|
12
|
+
#include <glog/logging.h>
|
|
13
|
+
#include <iterator>
|
|
14
|
+
|
|
15
|
+
#include "JsArgumentHelpers.h"
|
|
16
|
+
#include "MessageQueueThread.h"
|
|
17
|
+
#include "TraceSection.h"
|
|
18
|
+
|
|
19
|
+
#include <logger/react_native_log.h>
|
|
20
|
+
|
|
21
|
+
using facebook::xplat::module::CxxModule;
|
|
22
|
+
namespace facebook::react {
|
|
23
|
+
|
|
24
|
+
std::function<void(folly::dynamic)> makeCallback(
|
|
25
|
+
std::weak_ptr<Instance> instance,
|
|
26
|
+
const folly::dynamic& callbackId) {
|
|
27
|
+
if (!callbackId.isNumber()) {
|
|
28
|
+
throw std::invalid_argument("Expected callback(s) as final argument");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
auto id = callbackId.asInt();
|
|
32
|
+
return [winstance = std::move(instance), id](folly::dynamic args) {
|
|
33
|
+
if (auto instance = winstance.lock()) {
|
|
34
|
+
instance->callJSCallback(id, std::move(args));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
namespace {
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* CxxModule::Callback accepts a vector<dynamic>, makeCallback returns
|
|
43
|
+
* a callback that accepts a dynamic, adapt the second into the first.
|
|
44
|
+
* TODO: Callback types should be made equal (preferably
|
|
45
|
+
* function<void(dynamic)>) to avoid the extra copy and indirect call.
|
|
46
|
+
*/
|
|
47
|
+
CxxModule::Callback convertCallback(
|
|
48
|
+
std::function<void(folly::dynamic)> callback) {
|
|
49
|
+
return [callback = std::move(callback)](std::vector<folly::dynamic> args) {
|
|
50
|
+
// after unpinning folly, can use folly::dynamic::array_range
|
|
51
|
+
folly::dynamic obj = folly::dynamic::array;
|
|
52
|
+
for (auto& arg : args) {
|
|
53
|
+
obj.push_back(std::move(arg));
|
|
54
|
+
}
|
|
55
|
+
callback(std::move(obj));
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
} // namespace
|
|
60
|
+
|
|
61
|
+
bool CxxNativeModule::shouldWarnOnUse_ = false;
|
|
62
|
+
|
|
63
|
+
void CxxNativeModule::setShouldWarnOnUse(bool value) {
|
|
64
|
+
shouldWarnOnUse_ = value;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void CxxNativeModule::emitWarnIfWarnOnUsage(
|
|
68
|
+
const std::string& method_name,
|
|
69
|
+
const std::string& module_name) {
|
|
70
|
+
if (shouldWarnOnUse_) {
|
|
71
|
+
std::string message = "Calling " + method_name +
|
|
72
|
+
" on Cxx NativeModule (name = \"" + module_name + "\").";
|
|
73
|
+
react_native_log_warn(message.c_str());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
std::string CxxNativeModule::getName() {
|
|
78
|
+
return name_;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
std::string CxxNativeModule::getSyncMethodName(unsigned int reactMethodId) {
|
|
82
|
+
if (reactMethodId >= methods_.size()) {
|
|
83
|
+
throw std::invalid_argument(
|
|
84
|
+
"methodId " + std::to_string(reactMethodId) + " out of range [0.." +
|
|
85
|
+
std::to_string(methods_.size()) + "]");
|
|
86
|
+
}
|
|
87
|
+
return methods_[reactMethodId].name;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
std::vector<MethodDescriptor> CxxNativeModule::getMethods() {
|
|
91
|
+
lazyInit();
|
|
92
|
+
|
|
93
|
+
std::vector<MethodDescriptor> descs;
|
|
94
|
+
for (auto& method : methods_) {
|
|
95
|
+
descs.emplace_back(method.name, method.getType());
|
|
96
|
+
}
|
|
97
|
+
return descs;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
folly::dynamic CxxNativeModule::getConstants() {
|
|
101
|
+
lazyInit();
|
|
102
|
+
|
|
103
|
+
if (!module_) {
|
|
104
|
+
return nullptr;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
emitWarnIfWarnOnUsage("getConstants()", getName());
|
|
108
|
+
|
|
109
|
+
folly::dynamic constants = folly::dynamic::object();
|
|
110
|
+
for (auto& pair : module_->getConstants()) {
|
|
111
|
+
constants.insert(std::move(pair.first), std::move(pair.second));
|
|
112
|
+
}
|
|
113
|
+
return constants;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
void CxxNativeModule::invoke(
|
|
117
|
+
unsigned int reactMethodId,
|
|
118
|
+
folly::dynamic&& params,
|
|
119
|
+
int callId) {
|
|
120
|
+
if (reactMethodId >= methods_.size()) {
|
|
121
|
+
throw std::invalid_argument(
|
|
122
|
+
"methodId " + std::to_string(reactMethodId) + " out of range [0.." +
|
|
123
|
+
std::to_string(methods_.size()) + "]");
|
|
124
|
+
}
|
|
125
|
+
if (!params.isArray()) {
|
|
126
|
+
throw std::invalid_argument(
|
|
127
|
+
std::string("Method parameters should be array, but are ") +
|
|
128
|
+
params.typeName());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
CxxModule::Callback first;
|
|
132
|
+
CxxModule::Callback second;
|
|
133
|
+
|
|
134
|
+
const auto& method = methods_[reactMethodId];
|
|
135
|
+
|
|
136
|
+
if (!method.func) {
|
|
137
|
+
throw std::runtime_error(
|
|
138
|
+
"Method " + method.name + " is synchronous but invoked asynchronously");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
emitWarnIfWarnOnUsage(method.name, getName());
|
|
142
|
+
|
|
143
|
+
if (params.size() < method.callbacks) {
|
|
144
|
+
throw std::invalid_argument(
|
|
145
|
+
"Expected " + std::to_string(method.callbacks) +
|
|
146
|
+
" callbacks, but only " + std::to_string(params.size()) +
|
|
147
|
+
" parameters provided");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (method.callbacks == 1) {
|
|
151
|
+
first = convertCallback(makeCallback(instance_, params[params.size() - 1]));
|
|
152
|
+
} else if (method.callbacks == 2) {
|
|
153
|
+
first = convertCallback(makeCallback(instance_, params[params.size() - 2]));
|
|
154
|
+
second =
|
|
155
|
+
convertCallback(makeCallback(instance_, params[params.size() - 1]));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
params.resize(params.size() - method.callbacks);
|
|
159
|
+
|
|
160
|
+
// I've got a few flawed options here. I can let the C++ exception
|
|
161
|
+
// propagate, and the registry will log/convert them to java exceptions.
|
|
162
|
+
// This lets all the java and red box handling work ok, but the only info I
|
|
163
|
+
// can capture about the C++ exception is the what() string, not the stack.
|
|
164
|
+
// I can std::terminate() the app. This causes the full, accurate C++
|
|
165
|
+
// stack trace to be added to logcat by debuggerd. The java state is lost,
|
|
166
|
+
// but in practice, the java stack is always the same in this case since
|
|
167
|
+
// the javascript stack is not visible, and the crash is unfriendly to js
|
|
168
|
+
// developers, but crucial to C++ developers. The what() value is also
|
|
169
|
+
// lost. Finally, I can catch, log the java stack, then rethrow the C++
|
|
170
|
+
// exception. In this case I get java and C++ stack data, but the C++
|
|
171
|
+
// stack is as of the rethrow, not the original throw, both the C++ and
|
|
172
|
+
// java stacks always look the same.
|
|
173
|
+
//
|
|
174
|
+
// I am going with option 2, since that seems like the most useful
|
|
175
|
+
// choice. It would be nice to be able to get what() and the C++
|
|
176
|
+
// stack. I'm told that will be possible in the future. TODO
|
|
177
|
+
// mhorowitz #7128529: convert C++ exceptions to Java
|
|
178
|
+
|
|
179
|
+
const auto& moduleName = name_;
|
|
180
|
+
TraceSection s(
|
|
181
|
+
"CxxMethodCallQueue", "module", moduleName, "method", method.name);
|
|
182
|
+
messageQueueThread_->runOnQueue([method,
|
|
183
|
+
moduleName,
|
|
184
|
+
params = std::move(params),
|
|
185
|
+
first,
|
|
186
|
+
second,
|
|
187
|
+
callId]() {
|
|
188
|
+
#ifdef WITH_FBSYSTRACE
|
|
189
|
+
if (callId != -1) {
|
|
190
|
+
//fbsystrace_end_async_flow(TRACE_TAG_REACT, "native", callId);
|
|
191
|
+
fbsystrace_end_async_flow(TRACE_TAG_REACT_CXX_BRIDGE, "native", callId); // [Windows] [issue #14819]
|
|
192
|
+
}
|
|
193
|
+
#else
|
|
194
|
+
(void)(callId);
|
|
195
|
+
#endif
|
|
196
|
+
TraceSection s(
|
|
197
|
+
"CxxMethodCallDispatch", "module", moduleName, "method", method.name);
|
|
198
|
+
try {
|
|
199
|
+
method.func(std::move(params), first, second);
|
|
200
|
+
} catch (const facebook::xplat::JsArgumentException& ex) {
|
|
201
|
+
throw;
|
|
202
|
+
} catch (std::exception& e) {
|
|
203
|
+
LOG(ERROR) << "std::exception. Method call " << method.name.c_str()
|
|
204
|
+
<< " failed: " << e.what();
|
|
205
|
+
std::terminate();
|
|
206
|
+
} catch (std::string& error) {
|
|
207
|
+
LOG(ERROR) << "std::string. Method call " << method.name.c_str()
|
|
208
|
+
<< " failed: " << error.c_str();
|
|
209
|
+
std::terminate();
|
|
210
|
+
} catch (...) {
|
|
211
|
+
LOG(ERROR) << "Method call " << method.name.c_str()
|
|
212
|
+
<< " failed. unknown error";
|
|
213
|
+
std::terminate();
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
MethodCallResult CxxNativeModule::callSerializableNativeHook(
|
|
219
|
+
unsigned int hookId,
|
|
220
|
+
folly::dynamic&& args) {
|
|
221
|
+
if (hookId >= methods_.size()) {
|
|
222
|
+
throw std::invalid_argument(
|
|
223
|
+
"methodId " + std::to_string(hookId) + " out of range [0.." +
|
|
224
|
+
std::to_string(methods_.size()) + "]");
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const auto& method = methods_[hookId];
|
|
228
|
+
|
|
229
|
+
if (!method.syncFunc) {
|
|
230
|
+
throw std::runtime_error(
|
|
231
|
+
"Method " + method.name + " is asynchronous but invoked synchronously");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
emitWarnIfWarnOnUsage(method.name, getName());
|
|
235
|
+
|
|
236
|
+
return method.syncFunc(std::move(args));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
void CxxNativeModule::lazyInit() {
|
|
240
|
+
if (module_ || !provider_) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// TODO 17216751: providers should never return null modules
|
|
245
|
+
module_ = provider_();
|
|
246
|
+
provider_ = nullptr;
|
|
247
|
+
if (module_) {
|
|
248
|
+
module_->setInstance(instance_);
|
|
249
|
+
methods_ = module_->getMethods();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
} // namespace facebook::react
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
#include "RAMBundleRegistry.h"
|
|
11
11
|
|
|
12
|
-
#include <folly/Conv.h>
|
|
13
12
|
#include <jsinspector-modern/ReactCdp.h>
|
|
14
13
|
#include <jsinspector-modern/tracing/InstanceTracingProfile.h>
|
|
15
14
|
#include <react/timing/primitives.h>
|
|
16
15
|
|
|
16
|
+
#include <array>
|
|
17
17
|
#include <chrono>
|
|
18
18
|
|
|
19
19
|
namespace facebook::react {
|
|
@@ -24,7 +24,10 @@ std::string JSExecutor::getSyntheticBundlePath(
|
|
|
24
24
|
if (bundleId == RAMBundleRegistry::MAIN_BUNDLE_ID) {
|
|
25
25
|
return bundlePath;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
std::array<char, 32> buffer{};
|
|
29
|
+
std::snprintf(buffer.data(), buffer.size(), "seg-%u.js", bundleId);
|
|
30
|
+
return buffer.data();
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
double JSExecutor::performanceNow() {
|
|
@@ -173,8 +173,7 @@ void NativeToJsBridge::callFunction(
|
|
|
173
173
|
int systraceCookie = -1;
|
|
174
174
|
#ifdef WITH_FBSYSTRACE
|
|
175
175
|
systraceCookie = m_systraceCookie++;
|
|
176
|
-
FbSystraceAsyncFlow::begin(
|
|
177
|
-
TRACE_TAG_REACT_CXX_BRIDGE, "JSCall", systraceCookie);
|
|
176
|
+
FbSystraceAsyncFlow::begin(TRACE_TAG_REACT_CXX_BRIDGE, "JSCall", systraceCookie); // [Windows] [issue #14819]
|
|
178
177
|
#endif
|
|
179
178
|
|
|
180
179
|
runOnExecutorQueue([this,
|
|
@@ -192,8 +191,7 @@ void NativeToJsBridge::callFunction(
|
|
|
192
191
|
}
|
|
193
192
|
|
|
194
193
|
#ifdef WITH_FBSYSTRACE
|
|
195
|
-
FbSystraceAsyncFlow::end(
|
|
196
|
-
TRACE_TAG_REACT_CXX_BRIDGE, "JSCall", systraceCookie);
|
|
194
|
+
FbSystraceAsyncFlow::end(TRACE_TAG_REACT_CXX_BRIDGE, "JSCall", systraceCookie); // [Windows] [issue #14819]
|
|
197
195
|
TraceSection s(
|
|
198
196
|
"NativeToJsBridge::callFunction", "module", module, "method", method);
|
|
199
197
|
#else
|
|
@@ -212,8 +210,7 @@ void NativeToJsBridge::invokeCallback(
|
|
|
212
210
|
int systraceCookie = -1;
|
|
213
211
|
#ifdef WITH_FBSYSTRACE
|
|
214
212
|
systraceCookie = m_systraceCookie++;
|
|
215
|
-
FbSystraceAsyncFlow::begin(
|
|
216
|
-
TRACE_TAG_REACT_CXX_BRIDGE, "<callback>", systraceCookie);
|
|
213
|
+
FbSystraceAsyncFlow::begin(TRACE_TAG_REACT_CXX_BRIDGE, "<callback>", systraceCookie); // [Windows] [issue #14819]
|
|
217
214
|
#endif
|
|
218
215
|
|
|
219
216
|
runOnExecutorQueue(
|
|
@@ -227,8 +224,7 @@ void NativeToJsBridge::invokeCallback(
|
|
|
227
224
|
"Attempting to invoke JS callback on a bad application bundle.");
|
|
228
225
|
}
|
|
229
226
|
#ifdef WITH_FBSYSTRACE
|
|
230
|
-
FbSystraceAsyncFlow::end(
|
|
231
|
-
TRACE_TAG_REACT_CXX_BRIDGE, "<callback>", systraceCookie);
|
|
227
|
+
FbSystraceAsyncFlow::end(TRACE_TAG_REACT_CXX_BRIDGE, "<callback>", systraceCookie); // [Windows] [issue #14819]
|
|
232
228
|
TraceSection s("NativeToJsBridge::invokeCallback");
|
|
233
229
|
#else
|
|
234
230
|
(void)(systraceCookie);
|
|
@@ -0,0 +1,184 @@
|
|
|
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
|
+
#ifdef WITH_FBSYSTRACE
|
|
11
|
+
#include <fbsystrace.h>
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#ifdef WITH_PERFETTO
|
|
15
|
+
#include <perfetto.h>
|
|
16
|
+
#include <reactperflogger/ReactPerfettoCategories.h>
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#if defined(__APPLE__)
|
|
20
|
+
// This is required so that OS_LOG_TARGET_HAS_10_15_FEATURES will be set.
|
|
21
|
+
#include <os/trace_base.h>
|
|
22
|
+
|
|
23
|
+
#if OS_LOG_TARGET_HAS_10_15_FEATURES && !defined(WITH_LOOM_TRACE)
|
|
24
|
+
#include <os/log.h>
|
|
25
|
+
#include <os/signpost.h>
|
|
26
|
+
#include <sstream>
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
namespace facebook::react {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Allow providing an fbsystrace implementation that can short-circuit out
|
|
35
|
+
* quickly and can throttle too frequent events so we can get useful traces even
|
|
36
|
+
* if rendering etc. is spinning. For throttling we'll need file/line info so we
|
|
37
|
+
* use a macro.
|
|
38
|
+
*/
|
|
39
|
+
#if defined(WITH_LOOM_TRACE)
|
|
40
|
+
#define TraceSectionUnwrapped \
|
|
41
|
+
static constexpr const char systraceSectionFile[] = __FILE__; \
|
|
42
|
+
fbsystrace::FbSystraceSection<systraceSectionFile, __LINE__>
|
|
43
|
+
/**
|
|
44
|
+
* This is a convenience class to avoid lots of verbose profiling
|
|
45
|
+
* #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will
|
|
46
|
+
* remove this completely. If it is defined, it will behave as
|
|
47
|
+
* FbSystraceSection, with the right tag provided. Use two separate classes to
|
|
48
|
+
* to ensure that the ODR rule isn't violated, that is, if WITH_FBSYSTRACE has
|
|
49
|
+
* different values in different files, there is no inconsistency in the sizes
|
|
50
|
+
* of defined symbols.
|
|
51
|
+
*/
|
|
52
|
+
#elif defined(WITH_PERFETTO)
|
|
53
|
+
struct TraceSection {
|
|
54
|
+
public:
|
|
55
|
+
template <typename... ConvertsToStringPiece>
|
|
56
|
+
explicit TraceSection(
|
|
57
|
+
const __unused char* name,
|
|
58
|
+
__unused ConvertsToStringPiece&&... args) {
|
|
59
|
+
TRACE_EVENT_BEGIN("react-native", perfetto::DynamicString{name}, args...);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
~TraceSection() {
|
|
63
|
+
TRACE_EVENT_END("react-native");
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
using TraceSectionUnwrapped = TraceSection;
|
|
67
|
+
#elif defined(WITH_FBSYSTRACE)
|
|
68
|
+
struct ConcreteTraceSection {
|
|
69
|
+
public:
|
|
70
|
+
template <typename... ConvertsToStringPiece>
|
|
71
|
+
explicit ConcreteTraceSection(
|
|
72
|
+
const char* name,
|
|
73
|
+
ConvertsToStringPiece&&... args)
|
|
74
|
+
: m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) {} // [Windows][issue #14819]
|
|
75
|
+
|
|
76
|
+
private:
|
|
77
|
+
fbsystrace::FbSystraceSection m_section;
|
|
78
|
+
};
|
|
79
|
+
using TraceSectionUnwrapped = ConcreteTraceSection;
|
|
80
|
+
#else
|
|
81
|
+
struct DummyTraceSection {
|
|
82
|
+
public:
|
|
83
|
+
template <typename... ConvertsToStringPiece>
|
|
84
|
+
explicit DummyTraceSection(
|
|
85
|
+
const __unused char* name,
|
|
86
|
+
__unused ConvertsToStringPiece&&... args) {}
|
|
87
|
+
};
|
|
88
|
+
using TraceSectionUnwrapped = DummyTraceSection;
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* On recent Apple platforms we want to leverage the Instruments signposts APIs.
|
|
93
|
+
* To not break the other TraceSection implementations above we wrap them.
|
|
94
|
+
* In the case of WITH_LOOM_TRACE we don't use the signposts APIs because of the
|
|
95
|
+
* templated type for TraceSection.
|
|
96
|
+
*/
|
|
97
|
+
#if defined(__APPLE__) && OS_LOG_TARGET_HAS_10_15_FEATURES && \
|
|
98
|
+
!defined(WITH_LOOM_TRACE)
|
|
99
|
+
|
|
100
|
+
namespace systrace {
|
|
101
|
+
|
|
102
|
+
template <typename T, typename = void>
|
|
103
|
+
struct renderer {
|
|
104
|
+
static std::string render(const T& t) {
|
|
105
|
+
std::ostringstream oss;
|
|
106
|
+
oss << t;
|
|
107
|
+
return oss.str();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
template <typename T>
|
|
112
|
+
static auto render(const T& t)
|
|
113
|
+
-> decltype(renderer<T>::render(std::declval<const T&>())) {
|
|
114
|
+
return renderer<T>::render(t);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
inline os_log_t instrumentsLogHandle = nullptr;
|
|
118
|
+
|
|
119
|
+
static inline os_log_t getOrCreateInstrumentsLogHandle() {
|
|
120
|
+
static std::once_flag flag{};
|
|
121
|
+
std::call_once(flag, []() {
|
|
122
|
+
if (!instrumentsLogHandle) {
|
|
123
|
+
instrumentsLogHandle = os_log_create(
|
|
124
|
+
"dev.reactnative.instruments", OS_LOG_CATEGORY_DYNAMIC_TRACING);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return instrumentsLogHandle;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
} // namespace systrace
|
|
131
|
+
|
|
132
|
+
struct TraceSection {
|
|
133
|
+
public:
|
|
134
|
+
template <typename... ConvertsToStringPiece>
|
|
135
|
+
explicit TraceSection(const char* name, ConvertsToStringPiece&&... args)
|
|
136
|
+
: systraceSectionUnwrapped_(name, args...) {
|
|
137
|
+
os_log_t instrumentsLogHandle = systrace::getOrCreateInstrumentsLogHandle();
|
|
138
|
+
|
|
139
|
+
// If the log isn't enabled, we don't want the performance overhead of the
|
|
140
|
+
// rest of the code below.
|
|
141
|
+
if (!os_signpost_enabled(instrumentsLogHandle)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
name_ = name;
|
|
146
|
+
|
|
147
|
+
const auto argsVector = std::vector<std::string>{systrace::render(args)...};
|
|
148
|
+
std::string argsString = "";
|
|
149
|
+
for (size_t i = 0; i < argsVector.size(); i += 2) {
|
|
150
|
+
argsString += argsVector[i] + "=" + argsVector[i + 1] + ";";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
signpostID_ = os_signpost_id_make_with_pointer(instrumentsLogHandle, this);
|
|
154
|
+
|
|
155
|
+
os_signpost_interval_begin(
|
|
156
|
+
instrumentsLogHandle,
|
|
157
|
+
signpostID_,
|
|
158
|
+
"Systrace",
|
|
159
|
+
"%s begin: %s",
|
|
160
|
+
name,
|
|
161
|
+
argsString.c_str());
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
~TraceSection() {
|
|
165
|
+
// We don't need to gate on os_signpost_enabled here because it's already
|
|
166
|
+
// checked in os_signpost_interval_end.
|
|
167
|
+
os_signpost_interval_end(
|
|
168
|
+
systrace::instrumentsLogHandle,
|
|
169
|
+
signpostID_,
|
|
170
|
+
"Systrace",
|
|
171
|
+
"%s end",
|
|
172
|
+
name_.data());
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private:
|
|
176
|
+
os_signpost_id_t signpostID_ = OS_SIGNPOST_ID_INVALID;
|
|
177
|
+
std::string_view name_;
|
|
178
|
+
TraceSectionUnwrapped systraceSectionUnwrapped_;
|
|
179
|
+
};
|
|
180
|
+
#else
|
|
181
|
+
#define TraceSection TraceSectionUnwrapped
|
|
182
|
+
#endif
|
|
183
|
+
|
|
184
|
+
} // namespace facebook::react
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
#include "Base64.h"
|
|
12
12
|
#include "Utf8.h"
|
|
13
13
|
|
|
14
|
+
#include <jsinspector-modern/network/NetworkReporter.h>
|
|
15
|
+
|
|
16
|
+
#include <sstream>
|
|
14
17
|
#include <utility>
|
|
18
|
+
#include <variant>
|
|
15
19
|
|
|
16
20
|
namespace facebook::react::jsinspector_modern {
|
|
17
21
|
|
|
@@ -268,10 +272,28 @@ bool NetworkIOAgent::handleRequest(
|
|
|
268
272
|
}
|
|
269
273
|
|
|
270
274
|
if (InspectorFlags::getInstance().getNetworkInspectionEnabled()) {
|
|
275
|
+
auto& networkReporter = NetworkReporter::getInstance();
|
|
276
|
+
|
|
277
|
+
// @cdp Network.enable support is experimental.
|
|
271
278
|
if (req.method == "Network.enable") {
|
|
279
|
+
networkReporter.setFrontendChannel(frontendChannel_);
|
|
280
|
+
networkReporter.enableDebugging();
|
|
281
|
+
frontendChannel_(cdp::jsonResult(req.id));
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// @cdp Network.disable support is experimental.
|
|
286
|
+
if (req.method == "Network.disable") {
|
|
287
|
+
networkReporter.disableDebugging();
|
|
272
288
|
frontendChannel_(cdp::jsonResult(req.id));
|
|
273
289
|
return true;
|
|
274
290
|
}
|
|
291
|
+
|
|
292
|
+
// @cdp Network.getResponseBody support is experimental.
|
|
293
|
+
if (req.method == "Network.getResponseBody") {
|
|
294
|
+
// TODO(T218468200)
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
275
297
|
}
|
|
276
298
|
|
|
277
299
|
return false;
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
-
#include "CdpJson.h"
|
|
11
10
|
#include "InspectorInterfaces.h"
|
|
12
11
|
#include "ScopedExecutor.h"
|
|
13
12
|
|
|
14
13
|
#include <folly/dynamic.h>
|
|
15
|
-
#include <
|
|
16
|
-
|
|
14
|
+
#include <jsinspector-modern/cdp/CdpJson.h>
|
|
15
|
+
|
|
17
16
|
#include <string>
|
|
18
17
|
#include <unordered_map>
|
|
19
18
|
#include <utility>
|
|
20
|
-
#include <variant>
|
|
21
19
|
|
|
22
20
|
namespace facebook::react::jsinspector_modern {
|
|
23
21
|
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
#include "TurboModuleWithJSIBindings.h"
|
|
9
|
+
|
|
10
|
+
#include <ReactCommon/TurboModule.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
/* static */ void TurboModuleWithJSIBindings::installJSIBindings(
|
|
15
|
+
const std::shared_ptr<TurboModule>& cxxModule,
|
|
16
|
+
jsi::Runtime& runtime) {
|
|
17
|
+
|
|
18
|
+
// check if rtti is enabled before using dynamic_cast [windows] [issue #14820]
|
|
19
|
+
#if defined(__GXX_RTTI) || defined(__cpp_rtti) || (defined(_MSC_VER) && defined(_CPPRTTI))
|
|
20
|
+
if (auto* cxxModuleWithJSIBindings =
|
|
21
|
+
dynamic_cast<TurboModuleWithJSIBindings*>(cxxModule.get())) {
|
|
22
|
+
cxxModuleWithJSIBindings->installJSIBindingsWithRuntime(runtime);
|
|
23
|
+
}
|
|
24
|
+
#endif
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
} // namespace facebook::react
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#include "componentNameByReactViewName.h"
|
|
11
11
|
|
|
12
12
|
#include <react/debug/react_native_assert.h>
|
|
13
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
13
14
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
15
|
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.h>
|
|
15
16
|
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticShadowNode.h>
|
|
@@ -22,7 +23,7 @@ namespace facebook::react {
|
|
|
22
23
|
ComponentDescriptorRegistry::ComponentDescriptorRegistry(
|
|
23
24
|
ComponentDescriptorParameters parameters,
|
|
24
25
|
const ComponentDescriptorProviderRegistry& providerRegistry,
|
|
25
|
-
|
|
26
|
+
std::shared_ptr<const ContextContainer> contextContainer)
|
|
26
27
|
: parameters_(std::move(parameters)),
|
|
27
28
|
providerRegistry_(providerRegistry),
|
|
28
29
|
contextContainer_(std::move(contextContainer)) {}
|
|
@@ -136,4 +137,4 @@ ComponentDescriptorRegistry::getFallbackComponentDescriptor() const {
|
|
|
136
137
|
return _fallbackComponentDescriptor;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
} // namespace facebook::react
|
|
140
|
+
} // namespace facebook::react
|