Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync ReactNativeTypes.js from React Native #21015

Merged
merged 1 commit into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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