Commit 9a72a5c
authored
## Description
This PR fixes 2 type issues that were reported via private channel:
1. Type 'FlatList' is not generic
2. Type 'Ref<ScrollView>' is not assignable to type
'RefObject<ScrollView | null> | undefined'
## Test plan
`yarn ts-check`
<details>
<summary>Tested on the following code</summary>
```tsx
import React, { forwardRef, useEffect, useRef } from 'react';
import { Text } from 'react-native';
import {
FlatList,
GestureHandlerRootView,
ScrollView,
} from 'react-native-gesture-handler';
interface MyComponentProps {
title: string;
}
const MyCustomScrollView = forwardRef<ScrollView, MyComponentProps>(
(props, ref) => {
return (
<ScrollView ref={ref} style={{ flex: 1 }}>
<Text>{props.title}</Text>
</ScrollView>
);
}
);
export default function App() {
const scrollViewRef = useRef<ScrollView>(null);
const flatListRef = useRef<FlatList<number>>(null);
useEffect(() => {
setTimeout(() => {
console.log(scrollViewRef, flatListRef);
}, 1000);
});
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<MyCustomScrollView ref={scrollViewRef} title="Hello, World!" />
</GestureHandlerRootView>
);
}
```
</details>
1 parent 6b2d59d commit 9a72a5c
2 files changed
Lines changed: 2 additions & 2 deletions
File tree
- packages/react-native-gesture-handler/src/v3
- components
- types
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments