Fix some type errors (#1952)

* Fix some low-hanging type errors

* Override scrollRef types on profile
zio/stable
Eric Bailey 2023-11-17 11:08:45 -06:00 committed by GitHub
parent 6c8f043e37
commit 9c8a1b8a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 15 deletions

View File

@ -212,7 +212,9 @@ export function Component() {
<Button <Button
testID="cancelBtn" testID="cancelBtn"
type="default" type="default"
onPress={() => closeModal()} onPress={() => {
closeModal()
}}
accessibilityLabel={_(msg`Cancel`)} accessibilityLabel={_(msg`Cancel`)}
accessibilityHint="" accessibilityHint=""
label={_(msg`Cancel`)} label={_(msg`Cancel`)}

View File

@ -79,7 +79,9 @@ export function Component({text, href}: {text: string; href: string}) {
<Button <Button
testID="cancelBtn" testID="cancelBtn"
type="default" type="default"
onPress={() => closeModal()} onPress={() => {
closeModal()
}}
accessibilityLabel={_(msg`Cancel`)} accessibilityLabel={_(msg`Cancel`)}
accessibilityHint="" accessibilityHint=""
label="Cancel" label="Cancel"

View File

@ -136,7 +136,9 @@ export function Component({
<Button <Button
testID="doneBtn" testID="doneBtn"
type="default" type="default"
onPress={() => closeModal()} onPress={() => {
closeModal()
}}
accessibilityLabel={_(msg`Done`)} accessibilityLabel={_(msg`Done`)}
accessibilityHint="" accessibilityHint=""
label="Done" label="Done"

View File

@ -99,7 +99,12 @@ export function Component({
{description} {description}
</Text> </Text>
<View style={s.flex1} /> <View style={s.flex1} />
<Button type="primary" style={styles.btn} onPress={() => closeModal()}> <Button
type="primary"
style={styles.btn}
onPress={() => {
closeModal()
}}>
<Text type="button-lg" style={[pal.textLight, s.textCenter, s.white]}> <Text type="button-lg" style={[pal.textLight, s.textCenter, s.white]}>
Okay Okay
</Text> </Text>

View File

@ -224,7 +224,9 @@ export function Component({showReminder}: {showReminder?: boolean}) {
<Button <Button
testID="cancelBtn" testID="cancelBtn"
type="default" type="default"
onPress={() => closeModal()} onPress={() => {
closeModal()
}}
accessibilityLabel={ accessibilityLabel={
stage === Stages.Reminder ? 'Not right now' : 'Cancel' stage === Stages.Reminder ? 'Not right now' : 'Cancel'
} }

View File

@ -22,7 +22,7 @@ import {OnScrollHandler} from 'lib/hooks/useOnMainScroll'
const SCROLLED_DOWN_LIMIT = 200 const SCROLLED_DOWN_LIMIT = 200
interface PagerWithHeaderChildParams { export interface PagerWithHeaderChildParams {
headerHeight: number headerHeight: number
isFocused: boolean isFocused: boolean
onScroll: OnScrollHandler onScroll: OnScrollHandler

View File

@ -7,7 +7,7 @@ import {useLingui} from '@lingui/react'
import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types' import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types'
import {withAuthRequired} from 'view/com/auth/withAuthRequired' import {withAuthRequired} from 'view/com/auth/withAuthRequired'
import {ViewSelectorHandle} from '../com/util/ViewSelector' import {ViewSelectorHandle} from '../com/util/ViewSelector'
import {CenteredView} from '../com/util/Views' import {CenteredView, FlatList} from '../com/util/Views'
import {ScreenHider} from 'view/com/util/moderation/ScreenHider' import {ScreenHider} from 'view/com/util/moderation/ScreenHider'
import {Feed} from 'view/com/posts/Feed' import {Feed} from 'view/com/posts/Feed'
import {ProfileLists} from '../com/lists/ProfileLists' import {ProfileLists} from '../com/lists/ProfileLists'
@ -193,7 +193,7 @@ function ProfileScreenLoaded({
}, [openComposer, currentAccount, track, profile]) }, [openComposer, currentAccount, track, profile])
const onPageSelected = React.useCallback( const onPageSelected = React.useCallback(
i => { (i: number) => {
setCurrentPage(i) setCurrentPage(i)
}, },
[setCurrentPage], [setCurrentPage],
@ -231,7 +231,9 @@ function ProfileScreenLoaded({
headerHeight={headerHeight} headerHeight={headerHeight}
isFocused={isFocused} isFocused={isFocused}
isScrolledDown={isScrolledDown} isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef} scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/> />
)} )}
{({onScroll, headerHeight, isFocused, isScrolledDown, scrollElRef}) => ( {({onScroll, headerHeight, isFocused, isScrolledDown, scrollElRef}) => (
@ -242,7 +244,9 @@ function ProfileScreenLoaded({
headerHeight={headerHeight} headerHeight={headerHeight}
isFocused={isFocused} isFocused={isFocused}
isScrolledDown={isScrolledDown} isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef} scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/> />
)} )}
{({onScroll, headerHeight, isFocused, isScrolledDown, scrollElRef}) => ( {({onScroll, headerHeight, isFocused, isScrolledDown, scrollElRef}) => (
@ -253,7 +257,9 @@ function ProfileScreenLoaded({
headerHeight={headerHeight} headerHeight={headerHeight}
isFocused={isFocused} isFocused={isFocused}
isScrolledDown={isScrolledDown} isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef} scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/> />
)} )}
{showLikesTab {showLikesTab
@ -271,7 +277,9 @@ function ProfileScreenLoaded({
headerHeight={headerHeight} headerHeight={headerHeight}
isFocused={isFocused} isFocused={isFocused}
isScrolledDown={isScrolledDown} isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef} scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/> />
) )
: null} : null}
@ -279,7 +287,9 @@ function ProfileScreenLoaded({
? ({onScroll, headerHeight, isFocused, scrollElRef}) => ( ? ({onScroll, headerHeight, isFocused, scrollElRef}) => (
<ProfileFeedgens <ProfileFeedgens
did={profile.did} did={profile.did}
scrollElRef={scrollElRef} scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
onScroll={onScroll} onScroll={onScroll}
scrollEventThrottle={1} scrollEventThrottle={1}
headerOffset={headerHeight} headerOffset={headerHeight}
@ -291,7 +301,9 @@ function ProfileScreenLoaded({
? ({onScroll, headerHeight, isFocused, scrollElRef}) => ( ? ({onScroll, headerHeight, isFocused, scrollElRef}) => (
<ProfileLists <ProfileLists
did={profile.did} did={profile.did}
scrollElRef={scrollElRef} scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
onScroll={onScroll} onScroll={onScroll}
scrollEventThrottle={1} scrollEventThrottle={1}
headerOffset={headerHeight} headerOffset={headerHeight}
@ -318,7 +330,7 @@ interface FeedSectionProps {
headerHeight: number headerHeight: number
isFocused: boolean isFocused: boolean
isScrolledDown: boolean isScrolledDown: boolean
scrollElRef: any /* TODO */ scrollElRef: React.MutableRefObject<FlatList<any> | null>
} }
const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
function FeedSectionImpl( function FeedSectionImpl(