react-native-windows 0.82.1 → 0.83.0-preview.0
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 -7
- package/Libraries/Animated/components/AnimatedFlatList.js +5 -3
- package/Libraries/Animated/components/AnimatedImage.js +4 -3
- package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
- package/Libraries/Animated/components/AnimatedText.js +7 -3
- package/Libraries/Animated/components/AnimatedView.js +3 -2
- package/Libraries/Animated/createAnimatedComponent.js +24 -12
- package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +43 -15
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +43 -15
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +2 -2
- package/Libraries/Components/Glyph/Glyph.js +4 -1
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +2 -2
- package/Libraries/Components/RefreshControl/RefreshControl.d.ts +3 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +1 -0
- package/Libraries/Components/ScrollView/ScrollView.windows.js +1 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -6
- package/Libraries/Components/Switch/Switch.d.ts +2 -2
- package/Libraries/Components/Switch/Switch.windows.js +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +2 -5
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +6 -0
- package/Libraries/Components/Touchable/TouchableBounce.js +7 -7
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +7 -7
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +19 -1
- package/Libraries/Components/View/View.d.ts +2 -2
- package/Libraries/Components/View/View.windows.js +0 -1
- package/Libraries/Components/View/ViewNativeComponent.js +13 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpPerformance.js +2 -0
- package/Libraries/Debugging/DebuggingOverlay.js +14 -14
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +8 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -2
- package/Libraries/Image/Image.d.ts +3 -3
- package/Libraries/Image/ImageInjection.js +3 -6
- package/Libraries/Image/ImageTypes.flow.js +3 -7
- package/Libraries/Lists/FlatList.js +8 -8
- package/Libraries/Lists/SectionList.d.ts +5 -1
- package/Libraries/Lists/ViewabilityHelper.js +1 -1
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/LogBox/UI/AnsiHighlight.js +4 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +11 -2
- package/Libraries/NativeComponent/NativeComponentRegistry.d.ts +98 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -0
- package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +3 -1
- package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +45 -0
- package/Libraries/Network/RCTNetworking.android.js +3 -1
- package/Libraries/Network/RCTNetworking.ios.js +3 -0
- package/Libraries/Network/RCTNetworking.windows.js +3 -0
- package/Libraries/Network/XMLHttpRequest.js +1 -41
- package/Libraries/Pressability/usePressability.js +14 -3
- package/Libraries/ReactNative/PaperUIManager.windows.js +3 -3
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +20 -82
- package/Libraries/ReactNative/getNativeComponentAttributes.js +12 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +6759 -4478
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3169 -3119
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4732 -3535
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +6646 -4070
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3136 -2825
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4761 -3312
- package/Libraries/Renderer/shims/ReactNative.js +3 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +2 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +44 -0
- package/Libraries/StyleSheet/processBackgroundPosition.js +284 -0
- package/Libraries/StyleSheet/processBackgroundRepeat.js +105 -0
- package/Libraries/StyleSheet/processBackgroundSize.js +104 -0
- package/Libraries/Text/Text.d.ts +2 -2
- package/Libraries/Text/TextNativeComponent.js +10 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +3 -9
- package/Libraries/Utilities/DevLoadingView.js +14 -6
- package/Libraries/Utilities/HMRClient.js +13 -5
- package/Microsoft.ReactNative/Base/CxxReactIncludes.h +11 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +2 -0
- package/Microsoft.ReactNative/CompositionHwndHost.idl +1 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +10 -40
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +3 -80
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +45 -12
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +8 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +61 -74
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +4 -3
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.cpp +245 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.h +80 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +20 -36
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +70 -49
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +7 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +1 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +20 -94
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -3
- package/Microsoft.ReactNative/Pch/pch.h +2 -0
- package/Microsoft.ReactNative/ReactHost/CrashManager.cpp +5 -0
- package/Microsoft.ReactNative/ReactHost/ReactNativeHeaders.h +1 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +0 -41
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +0 -11
- package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -3
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +31 -101
- package/Microsoft.ReactNative/ReactNativeWin32App.h +2 -13
- package/Microsoft.ReactNative/ReactNativeWindow.idl +44 -0
- package/Microsoft.ReactNative.Cxx/AutoDraw.h +9 -1
- package/Microsoft.ReactNative.Cxx/ReactCommon/CallInvoker.h +13 -16
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +24 -36
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModuleUtils.h +5 -8
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/AString.h +8 -6
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Array.h +32 -49
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Base.h +27 -76
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bool.h +4 -2
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/CallbackWrapper.h +19 -18
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Class.h +25 -48
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Convert.h +38 -31
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Error.h +11 -6
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/EventEmitter.h +47 -45
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Function.h +69 -89
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/HighResTimeStamp.h +8 -8
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/LongLivedObject.h +6 -6
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Number.h +16 -8
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Object.h +17 -24
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Promise.h +17 -17
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Value.h +20 -29
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/debug/react_native_assert.h +2 -7
- package/Microsoft.ReactNative.Cxx/ReactCommon/react/timing/primitives.h +127 -115
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.props +10 -0
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.props +10 -0
- package/PropertySheets/Generated/PackageVersion.g.props +5 -5
- package/PropertySheets/Warnings.props +2 -1
- package/ReactCommon/ReactCommon.vcxproj +21 -12
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/Instance.cpp +381 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +49 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +145 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/MethodCall.cpp +100 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ModuleRegistry.cpp +256 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +13 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/RAMBundleRegistry.cpp +93 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +149 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +25 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +86 -67
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +629 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSINativeModules.cpp +123 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +84 -68
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +31 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/Utf8.h +4 -5
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/network/HttpUtils.cpp +2 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +24 -36
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.h +28 -66
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/webperformance/NativePerformance.cpp +414 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +8 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +19 -16
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +8 -9
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +25 -95
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +85 -42
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +81 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +140 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +25 -31
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +746 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +702 -0
- package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +1 -15
- package/Scripts/creaternwapp.cmd +1 -1
- package/Scripts/perf/compare-results.js +357 -0
- package/Scripts/perf/create-perf-test.js +343 -0
- package/Scripts/perf/post-pr-comment.js +210 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +8 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.h +3 -0
- package/Shared/Shared.vcxitems +24 -12
- package/Shared/Shared.vcxitems.filters +11 -3
- package/codegen/NativeIntersectionObserverSpec.g.h +2 -0
- package/codegen/NativeNetworkingIOSSpec.g.h +2 -0
- package/codegen/NativePerformanceSpec.g.h +6 -0
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +229 -139
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +2 -1
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +42 -25
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +2 -1
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +2 -1
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +11 -6
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +11 -6
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +1 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +2 -1
- package/codegen/react/components/rnwcore/ModalHostView.g.h +40 -23
- package/codegen/react/components/rnwcore/Props.cpp +6 -1
- package/codegen/react/components/rnwcore/Props.h +1 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +11 -6
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +1 -0
- package/codegen/react/components/rnwcore/Switch.g.h +11 -6
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +2 -1
- package/codegen/react/components/rnwcore/VirtualView.g.h +41 -8
- package/codegen/react/components/rnwcore/VirtualViewExperimental.g.h +45 -8
- package/codegen/rnwcoreJSI.h +3973 -6059
- package/index.js +6 -0
- package/index.windows.js +6 -0
- package/jest/mockComponent.js +6 -6
- package/jest/setup.js +15 -10
- package/package.json +27 -27
- package/src/private/components/virtualview/VirtualView.js +22 -27
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +6 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +100 -19
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +18 -3
- package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +12 -2
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +76 -15
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/ResourceTiming.js +31 -4
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +4 -1
- package/src/private/webapis/performance/specs/NativePerformance.js +3 -0
- package/stubs/double-conversion/double-conversion.h +5 -0
- package/templates/cpp-app/template.config.js +1 -1
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +3 -1
- package/templates/cpp-lib/template.config.js +1 -1
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
- package/types/index.d.ts +1 -0
- package/types/public/ReactNativeTypes.d.ts +115 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +0 -152
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +0 -1574
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ShadowNode.cpp +0 -528
- package/Scripts/OpenSSL.nuspec +0 -39
- package/Scripts/OpenSSL.targets +0 -36
- package/codegen/rnwcoreJSI-generated.cpp +0 -3470
|
@@ -17,24 +17,26 @@ namespace facebook::react {
|
|
|
17
17
|
|
|
18
18
|
template <>
|
|
19
19
|
struct Bridging<jsi::WeakObject> {
|
|
20
|
-
static jsi::WeakObject fromJs(jsi::Runtime&
|
|
20
|
+
static jsi::WeakObject fromJs(jsi::Runtime &rt, const jsi::Object &value)
|
|
21
|
+
{
|
|
21
22
|
return jsi::WeakObject(rt, value);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
static jsi::Value toJs(jsi::Runtime&
|
|
25
|
+
static jsi::Value toJs(jsi::Runtime &rt, jsi::WeakObject &value)
|
|
26
|
+
{
|
|
25
27
|
return value.lock(rt);
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
template <typename T>
|
|
30
|
-
struct Bridging<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
static std::shared_ptr<T> fromJs(jsi::Runtime& rt, const jsi::Object& value) {
|
|
32
|
+
struct Bridging<std::shared_ptr<T>, std::enable_if_t<std::is_base_of_v<jsi::HostObject, T>>> {
|
|
33
|
+
static std::shared_ptr<T> fromJs(jsi::Runtime &rt, const jsi::Object &value)
|
|
34
|
+
{
|
|
34
35
|
return value.getHostObject<T>(rt);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
static jsi::Object toJs(jsi::Runtime&
|
|
38
|
+
static jsi::Object toJs(jsi::Runtime &rt, std::shared_ptr<T> value)
|
|
39
|
+
{
|
|
38
40
|
return jsi::Object::createFromHostObject(rt, std::move(value));
|
|
39
41
|
}
|
|
40
42
|
};
|
|
@@ -43,10 +45,8 @@ namespace map_detail {
|
|
|
43
45
|
|
|
44
46
|
template <typename T>
|
|
45
47
|
struct Bridging {
|
|
46
|
-
static T fromJs(
|
|
47
|
-
|
|
48
|
-
const jsi::Object& value,
|
|
49
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
48
|
+
static T fromJs(jsi::Runtime &rt, const jsi::Object &value, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
49
|
+
{
|
|
50
50
|
T result;
|
|
51
51
|
auto propertyNames = value.getPropertyNames(rt);
|
|
52
52
|
auto length = propertyNames.length(rt);
|
|
@@ -56,24 +56,18 @@ struct Bridging {
|
|
|
56
56
|
|
|
57
57
|
result.emplace(
|
|
58
58
|
bridging::fromJs<std::string>(rt, propertyName, jsInvoker),
|
|
59
|
-
bridging::fromJs<typename T::mapped_type>(
|
|
60
|
-
rt, value.getProperty(rt, propertyName.asString(rt)), jsInvoker));
|
|
59
|
+
bridging::fromJs<typename T::mapped_type>(rt, value.getProperty(rt, propertyName.asString(rt)), jsInvoker));
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
return result;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
static jsi::Object toJs(
|
|
67
|
-
|
|
68
|
-
const T& map,
|
|
69
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
65
|
+
static jsi::Object toJs(jsi::Runtime &rt, const T &map, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
66
|
+
{
|
|
70
67
|
auto resultObject = jsi::Object(rt);
|
|
71
68
|
|
|
72
|
-
for (const auto&
|
|
73
|
-
resultObject.setProperty(
|
|
74
|
-
rt,
|
|
75
|
-
jsi::PropNameID::forUtf8(rt, key),
|
|
76
|
-
bridging::toJs(rt, value, jsInvoker));
|
|
69
|
+
for (const auto &[key, value] : map) {
|
|
70
|
+
resultObject.setProperty(rt, jsi::PropNameID::forUtf8(rt, key), bridging::toJs(rt, value, jsInvoker));
|
|
77
71
|
}
|
|
78
72
|
|
|
79
73
|
return resultObject;
|
|
@@ -83,8 +77,7 @@ struct Bridging {
|
|
|
83
77
|
} // namespace map_detail
|
|
84
78
|
|
|
85
79
|
template <typename... Args>
|
|
86
|
-
struct Bridging<std::map<std::string, Args...>>
|
|
87
|
-
: map_detail::Bridging<std::map<std::string, Args...>> {};
|
|
80
|
+
struct Bridging<std::map<std::string, Args...>> : map_detail::Bridging<std::map<std::string, Args...>> {};
|
|
88
81
|
|
|
89
82
|
template <typename... Args>
|
|
90
83
|
struct Bridging<std::unordered_map<std::string, Args...>>
|
|
@@ -18,13 +18,12 @@ namespace facebook::react {
|
|
|
18
18
|
|
|
19
19
|
template <typename... T>
|
|
20
20
|
class AsyncPromise {
|
|
21
|
-
static_assert(
|
|
22
|
-
sizeof...(T) <= 1,
|
|
23
|
-
"AsyncPromise must have at most one argument");
|
|
21
|
+
static_assert(sizeof...(T) <= 1, "AsyncPromise must have at most one argument");
|
|
24
22
|
|
|
25
23
|
public:
|
|
26
|
-
AsyncPromise(jsi::Runtime&
|
|
27
|
-
: state_(std::make_shared<SharedState>())
|
|
24
|
+
AsyncPromise(jsi::Runtime &rt, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
25
|
+
: state_(std::make_shared<SharedState>())
|
|
26
|
+
{
|
|
28
27
|
auto constructor = rt.global().getPropertyAsFunction(rt, "Promise");
|
|
29
28
|
|
|
30
29
|
auto promise = constructor.callAsConstructor(
|
|
@@ -32,23 +31,21 @@ class AsyncPromise {
|
|
|
32
31
|
bridging::toJs(
|
|
33
32
|
rt,
|
|
34
33
|
// Safe to capture this since this is called synchronously.
|
|
35
|
-
[this](
|
|
36
|
-
AsyncCallback<T...> resolve,
|
|
37
|
-
const AsyncCallback<Error>& reject) {
|
|
34
|
+
[this](AsyncCallback<T...> resolve, const AsyncCallback<Error> &reject) {
|
|
38
35
|
state_->resolve = std::move(resolve);
|
|
39
36
|
state_->reject = std::move(reject);
|
|
40
37
|
},
|
|
41
38
|
jsInvoker));
|
|
42
39
|
|
|
43
|
-
auto promiseHolder =
|
|
44
|
-
std::make_shared<PromiseHolder>(rt, promise.asObject(rt));
|
|
40
|
+
auto promiseHolder = std::make_shared<PromiseHolder>(rt, promise.asObject(rt));
|
|
45
41
|
LongLivedObjectCollection::get(rt).add(promiseHolder);
|
|
46
42
|
|
|
47
43
|
// The shared state can retain the promise holder weakly now.
|
|
48
44
|
state_->promiseHolder = promiseHolder;
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
void resolve(T... value)
|
|
47
|
+
void resolve(T... value)
|
|
48
|
+
{
|
|
52
49
|
std::lock_guard<std::mutex> lock(state_->mutex);
|
|
53
50
|
|
|
54
51
|
if (state_->resolve) {
|
|
@@ -58,7 +55,8 @@ class AsyncPromise {
|
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
|
|
61
|
-
void reject(Error error)
|
|
58
|
+
void reject(Error error)
|
|
59
|
+
{
|
|
62
60
|
std::lock_guard<std::mutex> lock(state_->mutex);
|
|
63
61
|
|
|
64
62
|
if (state_->reject) {
|
|
@@ -68,7 +66,8 @@ class AsyncPromise {
|
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
jsi::Object get(jsi::Runtime&
|
|
69
|
+
jsi::Object get(jsi::Runtime &rt) const
|
|
70
|
+
{
|
|
72
71
|
if (auto holder = state_->promiseHolder.lock()) {
|
|
73
72
|
return jsi::Value(rt, holder->promise).asObject(rt);
|
|
74
73
|
} else {
|
|
@@ -78,14 +77,14 @@ class AsyncPromise {
|
|
|
78
77
|
|
|
79
78
|
private:
|
|
80
79
|
struct PromiseHolder : LongLivedObject {
|
|
81
|
-
PromiseHolder(jsi::Runtime&
|
|
82
|
-
: LongLivedObject(runtime), promise(std::move(p)) {}
|
|
80
|
+
PromiseHolder(jsi::Runtime &runtime, jsi::Object p) : LongLivedObject(runtime), promise(std::move(p)) {}
|
|
83
81
|
|
|
84
82
|
jsi::Object promise;
|
|
85
83
|
};
|
|
86
84
|
|
|
87
85
|
struct SharedState {
|
|
88
|
-
~SharedState()
|
|
86
|
+
~SharedState()
|
|
87
|
+
{
|
|
89
88
|
if (auto holder = promiseHolder.lock()) {
|
|
90
89
|
holder->allowRelease();
|
|
91
90
|
}
|
|
@@ -102,7 +101,8 @@ class AsyncPromise {
|
|
|
102
101
|
|
|
103
102
|
template <typename... T>
|
|
104
103
|
struct Bridging<AsyncPromise<T...>> {
|
|
105
|
-
static jsi::Object toJs(jsi::Runtime&
|
|
104
|
+
static jsi::Object toJs(jsi::Runtime &rt, const AsyncPromise<T...> &promise)
|
|
105
|
+
{
|
|
106
106
|
return promise.get(rt);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
@@ -16,7 +16,8 @@ namespace facebook::react {
|
|
|
16
16
|
|
|
17
17
|
template <>
|
|
18
18
|
struct Bridging<std::nullptr_t> {
|
|
19
|
-
static std::nullptr_t fromJs(jsi::Runtime&
|
|
19
|
+
static std::nullptr_t fromJs(jsi::Runtime &rt, const jsi::Value &value)
|
|
20
|
+
{
|
|
20
21
|
if (value.isNull() || value.isUndefined()) {
|
|
21
22
|
return nullptr;
|
|
22
23
|
} else {
|
|
@@ -24,17 +25,17 @@ struct Bridging<std::nullptr_t> {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
static std::nullptr_t toJs(jsi::Runtime
|
|
28
|
+
static std::nullptr_t toJs(jsi::Runtime & /*unused*/, std::nullptr_t)
|
|
29
|
+
{
|
|
28
30
|
return nullptr;
|
|
29
31
|
}
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
template <typename T>
|
|
33
35
|
struct Bridging<std::optional<T>> {
|
|
34
|
-
static std::optional<T>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
36
|
+
static std::optional<T>
|
|
37
|
+
fromJs(jsi::Runtime &rt, const jsi::Value &value, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
38
|
+
{
|
|
38
39
|
if (value.isNull() || value.isUndefined()) {
|
|
39
40
|
return {};
|
|
40
41
|
}
|
|
@@ -42,20 +43,17 @@ struct Bridging<std::optional<T>> {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
template <typename U>
|
|
45
|
-
static std::optional<T>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
46
|
+
static std::optional<T>
|
|
47
|
+
fromJs(jsi::Runtime &rt, const std::optional<U> &value, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
48
|
+
{
|
|
49
49
|
if (value) {
|
|
50
50
|
return bridging::fromJs<T>(rt, *value, jsInvoker);
|
|
51
51
|
}
|
|
52
52
|
return {};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
static jsi::Value toJs(
|
|
56
|
-
|
|
57
|
-
const std::optional<T>& value,
|
|
58
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
55
|
+
static jsi::Value toJs(jsi::Runtime &rt, const std::optional<T> &value, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
56
|
+
{
|
|
59
57
|
if (value) {
|
|
60
58
|
return bridging::toJs(rt, *value, jsInvoker);
|
|
61
59
|
}
|
|
@@ -64,13 +62,9 @@ struct Bridging<std::optional<T>> {
|
|
|
64
62
|
};
|
|
65
63
|
|
|
66
64
|
template <typename T>
|
|
67
|
-
struct Bridging<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
static jsi::Value toJs(
|
|
71
|
-
jsi::Runtime& rt,
|
|
72
|
-
const std::shared_ptr<T>& ptr,
|
|
73
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
65
|
+
struct Bridging<std::shared_ptr<T>, std::enable_if_t<!std::is_base_of_v<jsi::HostObject, T>>> {
|
|
66
|
+
static jsi::Value toJs(jsi::Runtime &rt, const std::shared_ptr<T> &ptr, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
67
|
+
{
|
|
74
68
|
if (ptr) {
|
|
75
69
|
return bridging::toJs(rt, *ptr, jsInvoker);
|
|
76
70
|
}
|
|
@@ -80,10 +74,8 @@ struct Bridging<
|
|
|
80
74
|
|
|
81
75
|
template <typename T>
|
|
82
76
|
struct Bridging<std::unique_ptr<T>> {
|
|
83
|
-
static jsi::Value toJs(
|
|
84
|
-
|
|
85
|
-
const std::unique_ptr<T>& ptr,
|
|
86
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
77
|
+
static jsi::Value toJs(jsi::Runtime &rt, const std::unique_ptr<T> &ptr, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
78
|
+
{
|
|
87
79
|
if (ptr) {
|
|
88
80
|
return bridging::toJs(rt, *ptr, jsInvoker);
|
|
89
81
|
}
|
|
@@ -93,10 +85,9 @@ struct Bridging<std::unique_ptr<T>> {
|
|
|
93
85
|
|
|
94
86
|
template <typename T>
|
|
95
87
|
struct Bridging<std::weak_ptr<T>> {
|
|
96
|
-
static jsi::Value
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const std::shared_ptr<CallInvoker>& jsInvoker) {
|
|
88
|
+
static jsi::Value
|
|
89
|
+
toJs(jsi::Runtime &rt, const std::weak_ptr<T> &weakPtr, const std::shared_ptr<CallInvoker> &jsInvoker)
|
|
90
|
+
{
|
|
100
91
|
if (auto ptr = weakPtr.lock()) {
|
|
101
92
|
return bridging::toJs(rt, *ptr, jsInvoker);
|
|
102
93
|
}
|
|
@@ -37,17 +37,12 @@
|
|
|
37
37
|
#ifdef __cplusplus
|
|
38
38
|
extern "C" {
|
|
39
39
|
#endif // __cplusplus
|
|
40
|
-
void react_native_assert_fail(
|
|
41
|
-
const char* func,
|
|
42
|
-
const char* file,
|
|
43
|
-
int line,
|
|
44
|
-
const char* expr);
|
|
40
|
+
void react_native_assert_fail(const char *func, const char *file, int line, const char *expr);
|
|
45
41
|
#ifdef __cplusplus
|
|
46
42
|
}
|
|
47
43
|
#endif // __cpusplus
|
|
48
44
|
|
|
49
|
-
#define react_native_assert(e)
|
|
50
|
-
((e) ? (void)0 : react_native_assert_fail(__func__, __FILE__, __LINE__, #e))
|
|
45
|
+
#define react_native_assert(e) ((e) ? (void)0 : react_native_assert_fail(__func__, __FILE__, __LINE__, #e))
|
|
51
46
|
|
|
52
47
|
#else // __ANDROID__
|
|
53
48
|
|