Hack together some types

This commit is contained in:
Dan Abramov
2023-11-10 04:06:06 +00:00
parent ace173c518
commit 79774e67d5
3 changed files with 41 additions and 13 deletions
+8 -2
View File
@@ -1,5 +1,11 @@
import * as React from 'react'
import {LayoutChangeEvent, StyleSheet, View} from 'react-native'
import {
FlatList,
LayoutChangeEvent,
ScrollView,
StyleSheet,
View,
} from 'react-native'
import Animated, {
useAnimatedReaction,
useAnimatedScrollHandler,
@@ -18,7 +24,7 @@ interface PagerWithHeaderChildParams {
headerHeight: number
onScroll: OnScrollCb
isScrolledDown: boolean
scrollElRef: any /* TODO */
scrollElRef: React.MutableRefObject<FlatList<any> | ScrollView | null>
}
export interface PagerWithHeaderProps {
+15 -5
View File
@@ -1,5 +1,11 @@
import React, {useMemo, useCallback} from 'react'
import {Dimensions, StyleSheet, View, ActivityIndicator} from 'react-native'
import {
Dimensions,
StyleSheet,
View,
ActivityIndicator,
FlatList,
} from 'react-native'
import {NativeStackScreenProps} from '@react-navigation/native-stack'
import {useNavigation} from '@react-navigation/native'
import {usePalette} from 'lib/hooks/usePalette'
@@ -349,7 +355,9 @@ export const ProfileFeedScreenInner = observer(
onScroll={onScroll}
headerHeight={headerHeight}
isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/>
)}
{({onScroll, headerHeight, scrollElRef}) => (
@@ -360,7 +368,9 @@ export const ProfileFeedScreenInner = observer(
headerHeight={headerHeight}
onToggleLiked={onToggleLiked}
onScroll={onScroll}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<ScrollView | null>
}
/>
)}
</PagerWithHeader>
@@ -388,7 +398,7 @@ interface FeedSectionProps {
onScroll: OnScrollCb
headerHeight: number
isScrolledDown: boolean
scrollElRef: any /* TODO */
scrollElRef: React.MutableRefObject<FlatList<any> | null>
}
const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
function FeedSectionImpl(
@@ -447,7 +457,7 @@ const AboutSection = observer(function AboutPageImpl({
headerHeight: number
onToggleLiked: () => void
onScroll: OnScrollCb
scrollElRef: any /* TODO */
scrollElRef: React.MutableRefObject<ScrollView | null>
}) {
const pal = usePalette('default')
const {_} = useLingui()
+18 -6
View File
@@ -1,5 +1,11 @@
import React, {useCallback, useMemo} from 'react'
import {ActivityIndicator, Pressable, StyleSheet, View} from 'react-native'
import {
ActivityIndicator,
FlatList,
Pressable,
StyleSheet,
View,
} from 'react-native'
import {useFocusEffect} from '@react-navigation/native'
import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types'
import {useNavigation} from '@react-navigation/native'
@@ -172,7 +178,9 @@ export const ProfileListScreenInner = observer(
{({onScroll, headerHeight, isScrolledDown, scrollElRef}) => (
<FeedSection
ref={feedSectionRef}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
feed={feed}
onScroll={onScroll}
headerHeight={headerHeight}
@@ -182,7 +190,9 @@ export const ProfileListScreenInner = observer(
{({onScroll, headerHeight, isScrolledDown, scrollElRef}) => (
<AboutSection
ref={aboutSectionRef}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
list={list}
descriptionRT={list.descriptionRT}
creator={list.data ? list.data.creator : undefined}
@@ -222,7 +232,9 @@ export const ProfileListScreenInner = observer(
{({onScroll, headerHeight, isScrolledDown, scrollElRef}) => (
<AboutSection
list={list}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
descriptionRT={list.descriptionRT}
creator={list.data ? list.data.creator : undefined}
isCurateList={list.isCuratelist}
@@ -554,7 +566,7 @@ interface FeedSectionProps {
onScroll: OnScrollCb
headerHeight: number
isScrolledDown: boolean
scrollElRef: any /* TODO */
scrollElRef: React.MutableRefObject<FlatList<any> | null>
}
const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
function FeedSectionImpl(
@@ -608,7 +620,7 @@ interface AboutSectionProps {
onScroll: OnScrollCb
headerHeight: number
isScrolledDown: boolean
scrollElRef: any /* TODO */
scrollElRef: React.MutableRefObject<FlatList<any> | null>
}
const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>(
function AboutSectionImpl(