mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fix #595
This commit is contained in:
@ -2,13 +2,11 @@ import GracefullyImage from '@components/GracefullyImage'
|
||||
import haptics from '@components/haptics'
|
||||
import Icon from '@components/Icon'
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
|
||||
import { useAppDispatch } from '@root/store'
|
||||
import { RootStackScreenProps, ScreenTabsStackParamList } from '@utils/navigation/navigators'
|
||||
import { getVersionUpdate, retrieveVersionLatest } from '@utils/slices/appSlice'
|
||||
import { getPreviousTab } from '@utils/slices/contextsSlice'
|
||||
import { getInstanceAccount, getInstanceActive } from '@utils/slices/instancesSlice'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import React, { useCallback, useEffect, useMemo } from 'react'
|
||||
import React, { useCallback, useMemo } from 'react'
|
||||
import { Platform } from 'react-native'
|
||||
import { useSelector } from 'react-redux'
|
||||
import TabLocal from './Tabs/Local'
|
||||
@ -55,17 +53,6 @@ const ScreenTabs = React.memo(
|
||||
|
||||
const previousTab = useSelector(getPreviousTab, () => true)
|
||||
|
||||
const versionUpdate = useSelector(getVersionUpdate)
|
||||
const dispatch = useAppDispatch()
|
||||
useEffect(() => {
|
||||
dispatch(retrieveVersionLatest())
|
||||
}, [])
|
||||
const tabMeOptions = useMemo(() => {
|
||||
if (versionUpdate) {
|
||||
return { tabBarBadge: 1 }
|
||||
}
|
||||
}, [versionUpdate])
|
||||
|
||||
return (
|
||||
<Tab.Navigator
|
||||
initialRouteName={instanceActive !== -1 ? previousTab : 'Tab-Me'}
|
||||
@ -121,12 +108,7 @@ const ScreenTabs = React.memo(
|
||||
<Tab.Screen name='Tab-Public' component={TabPublic} />
|
||||
<Tab.Screen name='Tab-Compose' component={composeComponent} listeners={composeListeners} />
|
||||
<Tab.Screen name='Tab-Notifications' component={TabNotifications} />
|
||||
<Tab.Screen
|
||||
name='Tab-Me'
|
||||
component={TabMe}
|
||||
options={tabMeOptions}
|
||||
listeners={meListeners}
|
||||
/>
|
||||
<Tab.Screen name='Tab-Me' component={TabMe} listeners={meListeners} />
|
||||
</Tab.Navigator>
|
||||
)
|
||||
},
|
||||
|
@ -12,12 +12,8 @@ import accountReducer from '@screens/Tabs/Shared/Account/utils/reducer'
|
||||
import { useProfileQuery } from '@utils/queryHooks/profile'
|
||||
import { getInstanceActive } from '@utils/slices/instancesSlice'
|
||||
import React, { useReducer, useRef } from 'react'
|
||||
import Animated, {
|
||||
useAnimatedScrollHandler,
|
||||
useSharedValue
|
||||
} from 'react-native-reanimated'
|
||||
import Animated, { useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated'
|
||||
import { useSelector } from 'react-redux'
|
||||
import Update from './Root/Update'
|
||||
|
||||
const TabMeRoot: React.FC = () => {
|
||||
const instanceActive = useSelector(getInstanceActive)
|
||||
@ -29,10 +25,7 @@ const TabMeRoot: React.FC = () => {
|
||||
const scrollRef = useRef<Animated.ScrollView>(null)
|
||||
useScrollToTop(scrollRef)
|
||||
|
||||
const [accountState, accountDispatch] = useReducer(
|
||||
accountReducer,
|
||||
accountInitialState
|
||||
)
|
||||
const [accountState, accountDispatch] = useReducer(accountReducer, accountInitialState)
|
||||
|
||||
const scrollY = useSharedValue(0)
|
||||
const onScroll = useAnimatedScrollHandler(event => {
|
||||
@ -41,22 +34,15 @@ const TabMeRoot: React.FC = () => {
|
||||
|
||||
return (
|
||||
<AccountContext.Provider value={{ accountState, accountDispatch }}>
|
||||
{instanceActive !== -1 && data ? (
|
||||
<AccountNav scrollY={scrollY} account={data} />
|
||||
) : null}
|
||||
{instanceActive !== -1 && data ? <AccountNav scrollY={scrollY} account={data} /> : null}
|
||||
<Animated.ScrollView
|
||||
ref={scrollRef}
|
||||
keyboardShouldPersistTaps='handled'
|
||||
onScroll={onScroll}
|
||||
scrollEventThrottle={16}
|
||||
>
|
||||
{instanceActive !== -1 ? (
|
||||
<MyInfo account={data} />
|
||||
) : (
|
||||
<ComponentInstance />
|
||||
)}
|
||||
{instanceActive !== -1 ? <MyInfo account={data} /> : <ComponentInstance />}
|
||||
{instanceActive !== -1 ? <Collections /> : null}
|
||||
<Update />
|
||||
<Settings />
|
||||
{instanceActive !== -1 ? <AccountInformationSwitch /> : null}
|
||||
{instanceActive !== -1 ? <Logout /> : null}
|
||||
|
@ -1,32 +0,0 @@
|
||||
import { MenuContainer, MenuRow } from '@components/Menu'
|
||||
import { getVersionUpdate } from '@utils/slices/appSlice'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Linking, Platform } from 'react-native'
|
||||
import { useSelector } from 'react-redux'
|
||||
|
||||
const Update: React.FC = () => {
|
||||
const { t } = useTranslation('screenTabs')
|
||||
|
||||
const versionUpdate = useSelector(getVersionUpdate)
|
||||
|
||||
return versionUpdate ? (
|
||||
<MenuContainer>
|
||||
<MenuRow
|
||||
iconFront='ChevronsUp'
|
||||
iconBack='ExternalLink'
|
||||
title={t('me.root.update.title')}
|
||||
badge
|
||||
onPress={() => {
|
||||
if (Platform.OS === 'ios') {
|
||||
Linking.openURL('itms-appss://itunes.apple.com/app/id1549772269')
|
||||
} else {
|
||||
Linking.openURL('https://tooot.app')
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</MenuContainer>
|
||||
) : null
|
||||
}
|
||||
|
||||
export default Update
|
Reference in New Issue
Block a user