mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Improve account switch hint
This commit is contained in:
@ -2,8 +2,7 @@ import { StyleConstants } from '@utils/styles/constants'
|
|||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import { Fragment } from 'react'
|
import { Fragment } from 'react'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
import { View, ViewStyle } from 'react-native'
|
import { Pressable, View, ViewStyle } from 'react-native'
|
||||||
import { TouchableNativeFeedback } from 'react-native-gesture-handler'
|
|
||||||
import Icon from './Icon'
|
import Icon from './Icon'
|
||||||
import CustomText from './Text'
|
import CustomText from './Text'
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ export const Filter: React.FC<Props> = ({ onPress, filter, button, style }) => {
|
|||||||
const { colors } = useTheme()
|
const { colors } = useTheme()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableNativeFeedback onPress={onPress}>
|
<Pressable onPress={onPress}>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
paddingVertical: StyleConstants.Spacing.S,
|
paddingVertical: StyleConstants.Spacing.S,
|
||||||
@ -106,6 +105,6 @@ export const Filter: React.FC<Props> = ({ onPress, filter, button, style }) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</TouchableNativeFeedback>
|
</Pressable>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { ColorValue, TouchableNativeFeedback, View } from 'react-native'
|
import { ColorValue, Pressable, View } from 'react-native'
|
||||||
import { SwipeListView } from 'react-native-swipe-list-view'
|
import { SwipeListView } from 'react-native-swipe-list-view'
|
||||||
import haptics from './haptics'
|
import haptics from './haptics'
|
||||||
import Icon, { IconName } from './Icon'
|
import Icon, { IconName } from './Icon'
|
||||||
@ -25,7 +25,7 @@ export const SwipeToActions = <T extends unknown>({
|
|||||||
renderHiddenItem={({ item }) => (
|
renderHiddenItem={({ item }) => (
|
||||||
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'flex-end' }}>
|
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'flex-end' }}>
|
||||||
{actions.map((action, index) => (
|
{actions.map((action, index) => (
|
||||||
<TouchableNativeFeedback
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
haptics(action.haptic || 'Light')
|
haptics(action.haptic || 'Light')
|
||||||
@ -43,7 +43,7 @@ export const SwipeToActions = <T extends unknown>({
|
|||||||
>
|
>
|
||||||
<Icon name={action.icon} color='white' size={StyleConstants.Font.Size.L} />
|
<Icon name={action.icon} color='white' size={StyleConstants.Font.Size.L} />
|
||||||
</View>
|
</View>
|
||||||
</TouchableNativeFeedback>
|
</Pressable>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
@ -2,11 +2,11 @@ import GracefullyImage from '@components/GracefullyImage'
|
|||||||
import haptics from '@components/haptics'
|
import haptics from '@components/haptics'
|
||||||
import Icon from '@components/Icon'
|
import Icon from '@components/Icon'
|
||||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
|
||||||
import { RootStackScreenProps, ScreenTabsStackParamList } from '@utils/navigation/navigators'
|
import { ScreenTabsStackParamList } from '@utils/navigation/navigators'
|
||||||
import { getGlobalStorage, useAccountStorage, useGlobalStorage } from '@utils/storage/actions'
|
import { getGlobalStorage, useAccountStorage, useGlobalStorage } from '@utils/storage/actions'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Platform } from 'react-native'
|
import { Platform, View } from 'react-native'
|
||||||
import TabLocal from './Local'
|
import TabLocal from './Local'
|
||||||
import TabMe from './Me'
|
import TabMe from './Me'
|
||||||
import TabNotifications from './Notifications'
|
import TabNotifications from './Notifications'
|
||||||
@ -14,7 +14,7 @@ import TabPublic from './Public'
|
|||||||
|
|
||||||
const Tab = createBottomTabNavigator<ScreenTabsStackParamList>()
|
const Tab = createBottomTabNavigator<ScreenTabsStackParamList>()
|
||||||
|
|
||||||
const ScreenTabs = ({ navigation }: RootStackScreenProps<'Screen-Tabs'>) => {
|
const ScreenTabs = () => {
|
||||||
const { colors } = useTheme()
|
const { colors } = useTheme()
|
||||||
|
|
||||||
const [accountActive] = useGlobalStorage.string('account.active')
|
const [accountActive] = useGlobalStorage.string('account.active')
|
||||||
@ -50,19 +50,19 @@ const ScreenTabs = ({ navigation }: RootStackScreenProps<'Screen-Tabs'>) => {
|
|||||||
return <Icon name='bell' size={size} color={color} />
|
return <Icon name='bell' size={size} color={color} />
|
||||||
case 'Tab-Me':
|
case 'Tab-Me':
|
||||||
return (
|
return (
|
||||||
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||||||
<GracefullyImage
|
<GracefullyImage
|
||||||
uri={{ original: avatarStatic }}
|
uri={{ original: avatarStatic }}
|
||||||
dimension={{
|
dimension={{ width: size, height: size }}
|
||||||
width: size,
|
|
||||||
height: size
|
|
||||||
}}
|
|
||||||
style={{
|
style={{
|
||||||
borderRadius: size,
|
borderRadius: size,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
borderWidth: focused ? 2 : 0,
|
borderWidth: focused ? 2 : 0,
|
||||||
borderColor: focused ? colors.secondary : color
|
borderColor: focused ? colors.primaryDefault : color
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Icon name='more-vertical' size={size / 1.5} color={colors.secondary} />
|
||||||
|
</View>
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
return <Icon name='alert-octagon' size={size} color={color} />
|
return <Icon name='alert-octagon' size={size} color={color} />
|
||||||
@ -74,13 +74,13 @@ const ScreenTabs = ({ navigation }: RootStackScreenProps<'Screen-Tabs'>) => {
|
|||||||
<Tab.Screen name='Tab-Public' component={TabPublic} />
|
<Tab.Screen name='Tab-Public' component={TabPublic} />
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name='Tab-Compose'
|
name='Tab-Compose'
|
||||||
listeners={{
|
listeners={({ navigation }) => ({
|
||||||
tabPress: e => {
|
tabPress: e => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
haptics('Light')
|
haptics('Light')
|
||||||
navigation.navigate('Screen-Compose')
|
navigation.navigate('Screen-Compose')
|
||||||
}
|
}
|
||||||
}}
|
})}
|
||||||
>
|
>
|
||||||
{() => null}
|
{() => null}
|
||||||
</Tab.Screen>
|
</Tab.Screen>
|
||||||
@ -88,15 +88,18 @@ const ScreenTabs = ({ navigation }: RootStackScreenProps<'Screen-Tabs'>) => {
|
|||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name='Tab-Me'
|
name='Tab-Me'
|
||||||
component={TabMe}
|
component={TabMe}
|
||||||
listeners={{
|
listeners={({ navigation }) => ({
|
||||||
tabLongPress: () => {
|
tabPress: () => {
|
||||||
haptics('Light')
|
if (navigation.isFocused()) {
|
||||||
//@ts-ignore
|
|
||||||
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Root' })
|
|
||||||
//@ts-ignore
|
|
||||||
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Switch' })
|
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Switch' })
|
||||||
}
|
}
|
||||||
}}
|
},
|
||||||
|
tabLongPress: () => {
|
||||||
|
haptics('Light')
|
||||||
|
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Root' })
|
||||||
|
navigation.navigate('Tab-Me', { screen: 'Tab-Me-Switch' })
|
||||||
|
}
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
</Tab.Navigator>
|
</Tab.Navigator>
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user