Files
react-native/packages/react-native/src/private/testing/fantom/specs/NativeFantom.js
T
Samuel Susla faafd8c2a8 add enqueueModalSizeUpdate to Fantom (#49862)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49862

changelog: [internal]

add method enqueueModalSizeUpdate to allow for setting size of Modal.

Reviewed By: rshest

Differential Revision: D70696524

fbshipit-source-id: 9e22d95e62ee52a66f888503d070fcbff1307d21
2025-03-08 05:50:14 -08:00

96 lines
2.4 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
// match RenderFormatOptions.h
export type RenderFormatOptions = {
includeRoot: boolean,
includeLayoutMetrics: boolean,
};
// match RawEvent.h
export enum NativeEventCategory {
/*
* Start of a continuous event. To be used with touchStart.
*/
ContinuousStart = 0,
/*
* End of a continuous event. To be used with touchEnd.
*/
ContinuousEnd = 1,
/*
* Priority for this event will be determined from other events in the
* queue. If it is triggered by continuous event, its priority will be
* default. If it is not triggered by continuous event, its priority will be
* discrete.
*/
Unspecified = 2,
/*
* Forces discrete type for the event. Regardless if continuous event is
* ongoing.
*/
Discrete = 3,
/*
* Forces continuous type for the event. Regardless if continuous event
* isn't ongoing.
*/
Continuous = 4,
}
export type ScrollOptions = {
x: number,
y: number,
zoomScale?: number,
};
interface Spec extends TurboModule {
startSurface: (
surfaceId: number,
viewportWidth: number,
viewportHeight: number,
devicePixelRatio: number,
) => void;
stopSurface: (surfaceId: number) => void;
enqueueNativeEvent: (
shadowNode: mixed /* ShadowNode */,
type: string,
payload?: mixed,
category?: NativeEventCategory,
isUnique?: boolean,
) => void;
scrollTo: (
shadowNode: mixed /* ShadowNode */,
options: ScrollOptions,
) => void;
enqueueModalSizeUpdate: (
shadowNode: mixed /* ShadowNode */,
height: number,
width: number,
) => void;
takeMountingManagerLogs: (surfaceId: number) => Array<string>;
flushMessageQueue: () => void;
flushEventQueue: () => void;
validateEmptyMessageQueue: () => void;
getRenderedOutput: (surfaceId: number, config: RenderFormatOptions) => string;
reportTestSuiteResultsJSON: (results: string) => void;
saveJSMemoryHeapSnapshot: (filePath: string) => void;
}
export default TurboModuleRegistry.getEnforcing<Spec>(
'NativeFantomCxx',
) as Spec;