Sync `ReactNativeTypes` from React Native (#21015)
Timothy Yung committed
Mar 15, 2021 at 23:48 UTC
c9f6d0a3a8ef267fa3499782028fb1c74fae94e9
5 files changed
+6
-5
packages/react-native-renderer/src/ReactFabric.js
+1
@@ -97,6 +97,7 @@ function findHostInstance_DEPRECATED<TElementType: ElementType>(
97
// Fabric
98
return (hostInstance: any).canonical;
99
}
100
+ // $FlowFixMe[incompatible-return]
101
return hostInstance;
102
}
103
packages/react-native-renderer/src/ReactFabricHostConfig.js
+1
-1
@@ -187,7 +187,7 @@ class ReactFabricHostComponent {
187
}
188
189
// eslint-disable-next-line no-unused-expressions
190
-(ReactFabricHostComponent.prototype: NativeMethods);
190
+(ReactFabricHostComponent.prototype: $ReadOnly<{...NativeMethods, ...}>);
191
192
export * from 'react-reconciler/src/ReactFiberHostConfigWithNoMutation';
193
export * from 'react-reconciler/src/ReactFiberHostConfigWithNoHydration';
packages/react-native-renderer/src/ReactNativeFiberHostComponent.js
+1
-1
@@ -127,6 +127,6 @@ class ReactNativeFiberHostComponent {
127
}
128
129
// eslint-disable-next-line no-unused-expressions
130
-(ReactNativeFiberHostComponent.prototype: NativeMethods);
130
+(ReactNativeFiberHostComponent.prototype: $ReadOnly<{...NativeMethods, ...}>);
131
132
export default ReactNativeFiberHostComponent;
packages/react-native-renderer/src/ReactNativeRenderer.js
+1
@@ -96,6 +96,7 @@ function findHostInstance_DEPRECATED(
96
// Fabric
97
return (hostInstance: any).canonical;
98
}
99
+ // $FlowFixMe[incompatible-return]
100
return hostInstance;
101
}
102
packages/react-native-renderer/src/ReactNativeTypes.js
+2
-3
@@ -94,7 +94,7 @@ export type PartialViewConfig = $ReadOnly<{
94
validAttributes?: PartialAttributeConfiguration,
95
}>;
96
97
-export type NativeMethods = {
97
+export type NativeMethods = $ReadOnly<{|
98
blur(): void,
99
focus(): void,
100
measure(callback: MeasureOnSuccessCallback): void,
@@ -105,8 +105,7 @@ export type NativeMethods = {
105
onFail?: () => void,
106
): void,
107
setNativeProps(nativeProps: {...}): void,
108
- ...
109
-};
108
+|}>;
109
110
export type HostComponent<T> = AbstractComponent<T, $ReadOnly<NativeMethods>>;
111