From 9cf023012362bba431959513ddf466a3e9cec3e9 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Mon, 15 Mar 2021 22:11:55 -0700 Subject: [PATCH] Sync `ReactNativeTypes` from React Native --- packages/react-native-renderer/src/ReactFabric.js | 1 + packages/react-native-renderer/src/ReactFabricHostConfig.js | 2 +- .../src/ReactNativeFiberHostComponent.js | 2 +- packages/react-native-renderer/src/ReactNativeRenderer.js | 1 + packages/react-native-renderer/src/ReactNativeTypes.js | 5 ++--- 5 files changed, 6 insertions(+), 5 deletions(-) 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>;