mirror of
https://github.com/tooot-app/app
synced 2025-02-09 16:38:41 +01:00
Align discard confirmation
This commit is contained in:
parent
79a92b5df7
commit
d3cf0edbc9
@ -55,7 +55,8 @@ const ComposeEditAttachment: React.FC<
|
|||||||
accessibilityLabel={t(
|
accessibilityLabel={t(
|
||||||
'screenCompose:content.editAttachment.header.right.accessibilityLabel'
|
'screenCompose:content.editAttachment.header.right.accessibilityLabel'
|
||||||
)}
|
)}
|
||||||
content='save'
|
type='text'
|
||||||
|
content={t('common:buttons.apply')}
|
||||||
loading={isSubmitting}
|
loading={isSubmitting}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (composeState.type === 'edit') {
|
if (composeState.type === 'edit') {
|
||||||
|
@ -1,25 +1,23 @@
|
|||||||
|
import { discardConfirmation } from '@components/discardConfirmation'
|
||||||
import { EmojisState } from '@components/Emojis/Context'
|
import { EmojisState } from '@components/Emojis/Context'
|
||||||
import haptics from '@components/haptics'
|
import haptics from '@components/haptics'
|
||||||
import { HeaderLeft, HeaderRight } from '@components/Header'
|
import { HeaderLeft, HeaderRight } from '@components/Header'
|
||||||
import ComponentInput from '@components/Input'
|
import ComponentInput from '@components/Input'
|
||||||
import { displayMessage, Message } from '@components/Message'
|
import { displayMessage, Message } from '@components/Message'
|
||||||
import Selections from '@components/Selections'
|
import Selections from '@components/Selections'
|
||||||
import CustomText from '@components/Text'
|
|
||||||
import { CommonActions } from '@react-navigation/native'
|
import { CommonActions } from '@react-navigation/native'
|
||||||
import { useQueryClient } from '@tanstack/react-query'
|
import { useQueryClient } from '@tanstack/react-query'
|
||||||
import { TabMeStackScreenProps } from '@utils/navigation/navigators'
|
import { TabMeStackScreenProps } from '@utils/navigation/navigators'
|
||||||
import { QueryKeyLists, useListsMutation } from '@utils/queryHooks/lists'
|
import { QueryKeyLists, useListsMutation } from '@utils/queryHooks/lists'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
|
||||||
import React, { useEffect, useRef, useState } from 'react'
|
import React, { useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Alert, ScrollView, TextInput } from 'react-native'
|
import { ScrollView, TextInput } from 'react-native'
|
||||||
|
|
||||||
const TabMeListEdit: React.FC<TabMeStackScreenProps<'Tab-Me-List-Edit'>> = ({
|
const TabMeListEdit: React.FC<TabMeStackScreenProps<'Tab-Me-List-Edit'>> = ({
|
||||||
navigation,
|
navigation,
|
||||||
route: { params }
|
route: { params }
|
||||||
}) => {
|
}) => {
|
||||||
const { colors } = useTheme()
|
|
||||||
const { t } = useTranslation(['common', 'screenTabs'])
|
const { t } = useTranslation(['common', 'screenTabs'])
|
||||||
|
|
||||||
const messageRef = useRef(null)
|
const messageRef = useRef(null)
|
||||||
@ -92,21 +90,10 @@ const TabMeListEdit: React.FC<TabMeStackScreenProps<'Tab-Me-List-Edit'>> = ({
|
|||||||
<HeaderLeft
|
<HeaderLeft
|
||||||
content='x'
|
content='x'
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (params.type === 'edit' ? params.payload.title !== title : title.length) {
|
discardConfirmation({
|
||||||
Alert.alert(t('common:discard.title'), t('common:discard.message'), [
|
condition: params.type === 'edit' ? params.payload.title !== title : !!title.length,
|
||||||
{
|
action: () => navigation.pop(1)
|
||||||
text: t('common:buttons.discard'),
|
})
|
||||||
style: 'destructive',
|
|
||||||
onPress: () => navigation.pop(1)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('common:buttons.cancel'),
|
|
||||||
style: 'default'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
} else {
|
|
||||||
navigation.pop(1)
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { discardConfirmation } from '@components/discardConfirmation'
|
||||||
import { ComponentEmojis } from '@components/Emojis'
|
import { ComponentEmojis } from '@components/Emojis'
|
||||||
import { EmojisState } from '@components/Emojis/Context'
|
import { EmojisState } from '@components/Emojis/Context'
|
||||||
import { HeaderLeft, HeaderRight } from '@components/Header'
|
import { HeaderLeft, HeaderRight } from '@components/Header'
|
||||||
@ -9,7 +10,7 @@ import { StyleConstants } from '@utils/styles/constants'
|
|||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { Dispatch, RefObject, SetStateAction, useEffect, useRef, useState } from 'react'
|
import React, { Dispatch, RefObject, SetStateAction, useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Alert, ScrollView, TextInput } from 'react-native'
|
import { ScrollView, TextInput } from 'react-native'
|
||||||
import FlashMessage from 'react-native-flash-message'
|
import FlashMessage from 'react-native-flash-message'
|
||||||
|
|
||||||
const Field: React.FC<{
|
const Field: React.FC<{
|
||||||
@ -92,21 +93,10 @@ const TabMeProfileFields: React.FC<
|
|||||||
<HeaderLeft
|
<HeaderLeft
|
||||||
content='chevron-left'
|
content='chevron-left'
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (dirty) {
|
discardConfirmation({
|
||||||
Alert.alert(t('common:discard.title'), t('common:discard.message'), [
|
condition: dirty,
|
||||||
{
|
action: () => navigation.navigate('Tab-Me-Profile-Root')
|
||||||
text: t('common:buttons.discard'),
|
})
|
||||||
style: 'destructive',
|
|
||||||
onPress: () => navigation.navigate('Tab-Me-Profile-Root')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('common:buttons.cancel'),
|
|
||||||
style: 'default'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
} else {
|
|
||||||
navigation.navigate('Tab-Me-Profile-Root')
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { discardConfirmation } from '@components/discardConfirmation'
|
||||||
import { ComponentEmojis } from '@components/Emojis'
|
import { ComponentEmojis } from '@components/Emojis'
|
||||||
import { EmojisState } from '@components/Emojis/Context'
|
import { EmojisState } from '@components/Emojis/Context'
|
||||||
import { HeaderLeft, HeaderRight } from '@components/Header'
|
import { HeaderLeft, HeaderRight } from '@components/Header'
|
||||||
@ -7,8 +8,7 @@ import { useProfileMutation } from '@utils/queryHooks/profile'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { RefObject, useEffect, useRef, useState } from 'react'
|
import React, { RefObject, useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { ScrollView, TextInput } from 'react-native'
|
||||||
import { Alert, ScrollView, TextInput } from 'react-native'
|
|
||||||
import FlashMessage from 'react-native-flash-message'
|
import FlashMessage from 'react-native-flash-message'
|
||||||
|
|
||||||
const TabMeProfileName: React.FC<
|
const TabMeProfileName: React.FC<
|
||||||
@ -23,7 +23,6 @@ const TabMeProfileName: React.FC<
|
|||||||
navigation
|
navigation
|
||||||
}) => {
|
}) => {
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
const { t } = useTranslation(['common'])
|
|
||||||
const { mutateAsync, status } = useProfileMutation()
|
const { mutateAsync, status } = useProfileMutation()
|
||||||
|
|
||||||
const [value, setValue] = useState(display_name)
|
const [value, setValue] = useState(display_name)
|
||||||
@ -46,21 +45,10 @@ const TabMeProfileName: React.FC<
|
|||||||
<HeaderLeft
|
<HeaderLeft
|
||||||
content='chevron-left'
|
content='chevron-left'
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (dirty) {
|
discardConfirmation({
|
||||||
Alert.alert(t('common:discard.title'), t('common:discard.message'), [
|
condition: dirty,
|
||||||
{
|
action: () => navigation.navigate('Tab-Me-Profile-Root')
|
||||||
text: t('common:buttons.discard'),
|
})
|
||||||
style: 'destructive',
|
|
||||||
onPress: () => navigation.navigate('Tab-Me-Profile-Root')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('common:buttons.cancel'),
|
|
||||||
style: 'default'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
} else {
|
|
||||||
navigation.navigate('Tab-Me-Profile-Root')
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { discardConfirmation } from '@components/discardConfirmation'
|
||||||
import { ComponentEmojis } from '@components/Emojis'
|
import { ComponentEmojis } from '@components/Emojis'
|
||||||
import { EmojisState } from '@components/Emojis/Context'
|
import { EmojisState } from '@components/Emojis/Context'
|
||||||
import { HeaderLeft, HeaderRight } from '@components/Header'
|
import { HeaderLeft, HeaderRight } from '@components/Header'
|
||||||
@ -7,8 +8,7 @@ import { useProfileMutation } from '@utils/queryHooks/profile'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { RefObject, useEffect, useRef, useState } from 'react'
|
import React, { RefObject, useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { ScrollView, TextInput } from 'react-native'
|
||||||
import { Alert, ScrollView, TextInput } from 'react-native'
|
|
||||||
import FlashMessage from 'react-native-flash-message'
|
import FlashMessage from 'react-native-flash-message'
|
||||||
|
|
||||||
const TabMeProfileNote: React.FC<
|
const TabMeProfileNote: React.FC<
|
||||||
@ -23,7 +23,6 @@ const TabMeProfileNote: React.FC<
|
|||||||
navigation
|
navigation
|
||||||
}) => {
|
}) => {
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
const { t } = useTranslation(['common'])
|
|
||||||
const { mutateAsync, status } = useProfileMutation()
|
const { mutateAsync, status } = useProfileMutation()
|
||||||
|
|
||||||
const [notes, setNotes] = useState(note)
|
const [notes, setNotes] = useState(note)
|
||||||
@ -46,21 +45,10 @@ const TabMeProfileNote: React.FC<
|
|||||||
<HeaderLeft
|
<HeaderLeft
|
||||||
content='chevron-left'
|
content='chevron-left'
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (dirty) {
|
discardConfirmation({
|
||||||
Alert.alert(t('common:discard.title'), t('common:discard.message'), [
|
condition: dirty,
|
||||||
{
|
action: () => navigation.navigate('Tab-Me-Profile-Root')
|
||||||
text: t('common:buttons.discard'),
|
})
|
||||||
style: 'destructive',
|
|
||||||
onPress: () => navigation.navigate('Tab-Me-Profile-Root')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('common:buttons.cancel'),
|
|
||||||
style: 'default'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
} else {
|
|
||||||
navigation.navigate('Tab-Me-Profile-Root')
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { discardConfirmation } from '@components/discardConfirmation'
|
||||||
import { HeaderLeft, HeaderRight } from '@components/Header'
|
import { HeaderLeft, HeaderRight } from '@components/Header'
|
||||||
import { MenuContainer, MenuRow } from '@components/Menu'
|
import { MenuContainer, MenuRow } from '@components/Menu'
|
||||||
import { useQueryClient } from '@tanstack/react-query'
|
import { useQueryClient } from '@tanstack/react-query'
|
||||||
@ -8,7 +9,6 @@ import { setAccountStorage, useAccountStorage } from '@utils/storage/actions'
|
|||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Alert } from 'react-native'
|
|
||||||
import { ScrollView } from 'react-native-gesture-handler'
|
import { ScrollView } from 'react-native-gesture-handler'
|
||||||
|
|
||||||
const TabNotificationsFilters: React.FC<
|
const TabNotificationsFilters: React.FC<
|
||||||
@ -28,21 +28,7 @@ const TabNotificationsFilters: React.FC<
|
|||||||
<HeaderLeft
|
<HeaderLeft
|
||||||
content='chevron-down'
|
content='chevron-down'
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (changed) {
|
discardConfirmation({ condition: changed, action: () => navigation.goBack() })
|
||||||
Alert.alert(t('common:discard.title'), t('common:discard.message'), [
|
|
||||||
{
|
|
||||||
text: t('common:buttons.discard'),
|
|
||||||
style: 'destructive',
|
|
||||||
onPress: () => navigation.goBack()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('common:buttons.cancel'),
|
|
||||||
style: 'default'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
} else {
|
|
||||||
navigation.goBack()
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user