Enable React Native strict TypeScript API (#11459)

This commit is contained in:
Samuel Newman
2026-08-25 09:40:14 +03:00
committed by GitHub
parent 5f3d24efab
commit f87fdd2ea2
149 changed files with 506 additions and 623 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export function DraggableScrollView({
style,
...props
}: ComponentPropsWithRef<typeof ScrollView>) {
const {refs} = useDraggableScroll<ScrollView>({
const {refs} = useDraggableScroll<React.ComponentRef<typeof ScrollView>>({
outerRef: ref,
cursor: 'grab', // optional, default
})
+5 -3
View File
@@ -31,7 +31,9 @@ import {TabBar} from './TabBar'
export interface PagerWithHeaderChildParams {
headerHeight: number
isFocused: boolean
scrollElRef: React.MutableRefObject<ListMethods | ScrollView | null>
scrollElRef: React.MutableRefObject<
ListMethods | React.ComponentRef<typeof ScrollView> | null
>
}
export interface PagerWithHeaderProps {
@@ -269,7 +271,7 @@ let PagerTabBar = ({
],
}
})
const headerRef = useRef<View>(null)
const headerRef = useRef<React.ComponentRef<typeof View>>(null)
const fallbackHeaderOnlyHeight = useRef(0)
return (
<Animated.View
@@ -378,7 +380,7 @@ function PagerItem({
headerHeight,
isFocused,
scrollElRef: scrollElRef as React.MutableRefObject<
ListMethods | ScrollView | null
ListMethods | React.ComponentRef<typeof ScrollView> | null
>,
})}
</ScrollProvider>
+4 -2
View File
@@ -16,7 +16,9 @@ import {TabBar} from './TabBar'
export interface PagerWithHeaderChildParams {
headerHeight: number
isFocused: boolean
scrollElRef: React.MutableRefObject<ListMethods | ScrollView | null>
scrollElRef: React.MutableRefObject<
ListMethods | React.ComponentRef<typeof ScrollView> | null
>
}
export interface PagerWithHeaderProps {
@@ -180,7 +182,7 @@ function PagerItem({
headerHeight: 0,
isFocused,
scrollElRef: scrollElRef as React.MutableRefObject<
ListMethods | ScrollView | null
ListMethods | React.ComponentRef<typeof ScrollView> | null
>,
})
}
+3 -2
View File
@@ -38,7 +38,7 @@ export function TabBar({
onPressSelected,
}: TabBarProps) {
const t = useTheme()
const scrollElRef = useRef<ScrollView>(null)
const scrollElRef = useRef<React.ComponentRef<typeof ScrollView>>(null)
const itemRefs = useRef<Array<Element>>([])
const {gtMobile} = useBreakpoints()
const styles = gtMobile ? desktopStyles : mobileStyles
@@ -47,7 +47,8 @@ export function TabBar({
// On the web, the primary interaction is tapping.
// Scrolling under tap feels disorienting so only adjust the scroll offset
// when tapping on an item out of view--and we adjust by almost an entire page.
const parent = scrollElRef?.current?.getScrollableNode?.()
const parent = scrollElRef.current?.getScrollableNode?.() as unknown as
HTMLElement | undefined
if (!parent) {
return
}