Fantom: Make Object Arguments $ReadOnly

Summary:
Changing these object arguments to `$ReadOnly` permits passing in values that are `$ReadOnly` (e.g. `payload` argument to `enqueueNativeEvent`).

Changelog:
[Internal]

Reviewed By: lyahdav

Differential Revision: D72474879

fbshipit-source-id: 27341131724f4f572b78563975774a5b20dee8f8
This commit is contained in:
Tim Yung
2025-04-04 16:15:42 -07:00
committed by Facebook GitHub Bot
parent 512e680d72
commit 45a9279c2e
+5 -5
View File
@@ -310,8 +310,8 @@ export function createRoot(rootConfig?: RootConfig): Root {
export function enqueueNativeEvent(
node: ReactNativeElement,
type: string,
payload?: {[key: string]: mixed},
options?: {category?: NativeEventCategory, isUnique?: boolean},
payload?: $ReadOnly<{[key: string]: mixed}>,
options?: $ReadOnly<{category?: NativeEventCategory, isUnique?: boolean}>,
) {
const shadowNode = getNativeNodeReference(node);
NativeFantom.enqueueNativeEvent(
@@ -341,8 +341,8 @@ export function enqueueNativeEvent(
export function dispatchNativeEvent(
node: ReactNativeElement,
type: string,
payload?: {[key: string]: mixed},
options?: {category?: NativeEventCategory, isUnique?: boolean},
payload?: $ReadOnly<{[key: string]: mixed}>,
options?: $ReadOnly<{category?: NativeEventCategory, isUnique?: boolean}>,
) {
runOnUIThread(() => {
enqueueNativeEvent(node, type, payload, options);
@@ -474,7 +474,7 @@ export function scrollTo(
*/
export function enqueueModalSizeUpdate(
node: ReactNativeElement,
size: {width: number, height: number},
size: $ReadOnly<{width: number, height: number}>,
) {
const shadowNode = getNativeNodeReference(node);
NativeFantom.enqueueModalSizeUpdate(shadowNode, size.width, size.height);