1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
Files
tooot/src/screens/Tabs/Me/List/List.tsx
2023-01-04 22:39:29 +01:00

40 lines
1.1 KiB
TypeScript

import { HeaderRight } from '@components/Header'
import { MenuContainer, MenuRow } from '@components/Menu'
import { TabMeStackScreenProps } from '@utils/navigation/navigators'
import { useListsQuery } from '@utils/queryHooks/lists'
import React, { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
const TabMeListList: React.FC<TabMeStackScreenProps<'Tab-Me-List-List'>> = ({ navigation }) => {
const { data } = useListsQuery({})
const { t } = useTranslation()
useEffect(() => {
navigation.setOptions({
headerRight: () => (
<HeaderRight
type='text'
content={t('buttons.create')}
onPress={() => navigation.navigate('Tab-Me-List-Edit', { type: 'add' })}
/>
)
})
}, [])
return (
<MenuContainer>
{data?.map((list, index) => (
<MenuRow
key={index}
iconFront='List'
iconBack='ChevronRight'
title={list.title}
onPress={() => navigation.navigate('Tab-Me-List', { list })}
/>
))}
</MenuContainer>
)
}
export default TabMeListList