mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fixed Flow typing of TextInput refs
Summary: `React.ElementRef<HostComponent<mixed>>` is an inexact object type, which can not be spread into an exact object type, as is happening here. This error is masked in types-first mode, but causes the instance type of this component to be `any`. In a future version of Flow, this issue will be fixed, so this change unblocks upgrading Flow. This change is likely to cause code using `TextInput` refs to find errors which were missed before. Changelog: [General][Fixed] - Fixed Flow typing of TextInput refs Reviewed By: yungsters Differential Revision: D26733314 fbshipit-source-id: 8aa26ce5b49357b279f76dd1767a17a9fb4dd4f1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ce8440c77c
commit
62fcb4e22c
@@ -373,6 +373,8 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
||||
| ?React.ElementRef<typeof View>
|
||||
| ?React.ElementRef<ScrollViewNativeComponent> {
|
||||
if (this._listRef) {
|
||||
/* $FlowFixMe[incompatible-return] Suppresses errors found when fixing
|
||||
* TextInput typing */
|
||||
return this._listRef.getScrollRef();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ export type PartialViewConfig = $ReadOnly<{
|
||||
validAttributes?: PartialAttributeConfiguration,
|
||||
}>;
|
||||
|
||||
export type NativeMethods = {
|
||||
export type NativeMethods = {|
|
||||
blur(): void,
|
||||
focus(): void,
|
||||
measure(callback: MeasureOnSuccessCallback): void,
|
||||
@@ -110,8 +110,7 @@ export type NativeMethods = {
|
||||
onFail?: () => void,
|
||||
): void,
|
||||
setNativeProps(nativeProps: {...}): void,
|
||||
...
|
||||
};
|
||||
|};
|
||||
|
||||
export type HostComponent<T> = AbstractComponent<T, $ReadOnly<NativeMethods>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user