mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fix ts warnings
This commit is contained in:
10
src/App.tsx
10
src/App.tsx
@ -18,16 +18,15 @@ import ThemeManager from '@utils/styles/ThemeManager'
|
||||
import * as Localization from 'expo-localization'
|
||||
import * as SplashScreen from 'expo-splash-screen'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import { LogBox, Platform } from 'react-native'
|
||||
import { Platform } from 'react-native'
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
||||
import { SafeAreaProvider } from 'react-native-safe-area-context'
|
||||
import { enableFreeze } from 'react-native-screens'
|
||||
import i18n from './i18n'
|
||||
import Screens from './screens'
|
||||
|
||||
Platform.select({
|
||||
android: LogBox.ignoreLogs(['Setting a timer for a long period of time'])
|
||||
})
|
||||
log('log', 'App', 'delay splash')
|
||||
SplashScreen.preventAutoHideAsync()
|
||||
|
||||
dev()
|
||||
sentry()
|
||||
@ -36,9 +35,6 @@ audio()
|
||||
push()
|
||||
enableFreeze(true)
|
||||
|
||||
log('log', 'App', 'delay splash')
|
||||
SplashScreen.preventAutoHideAsync()
|
||||
|
||||
const App: React.FC = () => {
|
||||
log('log', 'App', 'rendering App')
|
||||
const [appIsReady, setAppIsReady] = useState(false)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import React, { forwardRef, RefObject } from 'react'
|
||||
import React, { ForwardedRef, forwardRef } from 'react'
|
||||
import { Platform, TextInput, TextInputProps, View } from 'react-native'
|
||||
import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated'
|
||||
import { EmojisState } from './Emojis/Context'
|
||||
@ -35,7 +35,7 @@ const ComponentInput = forwardRef(
|
||||
isFocused,
|
||||
...props
|
||||
}: Props,
|
||||
ref: RefObject<TextInput>
|
||||
ref: ForwardedRef<TextInput>
|
||||
) => {
|
||||
const { colors, mode } = useTheme()
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { useHeaderHeight } from '@react-navigation/elements'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { forwardRef, PropsWithChildren, RefObject } from 'react'
|
||||
import { ForwardedRef, forwardRef, PropsWithChildren } from 'react'
|
||||
import { KeyboardAvoidingView, Platform, ScrollView } from 'react-native'
|
||||
import { SafeAreaView } from 'react-native-safe-area-context'
|
||||
|
||||
export const ModalScrollView = forwardRef(
|
||||
({ children }: PropsWithChildren, ref: RefObject<ScrollView>) => {
|
||||
({ children }: PropsWithChildren, ref: ForwardedRef<ScrollView>) => {
|
||||
const headerHeight = useHeaderHeight()
|
||||
|
||||
return (
|
||||
|
@ -177,7 +177,7 @@ const TimelineRefresh: React.FC<Props> = ({
|
||||
flRef.current?.scrollToOffset({ offset: scrollY.value - 15, animated: true })
|
||||
}
|
||||
|
||||
await new Promise(promise => setTimeout(promise, 64))
|
||||
await new Promise<void>(promise => setTimeout(promise, 64))
|
||||
queryClient.setQueryData<
|
||||
InfiniteData<
|
||||
PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]>
|
||||
|
@ -103,7 +103,7 @@ const TimelineActions: React.FC = () => {
|
||||
cancelButtonIndex: 2,
|
||||
...androidActionSheetStyles(colors)
|
||||
},
|
||||
(selectedIndex: number) => {
|
||||
selectedIndex => {
|
||||
switch (selectedIndex) {
|
||||
case 0:
|
||||
mutation.mutate({
|
||||
|
@ -129,7 +129,7 @@ const chooseAndUploadAttachment = async ({
|
||||
for (const media of result) {
|
||||
const requiredMedia = media as Required<Asset>
|
||||
uploadAttachment({ composeDispatch, media: requiredMedia })
|
||||
await new Promise(res => setTimeout(res, 500))
|
||||
await new Promise<void>(res => setTimeout(res, 500))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { HeaderRight } from '@components/Header'
|
||||
import Timeline from '@components/Timeline'
|
||||
import SegmentedControl from '@react-native-community/segmented-control'
|
||||
import SegmentedControl from '@react-native-segmented-control/segmented-control'
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { TabPublicStackParamList } from '@utils/navigation/navigators'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
@ -49,11 +49,12 @@ const Root: React.FC<NativeStackScreenProps<TabPublicStackParamList, 'Tab-Public
|
||||
useEffect(() => {
|
||||
navigation.setOptions({
|
||||
headerTitle: () => (
|
||||
// @ts-ignore
|
||||
<SegmentedControl
|
||||
appearance={mode}
|
||||
values={routes.map(({ title }) => title)}
|
||||
selectedIndex={segment}
|
||||
onChange={({ nativeEvent }) => {
|
||||
onChange={({ nativeEvent }: any) => {
|
||||
setSegment(nativeEvent.selectedSegmentIndex)
|
||||
setGlobalStorage('app.prev_public_segment', segments[nativeEvent.selectedSegmentIndex])
|
||||
}}
|
||||
|
@ -3,7 +3,7 @@ import menuShare from '@components/contextMenu/share'
|
||||
import { HeaderLeft, HeaderRight } from '@components/Header'
|
||||
import Timeline from '@components/Timeline'
|
||||
import TimelineDefault from '@components/Timeline/Default'
|
||||
import SegmentedControl from '@react-native-community/segmented-control'
|
||||
import SegmentedControl from '@react-native-segmented-control/segmented-control'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { TabSharedStackScreenProps } from '@utils/navigation/navigators'
|
||||
import { useAccountQuery } from '@utils/queryHooks/account'
|
||||
@ -182,11 +182,12 @@ const TabSharedAccount: React.FC<TabSharedStackScreenProps<'Tab-Shared-Account'>
|
||||
<AccountAttachments />
|
||||
</View>
|
||||
{!data?.suspended ? (
|
||||
// @ts-ignore
|
||||
<SegmentedControl
|
||||
appearance={mode}
|
||||
values={[t('shared.account.toots.default'), t('shared.account.toots.all')]}
|
||||
selectedIndex={segment}
|
||||
onChange={({ nativeEvent }) => {
|
||||
onChange={({ nativeEvent }: any) => {
|
||||
setSegment(nativeEvent.selectedSegmentIndex)
|
||||
switch (nativeEvent.selectedSegmentIndex) {
|
||||
case 0:
|
||||
|
@ -85,7 +85,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
for (let [] of Array(
|
||||
Math.ceil(ancestorsCache.current.length / PREV_PER_BATCH)
|
||||
).entries()) {
|
||||
await new Promise(promise => setTimeout(promise, 64))
|
||||
await new Promise<void>(promise => setTimeout(promise, 64))
|
||||
queryClient.setQueryData<{ pages: { body: Mastodon.Status[] }[] }>(
|
||||
queryKey.local,
|
||||
old => {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
||||
import TabSharedAccount from '@screens/Tabs/Shared/Account'
|
||||
import TabSharedAccountInLists from '@screens/Tabs/Shared/AccountInLists'
|
||||
import TabSharedAttachments from '@screens/Tabs/Shared/Attachments'
|
||||
@ -11,7 +10,7 @@ import TabSharedUsers from '@screens/Tabs/Shared/Users'
|
||||
import React from 'react'
|
||||
import TabSharedFilter from './Filter'
|
||||
|
||||
const TabShared = ({ Stack }: { Stack: ReturnType<typeof createNativeStackNavigator> }) => {
|
||||
const TabShared = ({ Stack }: { Stack: any }) => {
|
||||
return (
|
||||
<Stack.Group>
|
||||
<Stack.Screen
|
||||
|
@ -1,3 +1,3 @@
|
||||
import { AccountV0 } from "./v0";
|
||||
|
||||
export { AccountV0 as StorageAccount }
|
||||
export type { AccountV0 as StorageAccount }
|
||||
|
@ -1,3 +1,3 @@
|
||||
import { GlobalV0 } from "./v0";
|
||||
import { GlobalV0 } from './v0'
|
||||
|
||||
export { GlobalV0 as StorageGlobal }
|
||||
export type { GlobalV0 as StorageGlobal }
|
||||
|
@ -11,7 +11,6 @@ export const versionStorageGlobal = storage.global.getNumber('version.global')
|
||||
|
||||
export async function migrateFromAsyncStorage(): Promise<void> {
|
||||
log('log', 'Migration', 'Migrating...')
|
||||
const start = global.performance.now()
|
||||
|
||||
const unwrapPushData = (setting: { value: boolean } | boolean | undefined): boolean =>
|
||||
typeof setting === 'object' ? setting.value : typeof setting === 'boolean' ? setting : true
|
||||
@ -176,6 +175,5 @@ export async function migrateFromAsyncStorage(): Promise<void> {
|
||||
|
||||
storage.global.set('version.global', 0)
|
||||
|
||||
const end = global.performance.now()
|
||||
log('log', 'Migration', `Migrated in ${end - start}ms`)
|
||||
log('log', 'Migration', 'Migrated')
|
||||
}
|
||||
|
Reference in New Issue
Block a user