mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Basic new react-navigation types
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { HeaderCenter, HeaderLeft } from '@components/Header'
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
||||
import { StackScreenProps } from '@react-navigation/stack'
|
||||
import { ScreenComposeStackScreenProps } from '@utils/navigation/navigators'
|
||||
import React, { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Platform } from 'react-native'
|
||||
@ -8,12 +8,9 @@ import ComposeDraftsListRoot from './DraftsList/Root'
|
||||
|
||||
const Stack = createNativeStackNavigator()
|
||||
|
||||
export type ScreenComposeEditAttachmentProp = StackScreenProps<
|
||||
Nav.ScreenComposeStackParamList,
|
||||
const ComposeDraftsList: React.FC<ScreenComposeStackScreenProps<
|
||||
'Screen-Compose-DraftsList'
|
||||
>
|
||||
|
||||
const ComposeDraftsList: React.FC<ScreenComposeEditAttachmentProp> = ({
|
||||
>> = ({
|
||||
route: {
|
||||
params: { timestamp }
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { HeaderLeft } from '@components/Header'
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
||||
import { StackScreenProps } from '@react-navigation/stack'
|
||||
import { ScreenComposeStackScreenProps } from '@utils/navigation/navigators'
|
||||
import React, { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { KeyboardAvoidingView, Platform } from 'react-native'
|
||||
@ -10,12 +10,9 @@ import ComposeEditAttachmentSubmit from './EditAttachment/Submit'
|
||||
|
||||
const Stack = createNativeStackNavigator()
|
||||
|
||||
export type ScreenComposeEditAttachmentProp = StackScreenProps<
|
||||
Nav.ScreenComposeStackParamList,
|
||||
const ComposeEditAttachment: React.FC<ScreenComposeStackScreenProps<
|
||||
'Screen-Compose-EditAttachment'
|
||||
>
|
||||
|
||||
const ComposeEditAttachment: React.FC<ScreenComposeEditAttachmentProp> = ({
|
||||
>> = ({
|
||||
route: {
|
||||
params: { index }
|
||||
},
|
||||
|
@ -15,7 +15,7 @@ export interface Props {
|
||||
|
||||
const ComposeDrafts: React.FC<Props> = ({ accessibleRefDrafts }) => {
|
||||
const { t } = useTranslation('screenCompose')
|
||||
const navigation = useNavigation()
|
||||
const navigation = useNavigation<any>()
|
||||
const { composeState } = useContext(ComposeContext)
|
||||
const instanceDrafts = useSelector(getInstanceDrafts)?.filter(
|
||||
draft => draft.timestamp !== composeState.timestamp
|
||||
|
@ -40,7 +40,7 @@ const ComposeAttachments: React.FC<Props> = ({ accessibleRefAttachments }) => {
|
||||
const { composeState, composeDispatch } = useContext(ComposeContext)
|
||||
const { t } = useTranslation('screenCompose')
|
||||
const { theme } = useTheme()
|
||||
const navigation = useNavigation()
|
||||
const navigation = useNavigation<any>()
|
||||
|
||||
const flatListRef = useRef<FlatList>(null)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { store } from '@root/store'
|
||||
import { RootStackParamList } from '@utils/navigation/navigators'
|
||||
import { getInstanceAccount } from '@utils/slices/instancesSlice'
|
||||
import composeInitialState from './initialState'
|
||||
import { ComposeState } from './types'
|
||||
@ -34,7 +35,7 @@ const assignVisibility = (
|
||||
}
|
||||
|
||||
const composeParseState = (
|
||||
params: NonNullable<Nav.RootStackParamList['Screen-Compose']>
|
||||
params: NonNullable<RootStackParamList['Screen-Compose']>
|
||||
): ComposeState => {
|
||||
switch (params.type) {
|
||||
case 'edit':
|
||||
|
@ -1,9 +1,10 @@
|
||||
import apiInstance from '@api/instance'
|
||||
import { ComposeState } from '@screens/Compose/utils/types'
|
||||
import { RootStackParamList } from '@utils/navigation/navigators'
|
||||
import * as Crypto from 'expo-crypto'
|
||||
|
||||
const composePost = async (
|
||||
params: Nav.RootStackParamList['Screen-Compose'],
|
||||
params: RootStackParamList['Screen-Compose'],
|
||||
composeState: ComposeState
|
||||
) => {
|
||||
const formData = new FormData()
|
||||
|
Reference in New Issue
Block a user