Skip to content

Commit

Permalink
Sync ReactNativeTypes from React Native (#21015)
Browse files Browse the repository at this point in the history
  • Loading branch information
yungsters committed Mar 16, 2021
1 parent f8979e0 commit c9f6d0a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/react-native-renderer/src/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function findHostInstance_DEPRECATED<TElementType: ElementType>(
// Fabric
return (hostInstance: any).canonical;
}
// $FlowFixMe[incompatible-return]
return hostInstance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@ class ReactNativeFiberHostComponent {
}

// eslint-disable-next-line no-unused-expressions
(ReactNativeFiberHostComponent.prototype: NativeMethods);
(ReactNativeFiberHostComponent.prototype: $ReadOnly<{...NativeMethods, ...}>);

export default ReactNativeFiberHostComponent;
1 change: 1 addition & 0 deletions packages/react-native-renderer/src/ReactNativeRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function findHostInstance_DEPRECATED(
// Fabric
return (hostInstance: any).canonical;
}
// $FlowFixMe[incompatible-return]
return hostInstance;
}

Expand Down
5 changes: 2 additions & 3 deletions packages/react-native-renderer/src/ReactNativeTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -105,8 +105,7 @@ export type NativeMethods = {
onFail?: () => void,
): void,
setNativeProps(nativeProps: {...}): void,
...
};
|}>;

export type HostComponent<T> = AbstractComponent<T, $ReadOnly<NativeMethods>>;

Expand Down

0 comments on commit c9f6d0a

Please sign in to comment.