Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some type errors #1952

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/view/com/modals/ChangeEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ export function Component() {
<Button
testID="cancelBtn"
type="default"
onPress={() => closeModal()}
onPress={() => {
closeModal()
}}
accessibilityLabel={_(msg`Cancel`)}
accessibilityHint=""
label={_(msg`Cancel`)}
Expand Down
4 changes: 3 additions & 1 deletion src/view/com/modals/LinkWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export function Component({text, href}: {text: string; href: string}) {
<Button
testID="cancelBtn"
type="default"
onPress={() => closeModal()}
onPress={() => {
closeModal()
}}
accessibilityLabel={_(msg`Cancel`)}
accessibilityHint=""
label="Cancel"
Expand Down
4 changes: 3 additions & 1 deletion src/view/com/modals/ListAddRemoveUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export function Component({
<Button
testID="doneBtn"
type="default"
onPress={() => closeModal()}
onPress={() => {
closeModal()
}}
accessibilityLabel={_(msg`Done`)}
accessibilityHint=""
label="Done"
Expand Down
7 changes: 6 additions & 1 deletion src/view/com/modals/ModerationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ export function Component({
{description}
</Text>
<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]}>
Okay
</Text>
Expand Down
4 changes: 3 additions & 1 deletion src/view/com/modals/VerifyEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ export function Component({showReminder}: {showReminder?: boolean}) {
<Button
testID="cancelBtn"
type="default"
onPress={() => closeModal()}
onPress={() => {
closeModal()
}}
accessibilityLabel={
stage === Stages.Reminder ? 'Not right now' : 'Cancel'
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/com/pager/PagerWithHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {OnScrollHandler} from 'lib/hooks/useOnMainScroll'

const SCROLLED_DOWN_LIMIT = 200

interface PagerWithHeaderChildParams {
export interface PagerWithHeaderChildParams {
headerHeight: number
isFocused: boolean
onScroll: OnScrollHandler
Expand Down
30 changes: 21 additions & 9 deletions src/view/screens/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {useLingui} from '@lingui/react'
import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types'
import {withAuthRequired} from 'view/com/auth/withAuthRequired'
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 {Feed} from 'view/com/posts/Feed'
import {ProfileLists} from '../com/lists/ProfileLists'
Expand Down Expand Up @@ -193,7 +193,7 @@ function ProfileScreenLoaded({
}, [openComposer, currentAccount, track, profile])

const onPageSelected = React.useCallback(
i => {
(i: number) => {
setCurrentPage(i)
},
[setCurrentPage],
Expand Down Expand Up @@ -231,7 +231,9 @@ function ProfileScreenLoaded({
headerHeight={headerHeight}
isFocused={isFocused}
isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/>
)}
{({onScroll, headerHeight, isFocused, isScrolledDown, scrollElRef}) => (
Expand All @@ -242,7 +244,9 @@ function ProfileScreenLoaded({
headerHeight={headerHeight}
isFocused={isFocused}
isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/>
)}
{({onScroll, headerHeight, isFocused, isScrolledDown, scrollElRef}) => (
Expand All @@ -253,7 +257,9 @@ function ProfileScreenLoaded({
headerHeight={headerHeight}
isFocused={isFocused}
isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/>
)}
{showLikesTab
Expand All @@ -271,15 +277,19 @@ function ProfileScreenLoaded({
headerHeight={headerHeight}
isFocused={isFocused}
isScrolledDown={isScrolledDown}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
/>
)
: null}
{showFeedsTab
? ({onScroll, headerHeight, isFocused, scrollElRef}) => (
<ProfileFeedgens
did={profile.did}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
onScroll={onScroll}
scrollEventThrottle={1}
headerOffset={headerHeight}
Expand All @@ -291,7 +301,9 @@ function ProfileScreenLoaded({
? ({onScroll, headerHeight, isFocused, scrollElRef}) => (
<ProfileLists
did={profile.did}
scrollElRef={scrollElRef}
scrollElRef={
scrollElRef as React.MutableRefObject<FlatList<any> | null>
}
onScroll={onScroll}
scrollEventThrottle={1}
headerOffset={headerHeight}
Expand All @@ -318,7 +330,7 @@ interface FeedSectionProps {
headerHeight: number
isFocused: boolean
isScrolledDown: boolean
scrollElRef: any /* TODO */
scrollElRef: React.MutableRefObject<FlatList<any> | null>
}
const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
function FeedSectionImpl(
Expand Down
Loading