1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

React Navigation v6 first try

Android header needs attention
This commit is contained in:
Zhiyuan Zheng
2021-08-21 01:45:43 +02:00
parent bc72e637bb
commit b821fc4d16
14 changed files with 563 additions and 567 deletions

View File

@ -1,9 +1,9 @@
import { HeaderCenter, HeaderLeft } from '@components/Header'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import { StackScreenProps } from '@react-navigation/stack'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import { createNativeStackNavigator } from 'react-native-screens/native-stack'
import ComposeDraftsListRoot from './DraftsList/Root'
const Stack = createNativeStackNavigator()
@ -37,7 +37,7 @@ const ComposeDraftsList: React.FC<ScreenComposeEditAttachmentProp> = ({
)
return (
<Stack.Navigator screenOptions={{ headerTopInsetEnabled: false }}>
<Stack.Navigator>
<Stack.Screen
name='Screen-Compose-EditAttachment-Root'
children={children}
@ -49,7 +49,7 @@ const ComposeDraftsList: React.FC<ScreenComposeEditAttachmentProp> = ({
<HeaderCenter content={t('content.draftsList.header.title')} />
)
}),
headerHideShadow: true
headerShadowVisible: false
}}
/>
</Stack.Navigator>

View File

@ -1,10 +1,10 @@
import { HeaderCenter, HeaderLeft } from '@components/Header'
import { HeaderLeft } from '@components/Header'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import { StackScreenProps } from '@react-navigation/stack'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { KeyboardAvoidingView, Platform } from 'react-native'
import { SafeAreaView } from 'react-native-safe-area-context'
import { createNativeStackNavigator } from 'react-native-screens/native-stack'
import ComposeEditAttachmentRoot from './EditAttachment/Root'
import ComposeEditAttachmentSubmit from './EditAttachment/Submit'
@ -45,21 +45,14 @@ const ComposeEditAttachment: React.FC<ScreenComposeEditAttachmentProp> = ({
style={{ flex: 1 }}
>
<SafeAreaView style={{ flex: 1 }} edges={['left', 'right', 'bottom']}>
<Stack.Navigator screenOptions={{ headerTopInsetEnabled: false }}>
<Stack.Navigator>
<Stack.Screen
name='Screen-Compose-EditAttachment-Root'
children={children}
options={{
headerLeft,
headerRight: () => <ComposeEditAttachmentSubmit index={index} />,
headerTitle: t('content.editAttachment.header.title'),
...(Platform.OS === 'android' && {
headerCenter: () => (
<HeaderCenter
content={t('content.editAttachment.header.title')}
/>
)
})
headerTitle: t('content.editAttachment.header.title')
}}
/>
</Stack.Navigator>