diff --git a/packages/react-native-renderer/src/ReactFabric.js b/packages/react-native-renderer/src/ReactFabric.js index 82a6cb7e6ba6c..5f797c0dcfa39 100644 --- a/packages/react-native-renderer/src/ReactFabric.js +++ b/packages/react-native-renderer/src/ReactFabric.js @@ -97,6 +97,7 @@ function findHostInstance_DEPRECATED( // Fabric return (hostInstance: any).canonical; } + // $FlowFixMe[incompatible-return] return hostInstance; } diff --git a/packages/react-native-renderer/src/ReactFabricHostConfig.js b/packages/react-native-renderer/src/ReactFabricHostConfig.js index 85eb2a741ffac..736001a853e63 100644 --- a/packages/react-native-renderer/src/ReactFabricHostConfig.js +++ b/packages/react-native-renderer/src/ReactFabricHostConfig.js @@ -187,7 +187,7 @@ class ReactFabricHostComponent { } // eslint-disable-next-line no-unused-expressions -(ReactFabricHostComponent.prototype: NativeMethods); +(ReactFabricHostComponent.prototype: $ReadOnly<{...NativeMethods, ...}>); export * from 'react-reconciler/src/ReactFiberHostConfigWithNoMutation'; export * from 'react-reconciler/src/ReactFiberHostConfigWithNoHydration'; diff --git a/packages/react-native-renderer/src/ReactNativeFiberHostComponent.js b/packages/react-native-renderer/src/ReactNativeFiberHostComponent.js index 8048144431826..b4d91806cf56e 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberHostComponent.js +++ b/packages/react-native-renderer/src/ReactNativeFiberHostComponent.js @@ -127,6 +127,6 @@ class ReactNativeFiberHostComponent { } // eslint-disable-next-line no-unused-expressions -(ReactNativeFiberHostComponent.prototype: NativeMethods); +(ReactNativeFiberHostComponent.prototype: $ReadOnly<{...NativeMethods, ...}>); export default ReactNativeFiberHostComponent; diff --git a/packages/react-native-renderer/src/ReactNativeRenderer.js b/packages/react-native-renderer/src/ReactNativeRenderer.js index 36b9e2b1e2843..1e7b390f9ff38 100644 --- a/packages/react-native-renderer/src/ReactNativeRenderer.js +++ b/packages/react-native-renderer/src/ReactNativeRenderer.js @@ -96,6 +96,7 @@ function findHostInstance_DEPRECATED( // Fabric return (hostInstance: any).canonical; } + // $FlowFixMe[incompatible-return] return hostInstance; } diff --git a/packages/react-native-renderer/src/ReactNativeTypes.js b/packages/react-native-renderer/src/ReactNativeTypes.js index 462abeac94bee..8192371af827e 100644 --- a/packages/react-native-renderer/src/ReactNativeTypes.js +++ b/packages/react-native-renderer/src/ReactNativeTypes.js @@ -94,7 +94,7 @@ export type PartialViewConfig = $ReadOnly<{ validAttributes?: PartialAttributeConfiguration, }>; -export type NativeMethods = { +export type NativeMethods = $ReadOnly<{| blur(): void, focus(): void, measure(callback: MeasureOnSuccessCallback): void, @@ -105,8 +105,7 @@ export type NativeMethods = { onFail?: () => void, ): void, setNativeProps(nativeProps: {...}): void, - ... -}; +|}>; export type HostComponent = AbstractComponent>;