tooot/src/screens/Local.tsx

55 lines
1.8 KiB
TypeScript
Raw Normal View History

2021-01-26 12:17:25 +01:00
import analytics from '@components/analytics'
import { HeaderCenter, HeaderRight } from '@components/Header'
import Timeline from '@components/Timelines/Timeline'
import { useNavigation } from '@react-navigation/native'
import { getLocalActiveIndex } from '@utils/slices/instancesSlice'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import { createNativeStackNavigator } from 'react-native-screens/native-stack'
import { useSelector } from 'react-redux'
import sharedScreens from './Shared/sharedScreens'
const Stack = createNativeStackNavigator<Nav.LocalStackParamList>()
2020-10-24 16:44:32 +02:00
2021-01-22 01:34:20 +01:00
const ScreenLocal = React.memo(
() => {
2021-01-26 12:17:25 +01:00
const { t } = useTranslation('local')
const navigation = useNavigation()
const localActiveIndex = useSelector(getLocalActiveIndex)
const onPressSearch = useCallback(() => {
analytics('search_tap', { page: 'Local' })
navigation.navigate('Screen-Local', { screen: 'Screen-Shared-Search' })
}, [])
return (
2021-01-27 00:35:34 +01:00
<Stack.Navigator
2021-01-26 12:17:25 +01:00
screenOptions={{
headerLeft: () => null,
headerRight: () => (
<HeaderRight content='Search' onPress={onPressSearch} />
),
headerTitle: t('heading'),
...(Platform.OS === 'android' && {
headerCenter: () => <HeaderCenter content={t('heading')} />
}),
headerHideShadow: true,
headerTopInsetEnabled: false
}}
>
<Stack.Screen name='Screen-Local-Root'>
{() =>
localActiveIndex !== null ? <Timeline page='Following' /> : null
}
</Stack.Screen>
{sharedScreens(Stack as any)}
</Stack.Navigator>
)
2021-01-22 01:34:20 +01:00
},
() => true
)
2020-10-31 21:04:46 +01:00
2020-11-21 13:19:05 +01:00
export default ScreenLocal