From 45a9279c2ee0821f369bd75f7fa07b41e2fedef9 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Fri, 4 Apr 2025 16:15:42 -0700 Subject: [PATCH] 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 --- packages/react-native-fantom/src/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-native-fantom/src/index.js b/packages/react-native-fantom/src/index.js index 3f323ba2abe..9eb23683c47 100644 --- a/packages/react-native-fantom/src/index.js +++ b/packages/react-native-fantom/src/index.js @@ -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);