react-native 0.83.0-rc.0 → 0.84.0-nightly-20251105-5ec5cc3a3
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/Libraries/AppDelegate/RCTReactNativeFactory.h +3 -0
- package/Libraries/AppDelegate/RCTReactNativeFactory.mm +12 -0
- package/Libraries/AppDelegate/RCTRootViewFactory.h +10 -4
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +21 -5
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +2 -2
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +3 -0
- package/React/Base/RCTBundleManager.h +59 -7
- package/React/Base/RCTBundleManager.m +98 -0
- package/React/Base/RCTBundleURLProvider.h +24 -0
- package/React/Base/RCTBundleURLProvider.mm +49 -4
- package/React/Base/RCTVersion.m +2 -2
- package/React/CoreModules/RCTPlatform.mm +3 -2
- package/React/CxxBridge/RCTCxxBridge.mm +1 -2
- package/React/CxxModule/RCTCxxUtils.mm +1 -11
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +127 -135
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt +7 -7
- package/ReactAndroid/src/main/java/com/facebook/react/ViewManagerOnDemandReactPackage.kt +53 -4
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt +99 -9
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorOverlayManager.kt +22 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorOverlayView.kt +4 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +2 -8
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +1 -11
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +1 -12
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAxOrderHelper.kt +47 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.kt +5 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +23 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +7 -2
- package/ReactAndroid/src/main/jni/react/devsupport/JCxxInspectorPackagerConnectionWebSocket.cpp +29 -2
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +1 -15
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +1 -4
- package/ReactAndroid/src/main/jni/react/jni/JSLoader.cpp +1 -1
- package/ReactAndroid/src/main/jni/react/jni/JSLoader.h +2 -1
- package/ReactAndroid/src/main/res/devsupport/drawable/ic_perf_issue.xml +10 -0
- package/ReactCommon/cxxreact/JSBigString.h +14 -5
- package/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp +4 -5
- package/ReactCommon/cxxreact/ReactNativeVersion.h +3 -3
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +2 -3
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +2 -2
- package/ReactCommon/jsinspector-modern/PerfMonitorV2.cpp +9 -1
- package/ReactCommon/jsinspector-modern/PerfMonitorV2.h +4 -1
- package/ReactCommon/jsinspector-modern/TracingAgent.cpp +1 -7
- package/ReactCommon/jsinspector-modern/tests/NetworkReporterTest.cpp +3 -55
- package/ReactCommon/jsinspector-modern/tests/TracingTest.h +82 -0
- package/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp +99 -0
- package/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.h +47 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +1 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +2 -7
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +18 -36
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +2 -4
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +1 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +1 -10
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +1 -2
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +4 -27
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +1 -6
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +1 -3
- package/ReactCommon/react/performance/cdpmetrics/CdpPerfIssuesReporter.cpp +4 -2
- package/ReactCommon/react/renderer/css/CSSSyntaxParser.h +7 -0
- package/ReactCommon/react/runtime/ReactInstance.cpp +4 -4
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +3 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +10 -6
- package/ReactCommon/yoga/yoga/style/StyleLength.h +7 -0
- package/ReactCommon/yoga/yoga/style/StyleSizeLength.h +7 -0
- package/package.json +9 -9
- package/sdks/hermes-engine/version.properties +1 -1
- 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/featureflags/ReactNativeFeatureFlags.js +2 -7
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +1 -2
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +48 -0
- package/types_generated/src/private/components/virtualview/VirtualView.d.ts +3 -1
- package/React/CxxModule/RCTCxxModule.h +0 -29
- package/React/CxxModule/RCTCxxModule.mm +0 -87
- package/sdks/.hermesversion +0 -1
|
@@ -15,6 +15,7 @@ import type {NativeModeChangeEvent} from './VirtualViewNativeComponent';
|
|
|
15
15
|
|
|
16
16
|
import StyleSheet from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
17
17
|
import * as ReactNativeFeatureFlags from '../../featureflags/ReactNativeFeatureFlags';
|
|
18
|
+
import {useVirtualViewLogging} from './logger/VirtualViewLogger';
|
|
18
19
|
import VirtualViewExperimentalNativeComponent from './VirtualViewExperimentalNativeComponent';
|
|
19
20
|
import VirtualViewClassicNativeComponent from './VirtualViewNativeComponent';
|
|
20
21
|
import nullthrows from 'nullthrows';
|
|
@@ -45,6 +46,7 @@ export type Rect = $ReadOnly<{
|
|
|
45
46
|
|
|
46
47
|
export type ModeChangeEvent = $ReadOnly<{
|
|
47
48
|
...Omit<NativeModeChangeEvent, 'mode'>,
|
|
49
|
+
renderState: VirtualViewRenderState,
|
|
48
50
|
mode: VirtualViewMode,
|
|
49
51
|
target: HostInstance,
|
|
50
52
|
}>;
|
|
@@ -90,21 +92,26 @@ function createVirtualView(initialState: State): VirtualViewComponent {
|
|
|
90
92
|
_logs.states?.push(state);
|
|
91
93
|
}
|
|
92
94
|
const isHidden = state !== NotHidden;
|
|
95
|
+
const loggingCallbacksRef = useVirtualViewLogging(isHidden, nativeID);
|
|
93
96
|
|
|
94
97
|
const handleModeChange = (
|
|
95
98
|
event: NativeSyntheticEvent<NativeModeChangeEvent>,
|
|
96
99
|
) => {
|
|
97
100
|
const mode = nullthrows(VirtualViewMode.cast(event.nativeEvent.mode));
|
|
101
|
+
const modeChangeEvent: ModeChangeEvent = {
|
|
102
|
+
mode,
|
|
103
|
+
renderState: isHidden
|
|
104
|
+
? VirtualViewRenderState.None
|
|
105
|
+
: VirtualViewRenderState.Rendered,
|
|
106
|
+
// $FlowFixMe[incompatible-type] - we know this is a HostInstance
|
|
107
|
+
target: event.currentTarget as HostInstance,
|
|
108
|
+
targetRect: event.nativeEvent.targetRect,
|
|
109
|
+
thresholdRect: event.nativeEvent.thresholdRect,
|
|
110
|
+
};
|
|
111
|
+
loggingCallbacksRef.current?.logModeChange(modeChangeEvent);
|
|
112
|
+
|
|
98
113
|
const emitModeChange =
|
|
99
|
-
onModeChange == null
|
|
100
|
-
? null
|
|
101
|
-
: onModeChange.bind(null, {
|
|
102
|
-
mode,
|
|
103
|
-
// $FlowFixMe[incompatible-type] - we know this is a HostInstance
|
|
104
|
-
target: event.currentTarget as HostInstance,
|
|
105
|
-
targetRect: event.nativeEvent.targetRect,
|
|
106
|
-
thresholdRect: event.nativeEvent.thresholdRect,
|
|
107
|
-
});
|
|
114
|
+
onModeChange == null ? null : onModeChange.bind(null, modeChangeEvent);
|
|
108
115
|
|
|
109
116
|
match (mode) {
|
|
110
117
|
VirtualViewMode.Visible => {
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type {IVirtualViewLogFunctions} from './VirtualViewLoggerTypes';
|
|
13
|
+
|
|
14
|
+
import {useRef} from 'react';
|
|
15
|
+
|
|
16
|
+
export hook useVirtualViewLogging(
|
|
17
|
+
initiallyHidden: boolean,
|
|
18
|
+
nativeID?: string,
|
|
19
|
+
): React.RefObject<?IVirtualViewLogFunctions> {
|
|
20
|
+
return useRef(null);
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type {ModeChangeEvent} from '../../../../..';
|
|
13
|
+
|
|
14
|
+
export interface IVirtualViewLogFunctions {
|
|
15
|
+
logMount: () => void;
|
|
16
|
+
logModeChange: (event: ModeChangeEvent) => void;
|
|
17
|
+
logUnmount: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface IVirtualViewLogger {
|
|
20
|
+
getVirtualViewLoggingCallbacks(
|
|
21
|
+
initiallyHidden: boolean,
|
|
22
|
+
nativeID?: string,
|
|
23
|
+
): IVirtualViewLogFunctions;
|
|
24
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<dcec3cf74137d4a43dcaa0b330fba44a>>
|
|
8
8
|
* @flow strict
|
|
9
9
|
* @noformat
|
|
10
10
|
*/
|
|
@@ -115,7 +115,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
|
|
|
115
115
|
shouldPressibilityUseW3CPointerEventsForHover: Getter<boolean>,
|
|
116
116
|
shouldTriggerResponderTransferOnScrollAndroid: Getter<boolean>,
|
|
117
117
|
skipActivityIdentityAssertionOnHostPause: Getter<boolean>,
|
|
118
|
-
sweepActiveTouchOnChildNativeGesturesAndroid: Getter<boolean>,
|
|
119
118
|
traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean>,
|
|
120
119
|
updateRuntimeShadowNodeReferencesOnCommit: Getter<boolean>,
|
|
121
120
|
useAlwaysAvailableJSErrorHandling: Getter<boolean>,
|
|
@@ -447,7 +446,7 @@ export const hideOffscreenVirtualViewsOnIOS: Getter<boolean> = createNativeFlagG
|
|
|
447
446
|
*/
|
|
448
447
|
export const overrideBySynchronousMountPropsAtMountingAndroid: Getter<boolean> = createNativeFlagGetter('overrideBySynchronousMountPropsAtMountingAndroid', false);
|
|
449
448
|
/**
|
|
450
|
-
* Enable reporting Performance Issues (`detail.
|
|
449
|
+
* Enable reporting Performance Issues (`detail.devtools.performanceIssue`). Displayed in the V2 Performance Monitor and the "Performance Issues" sub-panel in DevTools.
|
|
451
450
|
*/
|
|
452
451
|
export const perfIssuesEnabled: Getter<boolean> = createNativeFlagGetter('perfIssuesEnabled', false);
|
|
453
452
|
/**
|
|
@@ -474,10 +473,6 @@ export const shouldTriggerResponderTransferOnScrollAndroid: Getter<boolean> = cr
|
|
|
474
473
|
* Skip activity identity assertion in ReactHostImpl::onHostPause()
|
|
475
474
|
*/
|
|
476
475
|
export const skipActivityIdentityAssertionOnHostPause: Getter<boolean> = createNativeFlagGetter('skipActivityIdentityAssertionOnHostPause', false);
|
|
477
|
-
/**
|
|
478
|
-
* A flag to tell Fabric to sweep active touches from JSTouchDispatcher in Android when a child native gesture is started.
|
|
479
|
-
*/
|
|
480
|
-
export const sweepActiveTouchOnChildNativeGesturesAndroid: Getter<boolean> = createNativeFlagGetter('sweepActiveTouchOnChildNativeGesturesAndroid', true);
|
|
481
476
|
/**
|
|
482
477
|
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
|
|
483
478
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<374975d041863bc8d509d2ce0aa8c883>>
|
|
8
8
|
* @flow strict
|
|
9
9
|
* @noformat
|
|
10
10
|
*/
|
|
@@ -90,7 +90,6 @@ export interface Spec extends TurboModule {
|
|
|
90
90
|
+shouldPressibilityUseW3CPointerEventsForHover?: () => boolean;
|
|
91
91
|
+shouldTriggerResponderTransferOnScrollAndroid?: () => boolean;
|
|
92
92
|
+skipActivityIdentityAssertionOnHostPause?: () => boolean;
|
|
93
|
-
+sweepActiveTouchOnChildNativeGesturesAndroid?: () => boolean;
|
|
94
93
|
+traceTurboModulePromiseRejectionsOnAndroid?: () => boolean;
|
|
95
94
|
+updateRuntimeShadowNodeReferencesOnCommit?: () => boolean;
|
|
96
95
|
+useAlwaysAvailableJSErrorHandling?: () => boolean;
|
|
@@ -94,6 +94,24 @@ export default class IntersectionObserver {
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
if (options != null && 'delay' in options) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
"Failed to construct 'IntersectionObserver': The 'delay' option is not supported.",
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (options != null && 'scrollMargin' in options) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
"Failed to construct 'IntersectionObserver': The 'scrollMargin' option is not supported.",
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (options != null && 'trackVisibility' in options) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
"Failed to construct 'IntersectionObserver': The 'trackVisibility' option is not supported.",
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
97
115
|
this._callback = callback;
|
|
98
116
|
|
|
99
117
|
this._rootThresholds = normalizeRootThreshold(options?.rnRootThreshold);
|
|
@@ -152,6 +170,36 @@ export default class IntersectionObserver {
|
|
|
152
170
|
return this._rootThresholds;
|
|
153
171
|
}
|
|
154
172
|
|
|
173
|
+
/**
|
|
174
|
+
* The `delay` option is not supported.
|
|
175
|
+
* @throws {Error} Always throws an error indicating this property is not supported.
|
|
176
|
+
*/
|
|
177
|
+
get delay(): number {
|
|
178
|
+
throw new Error(
|
|
179
|
+
"Failed to read the 'delay' property from 'IntersectionObserver': This property is not supported.",
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The `scrollMargin` option is not supported.
|
|
185
|
+
* @throws {Error} Always throws an error indicating this property is not supported.
|
|
186
|
+
*/
|
|
187
|
+
get scrollMargin(): string {
|
|
188
|
+
throw new Error(
|
|
189
|
+
"Failed to read the 'scrollMargin' property from 'IntersectionObserver': This property is not supported.",
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The `trackVisibility` option is not supported.
|
|
195
|
+
* @throws {Error} Always throws an error indicating this property is not supported.
|
|
196
|
+
*/
|
|
197
|
+
get trackVisibility(): boolean {
|
|
198
|
+
throw new Error(
|
|
199
|
+
"Failed to read the 'trackVisibility' property from 'IntersectionObserver': This property is not supported.",
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
155
203
|
/**
|
|
156
204
|
* Adds an element to the set of target elements being watched by the
|
|
157
205
|
* `IntersectionObserver`.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<7a37994153e6114d2e48a2b2c9b5c8e5>>
|
|
8
8
|
*
|
|
9
9
|
* This file was translated from Flow by scripts/js-api/build-types/index.js.
|
|
10
10
|
* Original file: packages/react-native/src/private/components/virtualview/VirtualView.js
|
|
@@ -44,9 +44,11 @@ export type Rect = Readonly<{
|
|
|
44
44
|
height: number;
|
|
45
45
|
}>;
|
|
46
46
|
export type ModeChangeEvent = Readonly<Omit<Omit<NativeModeChangeEvent, "mode">, keyof {
|
|
47
|
+
renderState: VirtualViewRenderState;
|
|
47
48
|
mode: VirtualViewMode;
|
|
48
49
|
target: HostInstance;
|
|
49
50
|
}> & {
|
|
51
|
+
renderState: VirtualViewRenderState;
|
|
50
52
|
mode: VirtualViewMode;
|
|
51
53
|
target: HostInstance;
|
|
52
54
|
}>;
|
|
@@ -1,29 +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
|
-
#import <memory>
|
|
9
|
-
|
|
10
|
-
#import <Foundation/Foundation.h>
|
|
11
|
-
|
|
12
|
-
#import <React/RCTBridgeModule.h>
|
|
13
|
-
|
|
14
|
-
namespace facebook::xplat::module {
|
|
15
|
-
class CxxModule;
|
|
16
|
-
} // namespace facebook::xplat::module
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Subclass RCTCxxModule to use cross-platform CxxModule on iOS.
|
|
20
|
-
*
|
|
21
|
-
* Subclasses must implement the createModule method to lazily produce the module. When running under the Cxx bridge
|
|
22
|
-
* modules will be accessed directly, under the Objective-C bridge method access is wrapped through RCTCxxMethod.
|
|
23
|
-
*/
|
|
24
|
-
@interface RCTCxxModule : NSObject <RCTBridgeModule>
|
|
25
|
-
|
|
26
|
-
// To be implemented by subclasses
|
|
27
|
-
- (std::unique_ptr<facebook::xplat::module::CxxModule>)createModule;
|
|
28
|
-
|
|
29
|
-
@end
|
|
@@ -1,87 +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
|
-
#import "RCTCxxModule.h"
|
|
9
|
-
|
|
10
|
-
#import <React/RCTBridge.h>
|
|
11
|
-
#import <React/RCTLog.h>
|
|
12
|
-
#import <cxxreact/CxxModule.h>
|
|
13
|
-
#import <react/utils/FollyConvert.h>
|
|
14
|
-
|
|
15
|
-
#import "RCTCxxMethod.h"
|
|
16
|
-
|
|
17
|
-
using namespace facebook::react;
|
|
18
|
-
|
|
19
|
-
@implementation RCTCxxModule {
|
|
20
|
-
std::unique_ptr<facebook::xplat::module::CxxModule> _module;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
+ (NSString *)moduleName
|
|
24
|
-
{
|
|
25
|
-
return @"";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
+ (BOOL)requiresMainQueueSetup
|
|
29
|
-
{
|
|
30
|
-
return NO;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
- (void)lazyInit
|
|
34
|
-
{
|
|
35
|
-
if (!_module) {
|
|
36
|
-
_module = [self createModule];
|
|
37
|
-
|
|
38
|
-
if (_module) {
|
|
39
|
-
RCTAssert(
|
|
40
|
-
[RCTBridgeModuleNameForClass([self class]) isEqualToString:@(_module->getName().c_str())],
|
|
41
|
-
@"CxxModule class name %@ does not match runtime name %s",
|
|
42
|
-
RCTBridgeModuleNameForClass([self class]),
|
|
43
|
-
_module->getName().c_str());
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
- (std::unique_ptr<facebook::xplat::module::CxxModule>)createModule
|
|
49
|
-
{
|
|
50
|
-
RCTAssert(NO, @"Subclass %@ must override createModule", [self class]);
|
|
51
|
-
return nullptr;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
- (NSArray<id<RCTBridgeMethod>> *)methodsToExport
|
|
55
|
-
{
|
|
56
|
-
[self lazyInit];
|
|
57
|
-
if (!_module) {
|
|
58
|
-
return nil;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
NSMutableArray *moduleMethods = [NSMutableArray new];
|
|
62
|
-
for (const auto &method : _module->getMethods()) {
|
|
63
|
-
[moduleMethods addObject:[[RCTCxxMethod alloc] initWithCxxMethod:method]];
|
|
64
|
-
}
|
|
65
|
-
return moduleMethods;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
- (NSDictionary<NSString *, id> *)constantsToExport
|
|
69
|
-
{
|
|
70
|
-
return [self getConstants];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
- (NSDictionary<NSString *, id> *)getConstants
|
|
74
|
-
{
|
|
75
|
-
[self lazyInit];
|
|
76
|
-
if (!_module) {
|
|
77
|
-
return nil;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
NSMutableDictionary *moduleConstants = [NSMutableDictionary new];
|
|
81
|
-
for (const auto &c : _module->getConstants()) {
|
|
82
|
-
moduleConstants[@(c.first.c_str())] = convertFollyDynamicToId(c.second);
|
|
83
|
-
}
|
|
84
|
-
return moduleConstants;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
@end
|
package/sdks/.hermesversion
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
hermes-v0.14.0
|