react-native-windows 0.83.0-preview.2 → 0.84.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 +2 -2
- package/Folly/Folly.vcxproj +2 -0
- package/Libraries/Animated/AnimatedEvent.js +2 -2
- package/Libraries/Animated/animations/Animation.js +1 -3
- package/Libraries/Animated/createAnimatedComponent.js +8 -5
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +40 -4
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
- package/Libraries/Animated/nodes/AnimatedObject.js +16 -11
- package/Libraries/Animated/nodes/AnimatedProps.js +43 -12
- package/Libraries/Animated/nodes/AnimatedStyle.js +12 -12
- package/Libraries/Animated/nodes/AnimatedValue.js +6 -3
- package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
- package/Libraries/BatchedBridge/MessageQueue.js +24 -22
- package/Libraries/Blob/URL.js +34 -3
- package/Libraries/Blob/URLSearchParams.js +1 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +9 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +6 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +6 -1
- package/Libraries/Components/Button.js +2 -5
- package/Libraries/Components/Button.windows.js +2 -5
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +4 -4
- package/Libraries/Components/Keyboard/Keyboard.js +2 -2
- package/Libraries/Components/Pressable/Pressable.js +8 -8
- package/Libraries/Components/Pressable/Pressable.windows.js +14 -13
- package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
- package/Libraries/Components/TextInput/TextInput.flow.windows.js +19 -18
- package/Libraries/Components/TextInput/TextInput.js +33 -34
- package/Libraries/Components/TextInput/TextInput.windows.js +40 -39
- package/Libraries/Components/Touchable/PooledClass.js +2 -2
- package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +3 -3
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +9 -9
- package/Libraries/Components/View/ViewPropTypes.js +16 -6
- package/Libraries/Components/View/ViewPropTypes.windows.js +21 -11
- package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
- package/Libraries/Core/Devtools/loadBundleFromServer.windows.js +6 -3
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
- package/Libraries/Core/ExceptionsManager.js +3 -3
- package/Libraries/Core/RawEventEmitter.js +1 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +1 -1
- package/Libraries/EventEmitter/NativeEventEmitter.js +2 -2
- package/Libraries/Image/Image.android.js +2 -2
- package/Libraries/Image/Image.ios.js +2 -2
- package/Libraries/Image/Image.windows.js +2 -2
- package/Libraries/Image/ImageProps.js +1 -1
- package/Libraries/Image/ImageTypes.flow.js +2 -2
- package/Libraries/Interaction/InteractionManager.js +3 -3
- package/Libraries/Interaction/PanResponder.js +1 -1
- package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/LogBox/Data/LogBoxData.js +31 -4
- package/Libraries/LogBox/Data/LogBoxLog.js +2 -2
- package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +5 -5
- package/Libraries/LogBox/LogBox.js +7 -7
- package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +4 -4
- package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
- package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +1 -1
- package/Libraries/Network/RCTNetworking.android.js +3 -3
- package/Libraries/Network/RCTNetworking.ios.js +2 -2
- package/Libraries/Network/RCTNetworking.js.flow +2 -2
- package/Libraries/Network/RCTNetworking.windows.js +2 -2
- package/Libraries/Pressability/Pressability.js +9 -9
- package/Libraries/Pressability/Pressability.windows.js +17 -16
- package/Libraries/ReactNative/AppRegistry.flow.js +1 -1
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -1
- package/Libraries/ReactNative/FabricUIManager.js +1 -1
- package/Libraries/ReactNative/PaperUIManager.js +1 -1
- package/Libraries/ReactNative/PaperUIManager.windows.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +2 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +1 -1
- package/Libraries/ReactNative/RendererImplementation.js +1 -1
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -2
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +3 -3
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +11 -4
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +11 -4
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11 -4
- package/Libraries/Renderer/shims/ReactFabric.js +3 -1
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
- package/Libraries/Renderer/shims/ReactNative.js +2 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +3 -1
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
- package/Libraries/Settings/Settings.ios.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +4 -2
- package/Libraries/StyleSheet/StyleSheetExports.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +99 -4
- package/Libraries/StyleSheet/StyleSheetTypes.js +6 -8
- package/Libraries/StyleSheet/processFilter.js +1 -1
- package/Libraries/Text/Text.js +46 -6
- package/Libraries/Text/Text.windows.js +46 -6
- package/Libraries/Text/TextNativeComponent.js +1 -1
- package/Libraries/Text/TextProps.js +7 -7
- package/Libraries/Text/TextProps.windows.js +7 -7
- package/Libraries/Types/CodegenTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.js +31 -0
- package/Libraries/Types/CoreEventTypes.windows.js +31 -13
- package/Libraries/Types/ReactDevToolsTypes.js +2 -2
- package/Libraries/Utilities/Appearance.js +2 -2
- package/Libraries/Utilities/DevLoadingView.js +8 -1
- package/Libraries/Utilities/DevSettings.js +3 -3
- package/Libraries/Utilities/HMRClient.js +4 -3
- package/Libraries/Utilities/RCTLog.js +3 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +1 -1
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +3 -3
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/stringifySafe.js +7 -7
- package/Libraries/Utilities/useRefEffect.js +1 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +3 -3
- package/Libraries/promiseRejectionTrackingOptions.js +8 -8
- package/Libraries/vendor/core/ErrorUtils.js +10 -10
- package/Libraries/vendor/emitter/EventEmitter.js +6 -6
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +5 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +25 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +9 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +2 -3
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +2 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +2 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +6 -0
- package/Microsoft.ReactNative/ViewProps.idl +9 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +12 -2
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/ReactCommon/ReactCommon.vcxproj +7 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +0 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +5 -5
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +0 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +2 -43
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +12 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/attributedstring/TextAttributes.cpp +291 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +0 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +1 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/propsConversions.h +199 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +6 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +17 -10
- package/Scripts/creaternwapp.cmd +8 -1
- package/Scripts/creaternwlib.cmd +21 -2
- package/Shared/DevSettings.h +0 -3
- package/Shared/Modules/WebSocketModule.cpp +0 -1
- package/Shared/Modules/WebSocketModule.h +62 -3
- package/Shared/OInstance.cpp +5 -0
- package/Shared/Shared.vcxitems +4 -6
- package/Shared/Shared.vcxitems.filters +218 -709
- package/codegen/NativeAccessibilityManagerSpec.g.h +2 -0
- package/codegen/NativeAnimatedModuleSpec.g.h +21 -15
- package/codegen/NativeDevLoadingViewSpec.g.h +3 -3
- package/codegen/NativeIntentAndroidSpec.g.h +16 -3
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +209 -191
- package/codegen/react/components/rnwcore/EventEmitters.h +1 -0
- package/codegen/react/components/rnwcore/Props.h +14 -0
- package/codegen/rnwcoreJSI.h +246 -211
- package/index.js +3 -0
- package/index.windows.js +3 -0
- package/jest/mock.js +2 -2
- package/jest/mockComponent.js +1 -1
- package/jest/setup.js +1 -1
- package/package.json +22 -21
- package/src/private/animated/NativeAnimatedHelper.js +130 -125
- package/src/private/animated/NativeAnimatedValidation.js +7 -4
- package/src/private/animated/createAnimatedPropsHook.js +13 -5
- package/src/private/animated/createAnimatedPropsMemoHook.js +10 -10
- package/src/private/components/virtualview/VirtualView.js +16 -9
- package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
- package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
- package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +6 -25
- package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +1 -27
- package/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +3 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +63 -42
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +3 -3
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +12 -9
- package/src/private/renderer/errorhandling/ErrorHandlers.js +7 -4
- package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +4 -0
- package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +1 -0
- package/src/private/webapis/dom/events/CustomEvent.js +3 -3
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentElementInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +29 -29
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +1 -1
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
- package/src/private/webapis/geometry/DOMRectReadOnly.js +1 -1
- package/src/private/webapis/html/events/MessageEvent.js +3 -3
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +3 -3
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +53 -5
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +2 -2
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +4 -4
- package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
- package/src/private/webapis/mutationobserver/MutationObserver.js +1 -1
- package/src/private/webapis/mutationobserver/MutationRecord.js +1 -1
- package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -4
- package/src/private/webapis/performance/Performance.js +1 -1
- package/src/private/webapis/performance/UserTiming.js +1 -1
- package/src/private/webapis/performance/specs/NativePerformance.js +3 -3
- package/src/private/webapis/structuredClone/structuredClone.js +3 -3
- package/src/types/globals.d.ts +30 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +0 -178
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +0 -183
- package/Shared/Modules/WebSocketTurboModule.h +0 -71
- package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
- package/src/private/devsupport/devmenu/perfmonitor/PerformanceOverlay.js +0 -66
package/src/types/globals.d.ts
CHANGED
|
@@ -461,8 +461,18 @@ declare global {
|
|
|
461
461
|
| 'text';
|
|
462
462
|
|
|
463
463
|
interface URL {
|
|
464
|
-
|
|
464
|
+
readonly hash: string;
|
|
465
|
+
readonly host: string;
|
|
466
|
+
readonly hostname: string;
|
|
467
|
+
readonly href: string;
|
|
468
|
+
readonly origin: string;
|
|
469
|
+
readonly password: string;
|
|
470
|
+
readonly pathname: string;
|
|
471
|
+
readonly port: string;
|
|
472
|
+
readonly protocol: string;
|
|
473
|
+
search: string;
|
|
465
474
|
readonly searchParams: URLSearchParams;
|
|
475
|
+
readonly username: string;
|
|
466
476
|
|
|
467
477
|
toJSON(): string;
|
|
468
478
|
toString(): string;
|
|
@@ -479,8 +489,27 @@ declare global {
|
|
|
479
489
|
* Based on definitions of lib.dom and lib.dom.iterable
|
|
480
490
|
*/
|
|
481
491
|
interface URLSearchParams {
|
|
492
|
+
/**
|
|
493
|
+
* Returns the number of search parameter entries.
|
|
494
|
+
*/
|
|
495
|
+
readonly size: number;
|
|
496
|
+
|
|
482
497
|
append(key: string, value: string): void;
|
|
498
|
+
delete(name: string): void;
|
|
499
|
+
get(name: string): string | null;
|
|
500
|
+
getAll(name: string): string[];
|
|
501
|
+
has(name: string): boolean;
|
|
502
|
+
set(name: string, value: string): void;
|
|
503
|
+
sort(): void;
|
|
483
504
|
toString(): string;
|
|
505
|
+
forEach(
|
|
506
|
+
callbackfn: (value: string, key: string, parent: URLSearchParams) => void,
|
|
507
|
+
thisArg?: any,
|
|
508
|
+
): void;
|
|
509
|
+
|
|
510
|
+
keys(): IterableIterator<string>;
|
|
511
|
+
values(): IterableIterator<string>;
|
|
512
|
+
entries(): IterableIterator<[string, string]>;
|
|
484
513
|
|
|
485
514
|
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
486
515
|
}
|
package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <unordered_map>
|
|
11
|
-
|
|
12
|
-
#include <folly/dynamic.h>
|
|
13
|
-
#include <glog/logging.h>
|
|
14
|
-
#include <react/debug/react_native_expect.h>
|
|
15
|
-
#include <react/renderer/core/PropsParserContext.h>
|
|
16
|
-
#include <react/renderer/core/graphicsConversions.h>
|
|
17
|
-
#include <react/renderer/imagemanager/primitives.h>
|
|
18
|
-
|
|
19
|
-
namespace facebook::react {
|
|
20
|
-
|
|
21
|
-
inline void fromRawValue(const PropsParserContext &context, const RawValue &value, ImageSource &result)
|
|
22
|
-
{
|
|
23
|
-
if (value.hasType<std::string>()) {
|
|
24
|
-
result = {
|
|
25
|
-
/* .type = */ ImageSource::Type::Remote,
|
|
26
|
-
/* .uri = */ (std::string)value,
|
|
27
|
-
};
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (value.hasType<std::unordered_map<std::string, RawValue>>()) {
|
|
32
|
-
auto items = (std::unordered_map<std::string, RawValue>)value;
|
|
33
|
-
result = {};
|
|
34
|
-
|
|
35
|
-
result.type = ImageSource::Type::Remote;
|
|
36
|
-
|
|
37
|
-
if (items.find("__packager_asset") != items.end()) {
|
|
38
|
-
result.type = ImageSource::Type::Local;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (items.find("width") != items.end() && items.find("height") != items.end() &&
|
|
42
|
-
// The following checks have to be removed after codegen is shipped.
|
|
43
|
-
// See T45151459.
|
|
44
|
-
items.at("width").hasType<Float>() && items.at("height").hasType<Float>()) {
|
|
45
|
-
result.size = {(Float)items.at("width"), (Float)items.at("height")};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (items.find("scale") != items.end() &&
|
|
49
|
-
// The following checks have to be removed after codegen is shipped.
|
|
50
|
-
// See T45151459.
|
|
51
|
-
items.at("scale").hasType<Float>()) {
|
|
52
|
-
result.scale = (Float)items.at("scale");
|
|
53
|
-
} else {
|
|
54
|
-
result.scale = items.find("deprecated") != items.end() ? 0.0f : 1.0f;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (items.find("url") != items.end() &&
|
|
58
|
-
// The following should be removed after codegen is shipped.
|
|
59
|
-
// See T45151459.
|
|
60
|
-
items.at("url").hasType<std::string>()) {
|
|
61
|
-
result.uri = (std::string)items.at("url");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (items.find("uri") != items.end() &&
|
|
65
|
-
// The following should be removed after codegen is shipped.
|
|
66
|
-
// See T45151459.
|
|
67
|
-
items.at("uri").hasType<std::string>()) {
|
|
68
|
-
result.uri = (std::string)items.at("uri");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (items.find("bundle") != items.end() &&
|
|
72
|
-
// The following should be removed after codegen is shipped.
|
|
73
|
-
// See T45151459.
|
|
74
|
-
items.at("bundle").hasType<std::string>()) {
|
|
75
|
-
result.bundle = (std::string)items.at("bundle");
|
|
76
|
-
result.type = ImageSource::Type::Local;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (items.find("headers") != items.end() &&
|
|
80
|
-
items.at("headers").hasType<std::unordered_map<std::string, std::string>>()) {
|
|
81
|
-
auto headers = (std::unordered_map<std::string, std::string>)items.at("headers");
|
|
82
|
-
for (const auto &header : headers) {
|
|
83
|
-
result.headers.push_back(header);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (items.find("body") != items.end() && items.at("body").hasType<std::string>()) {
|
|
88
|
-
result.body = (std::string)items.at("body");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (items.find("method") != items.end() && items.at("method").hasType<std::string>()) {
|
|
92
|
-
result.method = (std::string)items.at("method");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (items.find("cache") != items.end() && items.at("cache").hasType<std::string>()) {
|
|
96
|
-
auto cache = (std::string)items.at("cache");
|
|
97
|
-
if (cache == "reload") {
|
|
98
|
-
result.cache = ImageSource::CacheStategy::Reload;
|
|
99
|
-
} else if (cache == "force-cache") {
|
|
100
|
-
result.cache = ImageSource::CacheStategy::ForceCache;
|
|
101
|
-
} else if (cache == "only-if-cached") {
|
|
102
|
-
result.cache = ImageSource::CacheStategy::OnlyIfCached;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// The following should be removed after codegen is shipped.
|
|
110
|
-
// See T45151459.
|
|
111
|
-
result = {};
|
|
112
|
-
result.type = ImageSource::Type::Invalid;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
inline std::string toString(const ImageSource &value)
|
|
116
|
-
{
|
|
117
|
-
return "{uri: " + value.uri + "}";
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
inline void fromRawValue(const PropsParserContext &context, const RawValue &value, ImageResizeMode &result)
|
|
121
|
-
{
|
|
122
|
-
react_native_expect(value.hasType<std::string>());
|
|
123
|
-
if (!value.hasType<std::string>()) {
|
|
124
|
-
LOG(ERROR) << "Unsupported ImageResizeMode type";
|
|
125
|
-
// "cover" is default in non-Fabric web and iOS
|
|
126
|
-
result = ImageResizeMode::Cover;
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
auto stringValue = (std::string)value;
|
|
131
|
-
if (stringValue == "cover") {
|
|
132
|
-
result = ImageResizeMode::Cover;
|
|
133
|
-
} else if (stringValue == "contain") {
|
|
134
|
-
result = ImageResizeMode::Contain;
|
|
135
|
-
} else if (stringValue == "stretch") {
|
|
136
|
-
result = ImageResizeMode::Stretch;
|
|
137
|
-
} else if (stringValue == "center") {
|
|
138
|
-
result = ImageResizeMode::Center;
|
|
139
|
-
} else if (stringValue == "repeat") {
|
|
140
|
-
result = ImageResizeMode::Repeat;
|
|
141
|
-
} else if (stringValue == "none") {
|
|
142
|
-
result = ImageResizeMode::None;
|
|
143
|
-
} else {
|
|
144
|
-
LOG(ERROR) << "Unsupported ImageResizeMode value: " << stringValue;
|
|
145
|
-
react_native_expect(false);
|
|
146
|
-
// "cover" is default in non-Fabric web and iOS
|
|
147
|
-
result = ImageResizeMode::Cover;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
inline std::string toString(const ImageResizeMode &value)
|
|
152
|
-
{
|
|
153
|
-
switch (value) {
|
|
154
|
-
case ImageResizeMode::Cover:
|
|
155
|
-
return "cover";
|
|
156
|
-
case ImageResizeMode::Contain:
|
|
157
|
-
return "contain";
|
|
158
|
-
case ImageResizeMode::Stretch:
|
|
159
|
-
return "stretch";
|
|
160
|
-
case ImageResizeMode::Center:
|
|
161
|
-
return "center";
|
|
162
|
-
case ImageResizeMode::Repeat:
|
|
163
|
-
return "repeat";
|
|
164
|
-
case ImageResizeMode::None:
|
|
165
|
-
return "none";
|
|
166
|
-
//#[Windows
|
|
167
|
-
#if defined(_MSC_VER)
|
|
168
|
-
default:
|
|
169
|
-
__assume(0);
|
|
170
|
-
#elif defined(__GNUC__) || defined(__clang__)
|
|
171
|
-
default:
|
|
172
|
-
__builtin_unreachable();
|
|
173
|
-
#endif
|
|
174
|
-
// 15379 #Windows]
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
} // namespace facebook::react
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <string>
|
|
11
|
-
#include <vector>
|
|
12
|
-
|
|
13
|
-
#include <react/renderer/core/graphicsConversions.h>
|
|
14
|
-
#include <react/renderer/core/propsConversions.h>
|
|
15
|
-
#include <react/renderer/debug/debugStringConvertibleUtils.h>
|
|
16
|
-
#include <react/renderer/graphics/Float.h>
|
|
17
|
-
#include <react/renderer/graphics/Size.h>
|
|
18
|
-
|
|
19
|
-
namespace facebook::react {
|
|
20
|
-
|
|
21
|
-
class ImageSource {
|
|
22
|
-
public:
|
|
23
|
-
enum class Type { Invalid, Remote, Local };
|
|
24
|
-
enum class CacheStategy { Default, Reload, ForceCache, OnlyIfCached };
|
|
25
|
-
|
|
26
|
-
Type type{};
|
|
27
|
-
std::string uri{};
|
|
28
|
-
std::string bundle{};
|
|
29
|
-
Float scale{3};
|
|
30
|
-
Size size{.width = 0};
|
|
31
|
-
std::string body{};
|
|
32
|
-
std::string method{};
|
|
33
|
-
CacheStategy cache = CacheStategy::Default;
|
|
34
|
-
std::vector<std::pair<std::string, std::string>> headers{};
|
|
35
|
-
|
|
36
|
-
bool operator==(const ImageSource &rhs) const
|
|
37
|
-
{
|
|
38
|
-
return std::tie(this->type, this->uri) == std::tie(rhs.type, rhs.uri);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
bool operator!=(const ImageSource &rhs) const
|
|
42
|
-
{
|
|
43
|
-
return !(*this == rhs);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
#ifdef RN_SERIALIZABLE_STATE
|
|
47
|
-
folly::dynamic toDynamic() const
|
|
48
|
-
{
|
|
49
|
-
folly::dynamic imageSourceResult = folly::dynamic::object();
|
|
50
|
-
switch (type) {
|
|
51
|
-
case ImageSource::Type::Invalid:
|
|
52
|
-
imageSourceResult["type"] = "invalid";
|
|
53
|
-
break;
|
|
54
|
-
case ImageSource::Type::Remote:
|
|
55
|
-
imageSourceResult["type"] = "remote";
|
|
56
|
-
break;
|
|
57
|
-
case ImageSource::Type::Local:
|
|
58
|
-
imageSourceResult["type"] = "local";
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
imageSourceResult["uri"] = uri;
|
|
63
|
-
imageSourceResult["bundle"] = bundle;
|
|
64
|
-
imageSourceResult["scale"] = scale;
|
|
65
|
-
|
|
66
|
-
folly::dynamic sizeResult = folly::dynamic::object();
|
|
67
|
-
sizeResult["width"] = size.width;
|
|
68
|
-
sizeResult["height"] = size.height;
|
|
69
|
-
imageSourceResult["size"] = sizeResult;
|
|
70
|
-
|
|
71
|
-
imageSourceResult["body"] = body;
|
|
72
|
-
imageSourceResult["method"] = method;
|
|
73
|
-
|
|
74
|
-
switch (cache) {
|
|
75
|
-
case ImageSource::CacheStategy::Default:
|
|
76
|
-
imageSourceResult["cache"] = "default";
|
|
77
|
-
break;
|
|
78
|
-
case ImageSource::CacheStategy::Reload:
|
|
79
|
-
imageSourceResult["cache"] = "reload";
|
|
80
|
-
break;
|
|
81
|
-
case ImageSource::CacheStategy::ForceCache:
|
|
82
|
-
imageSourceResult["cache"] = "force-cache";
|
|
83
|
-
break;
|
|
84
|
-
case ImageSource::CacheStategy::OnlyIfCached:
|
|
85
|
-
imageSourceResult["cache"] = "only-if-cached";
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
folly::dynamic headersObject = folly::dynamic::object();
|
|
90
|
-
for (const auto &header : headers) {
|
|
91
|
-
headersObject[header.first] = header.second;
|
|
92
|
-
}
|
|
93
|
-
imageSourceResult["headers"] = headersObject;
|
|
94
|
-
return imageSourceResult;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
#endif
|
|
98
|
-
|
|
99
|
-
#if RN_DEBUG_STRING_CONVERTIBLE
|
|
100
|
-
SharedDebugStringConvertibleList getDebugProps(const std::string &prefix) const
|
|
101
|
-
{
|
|
102
|
-
ImageSource imageSource{};
|
|
103
|
-
|
|
104
|
-
SharedDebugStringConvertibleList headersList;
|
|
105
|
-
for (const auto &header : headers) {
|
|
106
|
-
headersList.push_back(debugStringConvertibleItem(prefix + "-header-" + header.first, header.second));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return headersList +
|
|
110
|
-
SharedDebugStringConvertibleList{
|
|
111
|
-
debugStringConvertibleItem(prefix + "-type", toString(type), toString(imageSource.type)),
|
|
112
|
-
debugStringConvertibleItem(prefix + "-uri", uri, imageSource.uri),
|
|
113
|
-
debugStringConvertibleItem(prefix + "-bundle", bundle, imageSource.bundle),
|
|
114
|
-
debugStringConvertibleItem(prefix + "-scale", scale, imageSource.scale),
|
|
115
|
-
debugStringConvertibleItem(prefix + "-size", react::toString(size), react::toString(imageSource.size)),
|
|
116
|
-
debugStringConvertibleItem(prefix + "-body", body, imageSource.body),
|
|
117
|
-
debugStringConvertibleItem(prefix + "-method", method, imageSource.method),
|
|
118
|
-
debugStringConvertibleItem(prefix + "-cache", toString(cache), toString(imageSource.cache)),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
std::string toString(const Type &typeValue) const
|
|
123
|
-
{
|
|
124
|
-
switch (typeValue) {
|
|
125
|
-
case ImageSource::Type::Invalid:
|
|
126
|
-
return "invalid";
|
|
127
|
-
case ImageSource::Type::Remote:
|
|
128
|
-
return "remote";
|
|
129
|
-
case ImageSource::Type::Local:
|
|
130
|
-
return "local";
|
|
131
|
-
//[Windows #15263
|
|
132
|
-
default:
|
|
133
|
-
return "Unknown";
|
|
134
|
-
//]
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
std::string toString(const CacheStategy &cacheValue) const
|
|
139
|
-
{
|
|
140
|
-
switch (cacheValue) {
|
|
141
|
-
case ImageSource::CacheStategy::Default:
|
|
142
|
-
return "default";
|
|
143
|
-
case ImageSource::CacheStategy::Reload:
|
|
144
|
-
return "reload";
|
|
145
|
-
case ImageSource::CacheStategy::ForceCache:
|
|
146
|
-
return "force-cache";
|
|
147
|
-
case ImageSource::CacheStategy::OnlyIfCached:
|
|
148
|
-
return "only-if-cached";
|
|
149
|
-
//[Windows #15263
|
|
150
|
-
default:
|
|
151
|
-
return "Unknown";
|
|
152
|
-
//]
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
#endif
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
#ifdef RN_SERIALIZABLE_STATE
|
|
159
|
-
inline folly::dynamic toDynamic(const ImageSource &imageSource)
|
|
160
|
-
{
|
|
161
|
-
return imageSource.toDynamic();
|
|
162
|
-
}
|
|
163
|
-
#endif
|
|
164
|
-
|
|
165
|
-
using ImageSources = std::vector<ImageSource>;
|
|
166
|
-
|
|
167
|
-
enum class ImageResizeMode : int8_t {
|
|
168
|
-
Cover = 0,
|
|
169
|
-
Contain = 1,
|
|
170
|
-
Stretch = 2,
|
|
171
|
-
Center = 3,
|
|
172
|
-
Repeat = 4,
|
|
173
|
-
None = 5,
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
class ImageErrorInfo {
|
|
177
|
-
public:
|
|
178
|
-
std::string error{};
|
|
179
|
-
int responseCode{};
|
|
180
|
-
std::vector<std::pair<std::string, std::string>> httpResponseHeaders{};
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
} // namespace facebook::react
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
#pragma once
|
|
5
|
-
|
|
6
|
-
#include <codegen/NativeWebSocketModuleSpec.g.h>
|
|
7
|
-
#include <Modules/IWebSocketModuleProxy.h>
|
|
8
|
-
#include <NativeModules.h>
|
|
9
|
-
#include <Networking/IWebSocketResource.h>
|
|
10
|
-
|
|
11
|
-
namespace Microsoft::React {
|
|
12
|
-
|
|
13
|
-
class WebSocketTurboModuleProxy final : public IWebSocketModuleProxy {
|
|
14
|
-
std::unordered_map<double, std::shared_ptr<Networking::IWebSocketResource>> &m_resourceMap;
|
|
15
|
-
|
|
16
|
-
public:
|
|
17
|
-
WebSocketTurboModuleProxy(
|
|
18
|
-
std::unordered_map<double, std::shared_ptr<Networking::IWebSocketResource>> &resourceMap) noexcept;
|
|
19
|
-
|
|
20
|
-
#pragma region IWebSocketModuleProxy
|
|
21
|
-
|
|
22
|
-
void SendBinary(std::string &&base64String, int64_t id) noexcept override;
|
|
23
|
-
|
|
24
|
-
#pragma endregion
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
REACT_MODULE(WebSocketTurboModule, L"WebSocketModule")
|
|
28
|
-
struct WebSocketTurboModule {
|
|
29
|
-
using ModuleSpec = ReactNativeSpecs::WebSocketModuleSpec;
|
|
30
|
-
|
|
31
|
-
REACT_INIT(Initialize)
|
|
32
|
-
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
33
|
-
|
|
34
|
-
REACT_METHOD(Connect, L"connect")
|
|
35
|
-
void Connect(
|
|
36
|
-
std::string &&url,
|
|
37
|
-
std::optional<std::vector<std::string>> protocols,
|
|
38
|
-
ReactNativeSpecs::WebSocketModuleSpec_connect_options &&options,
|
|
39
|
-
double socketID) noexcept;
|
|
40
|
-
|
|
41
|
-
REACT_METHOD(Close, L"close")
|
|
42
|
-
void Close(double code, std::string &&reason, double socketID) noexcept;
|
|
43
|
-
|
|
44
|
-
REACT_METHOD(Send, L"send")
|
|
45
|
-
void Send(std::string &&message, double forSocketID) noexcept;
|
|
46
|
-
|
|
47
|
-
REACT_METHOD(SendBinary, L"sendBinary")
|
|
48
|
-
void SendBinary(std::string &&base64String, double forSocketID) noexcept;
|
|
49
|
-
|
|
50
|
-
REACT_METHOD(Ping, L"ping")
|
|
51
|
-
void Ping(double socketID) noexcept;
|
|
52
|
-
|
|
53
|
-
REACT_METHOD(AddListener, L"addListener")
|
|
54
|
-
void AddListener(std::string &&eventName) noexcept;
|
|
55
|
-
|
|
56
|
-
REACT_METHOD(RemoveListeners, L"removeListeners")
|
|
57
|
-
void RemoveListeners(double count) noexcept;
|
|
58
|
-
|
|
59
|
-
private:
|
|
60
|
-
std::shared_ptr<Networking::IWebSocketResource> CreateResource(int64_t id, std::string &&url) noexcept;
|
|
61
|
-
|
|
62
|
-
winrt::Microsoft::ReactNative::ReactContext m_context;
|
|
63
|
-
std::unordered_map<double, std::shared_ptr<Networking::IWebSocketResource>> m_resourceMap;
|
|
64
|
-
|
|
65
|
-
/// <summary>
|
|
66
|
-
/// Exposes a subset of the module's methods.
|
|
67
|
-
/// </summary>
|
|
68
|
-
std::shared_ptr<IWebSocketModuleProxy> m_proxy;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
} // namespace Microsoft::React
|