Replace $FlowFixMe in ScrollView (#48857)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48857

Changelog:
[General][Changed] - Improved types in ScrollView

Reviewed By: huntie

Differential Revision: D68496037

fbshipit-source-id: b044e884fb78bb92c0da5acd7570a87ff328a479
This commit is contained in:
Dawid Małecki
2025-01-22 10:00:50 -08:00
committed by Facebook GitHub Bot
parent 0e5adb9128
commit 1be2ba4597
2 changed files with 20 additions and 11 deletions
@@ -712,9 +712,11 @@ class ScrollView extends React.Component<Props, State> {
_scrollAnimatedValue: AnimatedImplementation.Value;
_scrollAnimatedValueAttachment: ?{detach: () => void, ...} = null;
_stickyHeaderRefs: Map<string, React.ElementRef<StickyHeaderComponentType>> =
new Map();
_headerLayoutYs: Map<string, number> = new Map();
_stickyHeaderRefs: Map<
React.Key,
React.ElementRef<StickyHeaderComponentType>,
> = new Map();
_headerLayoutYs: Map<React.Key, number> = new Map();
_keyboardMetrics: ?KeyboardMetrics = null;
_additionalScrollOffset: number = 0;
@@ -1066,7 +1068,11 @@ class ScrollView extends React.Component<Props, State> {
}
};
_getKeyForIndex(index: $FlowFixMe, childArray: $FlowFixMe): $FlowFixMe {
_getKeyForIndex(
index: number,
// $FlowFixMe[unclear-type] - The children and its key is unknown.
childArray: any,
): React.Key {
const child = childArray[index];
return child && child.key;
}
@@ -1099,7 +1105,7 @@ class ScrollView extends React.Component<Props, State> {
}
}
_onStickyHeaderLayout(index: $FlowFixMe, event: $FlowFixMe, key: $FlowFixMe) {
_onStickyHeaderLayout(index: number, event: LayoutEvent, key: React.Key) {
const {stickyHeaderIndices} = this.props;
if (!stickyHeaderIndices) {
return;
@@ -2154,8 +2154,11 @@ declare class ScrollView extends React.Component<Props, State> {
constructor(props: Props): void;
_scrollAnimatedValue: AnimatedImplementation.Value;
_scrollAnimatedValueAttachment: ?{ detach: () => void, ... };
_stickyHeaderRefs: Map<string, React.ElementRef<StickyHeaderComponentType>>;
_headerLayoutYs: Map<string, number>;
_stickyHeaderRefs: Map<
React.Key,
React.ElementRef<StickyHeaderComponentType>,
>;
_headerLayoutYs: Map<React.Key, number>;
_keyboardMetrics: ?KeyboardMetrics;
_additionalScrollOffset: number;
_isTouching: boolean;
@@ -2214,16 +2217,16 @@ declare class ScrollView extends React.Component<Props, State> {
width: number,
height: number
) => void;
_getKeyForIndex(index: $FlowFixMe, childArray: $FlowFixMe): $FlowFixMe;
_getKeyForIndex(index: number, childArray: any): React.Key;
_updateAnimatedNodeAttachment(): void;
_setStickyHeaderRef(
key: string,
ref: ?React.ElementRef<StickyHeaderComponentType>
): void;
_onStickyHeaderLayout(
index: $FlowFixMe,
event: $FlowFixMe,
key: $FlowFixMe
index: number,
event: LayoutEvent,
key: React.Key
): void;
_handleScroll: $FlowFixMe;
_handleLayout: $FlowFixMe;