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:
Родитель
ce8440c77c
Коммит
62fcb4e22c
|
@ -373,6 +373,8 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
||||||
| ?React.ElementRef<typeof View>
|
| ?React.ElementRef<typeof View>
|
||||||
| ?React.ElementRef<ScrollViewNativeComponent> {
|
| ?React.ElementRef<ScrollViewNativeComponent> {
|
||||||
if (this._listRef) {
|
if (this._listRef) {
|
||||||
|
/* $FlowFixMe[incompatible-return] Suppresses errors found when fixing
|
||||||
|
* TextInput typing */
|
||||||
return this._listRef.getScrollRef();
|
return this._listRef.getScrollRef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ export type PartialViewConfig = $ReadOnly<{
|
||||||
validAttributes?: PartialAttributeConfiguration,
|
validAttributes?: PartialAttributeConfiguration,
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type NativeMethods = {
|
export type NativeMethods = {|
|
||||||
blur(): void,
|
blur(): void,
|
||||||
focus(): void,
|
focus(): void,
|
||||||
measure(callback: MeasureOnSuccessCallback): void,
|
measure(callback: MeasureOnSuccessCallback): void,
|
||||||
|
@ -110,8 +110,7 @@ export type NativeMethods = {
|
||||||
onFail?: () => void,
|
onFail?: () => void,
|
||||||
): void,
|
): void,
|
||||||
setNativeProps(nativeProps: {...}): void,
|
setNativeProps(nativeProps: {...}): void,
|
||||||
...
|
|};
|
||||||
};
|
|
||||||
|
|
||||||
export type HostComponent<T> = AbstractComponent<T, $ReadOnly<NativeMethods>>;
|
export type HostComponent<T> = AbstractComponent<T, $ReadOnly<NativeMethods>>;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче