mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fix Android action sheet color mode
This commit is contained in:
@ -2,6 +2,7 @@ import Icon from '@components/Icon'
|
|||||||
import { displayMessage } from '@components/Message'
|
import { displayMessage } from '@components/Message'
|
||||||
import CustomText from '@components/Text'
|
import CustomText from '@components/Text'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
|
import { androidActionSheetStyles } from '@helpers/androidActionSheetStyles'
|
||||||
import { useNavigation } from '@react-navigation/native'
|
import { useNavigation } from '@react-navigation/native'
|
||||||
import { StackNavigationProp } from '@react-navigation/stack'
|
import { StackNavigationProp } from '@react-navigation/stack'
|
||||||
import { RootStackParamList } from '@utils/navigation/navigators'
|
import { RootStackParamList } from '@utils/navigation/navigators'
|
||||||
@ -99,7 +100,8 @@ const TimelineActions: React.FC = () => {
|
|||||||
t('shared.actions.reblogged.options.unlisted'),
|
t('shared.actions.reblogged.options.unlisted'),
|
||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 2
|
cancelButtonIndex: 2,
|
||||||
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
(selectedIndex: number) => {
|
(selectedIndex: number) => {
|
||||||
switch (selectedIndex) {
|
switch (selectedIndex) {
|
||||||
|
5
src/helpers/androidActionSheetStyles.ts
Normal file
5
src/helpers/androidActionSheetStyles.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export const androidActionSheetStyles = (colors: any) => ({
|
||||||
|
containerStyle: { backgroundColor: colors.backgroundDefault },
|
||||||
|
textStyle: { color: colors.primaryDefault },
|
||||||
|
titleTextStyle: { color: colors.secondary }
|
||||||
|
})
|
@ -2,6 +2,7 @@ import { emojis } from '@components/Emojis'
|
|||||||
import EmojisContext from '@components/Emojis/helpers/EmojisContext'
|
import EmojisContext from '@components/Emojis/helpers/EmojisContext'
|
||||||
import Icon from '@components/Icon'
|
import Icon from '@components/Icon'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
|
import { androidActionSheetStyles } from '@helpers/androidActionSheetStyles'
|
||||||
import { getInstanceConfigurationStatusMaxAttachments } from '@utils/slices/instancesSlice'
|
import { getInstanceConfigurationStatusMaxAttachments } from '@utils/slices/instancesSlice'
|
||||||
import layoutAnimation from '@utils/styles/layoutAnimation'
|
import layoutAnimation from '@utils/styles/layoutAnimation'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
@ -16,7 +17,7 @@ const ComposeActions: React.FC = () => {
|
|||||||
const { showActionSheetWithOptions } = useActionSheet()
|
const { showActionSheetWithOptions } = useActionSheet()
|
||||||
const { composeState, composeDispatch } = useContext(ComposeContext)
|
const { composeState, composeDispatch } = useContext(ComposeContext)
|
||||||
const { t } = useTranslation('screenCompose')
|
const { t } = useTranslation('screenCompose')
|
||||||
const { colors, mode } = useTheme()
|
const { colors } = useTheme()
|
||||||
const instanceConfigurationStatusMaxAttachments = useSelector(
|
const instanceConfigurationStatusMaxAttachments = useSelector(
|
||||||
getInstanceConfigurationStatusMaxAttachments,
|
getInstanceConfigurationStatusMaxAttachments,
|
||||||
() => true
|
() => true
|
||||||
@ -89,7 +90,7 @@ const ComposeActions: React.FC = () => {
|
|||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 4,
|
cancelButtonIndex: 4,
|
||||||
userInterfaceStyle: mode
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
buttonIndex => {
|
buttonIndex => {
|
||||||
switch (buttonIndex) {
|
switch (buttonIndex) {
|
||||||
|
@ -3,6 +3,7 @@ import Icon from '@components/Icon'
|
|||||||
import { MenuRow } from '@components/Menu'
|
import { MenuRow } from '@components/Menu'
|
||||||
import CustomText from '@components/Text'
|
import CustomText from '@components/Text'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
|
import { androidActionSheetStyles } from '@helpers/androidActionSheetStyles'
|
||||||
import { getInstanceConfigurationPoll } from '@utils/slices/instancesSlice'
|
import { getInstanceConfigurationPoll } from '@utils/slices/instancesSlice'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
@ -23,13 +24,9 @@ const ComposePoll: React.FC = () => {
|
|||||||
const { t } = useTranslation('screenCompose')
|
const { t } = useTranslation('screenCompose')
|
||||||
const { colors, mode } = useTheme()
|
const { colors, mode } = useTheme()
|
||||||
|
|
||||||
const instanceConfigurationPoll = useSelector(
|
const instanceConfigurationPoll = useSelector(getInstanceConfigurationPoll, () => true)
|
||||||
getInstanceConfigurationPoll,
|
|
||||||
() => true
|
|
||||||
)
|
|
||||||
const MAX_OPTIONS = instanceConfigurationPoll.max_options
|
const MAX_OPTIONS = instanceConfigurationPoll.max_options
|
||||||
const MAX_CHARS_PER_OPTION =
|
const MAX_CHARS_PER_OPTION = instanceConfigurationPoll.max_characters_per_option
|
||||||
instanceConfigurationPoll.max_characters_per_option
|
|
||||||
const MIN_EXPIRATION = instanceConfigurationPoll.min_expiration
|
const MIN_EXPIRATION = instanceConfigurationPoll.min_expiration
|
||||||
const MAX_EXPIRATION = instanceConfigurationPoll.max_expiration
|
const MAX_EXPIRATION = instanceConfigurationPoll.max_expiration
|
||||||
|
|
||||||
@ -127,10 +124,9 @@ const ComposePoll: React.FC = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
accessibilityHint: t(
|
accessibilityHint: t('content.root.footer.poll.quantity.reduce.accessibilityHint', {
|
||||||
'content.root.footer.poll.quantity.reduce.accessibilityHint',
|
amount: total
|
||||||
{ amount: total }
|
})
|
||||||
)
|
|
||||||
})}
|
})}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
total > 2 &&
|
total > 2 &&
|
||||||
@ -179,9 +175,7 @@ const ComposePoll: React.FC = () => {
|
|||||||
disabled={!(total < MAX_OPTIONS)}
|
disabled={!(total < MAX_OPTIONS)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View style={{ paddingHorizontal: StyleConstants.Spacing.Global.PagePadding }}>
|
||||||
style={{ paddingHorizontal: StyleConstants.Spacing.Global.PagePadding }}
|
|
||||||
>
|
|
||||||
<MenuRow
|
<MenuRow
|
||||||
title={t('content.root.footer.poll.multiple.heading')}
|
title={t('content.root.footer.poll.multiple.heading')}
|
||||||
content={
|
content={
|
||||||
@ -198,7 +192,7 @@ const ComposePoll: React.FC = () => {
|
|||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 2,
|
cancelButtonIndex: 2,
|
||||||
userInterfaceStyle: mode
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
index => {
|
index => {
|
||||||
if (index && index < 2) {
|
if (index && index < 2) {
|
||||||
@ -226,19 +220,16 @@ const ComposePoll: React.FC = () => {
|
|||||||
'604800'
|
'604800'
|
||||||
].filter(
|
].filter(
|
||||||
expiration =>
|
expiration =>
|
||||||
parseInt(expiration) >= MIN_EXPIRATION &&
|
parseInt(expiration) >= MIN_EXPIRATION && parseInt(expiration) <= MAX_EXPIRATION
|
||||||
parseInt(expiration) <= MAX_EXPIRATION
|
|
||||||
)
|
)
|
||||||
showActionSheetWithOptions(
|
showActionSheetWithOptions(
|
||||||
{
|
{
|
||||||
options: [
|
options: [
|
||||||
...expirations.map(e =>
|
...expirations.map(e => t(`content.root.footer.poll.expiration.options.${e}`)),
|
||||||
t(`content.root.footer.poll.expiration.options.${e}`)
|
|
||||||
),
|
|
||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: expirations.length,
|
cancelButtonIndex: expirations.length,
|
||||||
userInterfaceStyle: mode
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
index => {
|
index => {
|
||||||
if (index !== undefined && index < expirations.length) {
|
if (index !== undefined && index < expirations.length) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import GracefullyImage from '@components/GracefullyImage'
|
import GracefullyImage from '@components/GracefullyImage'
|
||||||
import { HeaderCenter, HeaderLeft, HeaderRight } from '@components/Header'
|
import { HeaderCenter, HeaderLeft, HeaderRight } from '@components/Header'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
|
import { androidActionSheetStyles } from '@helpers/androidActionSheetStyles'
|
||||||
import { RootStackScreenProps } from '@utils/navigation/navigators'
|
import { RootStackScreenProps } from '@utils/navigation/navigators'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useCallback, useState } from 'react'
|
import React, { useCallback, useState } from 'react'
|
||||||
@ -39,7 +40,7 @@ const ScreenImagesViewer = ({
|
|||||||
|
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
|
|
||||||
const { mode } = useTheme()
|
const { mode, colors } = useTheme()
|
||||||
const { t } = useTranslation('screenImageViewer')
|
const { t } = useTranslation('screenImageViewer')
|
||||||
|
|
||||||
const initialIndex = imageUrls.findIndex(image => image.id === id)
|
const initialIndex = imageUrls.findIndex(image => image.id === id)
|
||||||
@ -55,7 +56,7 @@ const ScreenImagesViewer = ({
|
|||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 2,
|
cancelButtonIndex: 2,
|
||||||
userInterfaceStyle: mode
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
async buttonIndex => {
|
async buttonIndex => {
|
||||||
switch (buttonIndex) {
|
switch (buttonIndex) {
|
||||||
@ -181,7 +182,7 @@ const ScreenImagesViewer = ({
|
|||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 2,
|
cancelButtonIndex: 2,
|
||||||
userInterfaceStyle: mode
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
async buttonIndex => {
|
async buttonIndex => {
|
||||||
switch (buttonIndex) {
|
switch (buttonIndex) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { MenuContainer, MenuRow } from '@components/Menu'
|
import { MenuContainer, MenuRow } from '@components/Menu'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
|
import { androidActionSheetStyles } from '@helpers/androidActionSheetStyles'
|
||||||
import { useAppDispatch } from '@root/store'
|
import { useAppDispatch } from '@root/store'
|
||||||
import { TabMeProfileStackScreenProps } from '@utils/navigation/navigators'
|
import { TabMeProfileStackScreenProps } from '@utils/navigation/navigators'
|
||||||
import { useProfileMutation, useProfileQuery } from '@utils/queryHooks/profile'
|
import { useProfileMutation, useProfileQuery } from '@utils/queryHooks/profile'
|
||||||
@ -16,7 +17,7 @@ const TabMeProfileRoot: React.FC<
|
|||||||
messageRef: RefObject<FlashMessage>
|
messageRef: RefObject<FlashMessage>
|
||||||
}
|
}
|
||||||
> = ({ messageRef, navigation }) => {
|
> = ({ messageRef, navigation }) => {
|
||||||
const { mode } = useTheme()
|
const { colors } = useTheme()
|
||||||
const { t } = useTranslation('screenTabs')
|
const { t } = useTranslation('screenTabs')
|
||||||
|
|
||||||
const { showActionSheetWithOptions } = useActionSheet()
|
const { showActionSheetWithOptions } = useActionSheet()
|
||||||
@ -93,7 +94,7 @@ const TabMeProfileRoot: React.FC<
|
|||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 3,
|
cancelButtonIndex: 3,
|
||||||
userInterfaceStyle: mode
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
async buttonIndex => {
|
async buttonIndex => {
|
||||||
switch (buttonIndex) {
|
switch (buttonIndex) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import haptics from '@components/haptics'
|
import haptics from '@components/haptics'
|
||||||
import { MenuContainer, MenuRow } from '@components/Menu'
|
import { MenuContainer, MenuRow } from '@components/Menu'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
|
import { androidActionSheetStyles } from '@helpers/androidActionSheetStyles'
|
||||||
import { useNavigation } from '@react-navigation/native'
|
import { useNavigation } from '@react-navigation/native'
|
||||||
import { LOCALES } from '@root/i18n/locales'
|
import { LOCALES } from '@root/i18n/locales'
|
||||||
import { useAppDispatch } from '@root/store'
|
import { useAppDispatch } from '@root/store'
|
||||||
@ -15,6 +16,7 @@ import {
|
|||||||
getSettingsStaticEmoji,
|
getSettingsStaticEmoji,
|
||||||
changeStaticEmoji
|
changeStaticEmoji
|
||||||
} from '@utils/slices/settingsSlice'
|
} from '@utils/slices/settingsSlice'
|
||||||
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import * as Localization from 'expo-localization'
|
import * as Localization from 'expo-localization'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
@ -26,6 +28,7 @@ const SettingsApp: React.FC = () => {
|
|||||||
const navigation = useNavigation<any>()
|
const navigation = useNavigation<any>()
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const { showActionSheetWithOptions } = useActionSheet()
|
const { showActionSheetWithOptions } = useActionSheet()
|
||||||
|
const { colors } = useTheme()
|
||||||
const { t, i18n } = useTranslation('screenTabs')
|
const { t, i18n } = useTranslation('screenTabs')
|
||||||
|
|
||||||
const settingsFontsize = useSelector(getSettingsFontsize)
|
const settingsFontsize = useSelector(getSettingsFontsize)
|
||||||
@ -71,7 +74,8 @@ const SettingsApp: React.FC = () => {
|
|||||||
t('me.settings.theme.options.dark'),
|
t('me.settings.theme.options.dark'),
|
||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 3
|
cancelButtonIndex: 3,
|
||||||
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
buttonIndex => {
|
buttonIndex => {
|
||||||
switch (buttonIndex) {
|
switch (buttonIndex) {
|
||||||
@ -105,7 +109,8 @@ const SettingsApp: React.FC = () => {
|
|||||||
t('me.settings.darkTheme.options.darker'),
|
t('me.settings.darkTheme.options.darker'),
|
||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 2
|
cancelButtonIndex: 2,
|
||||||
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
buttonIndex => {
|
buttonIndex => {
|
||||||
switch (buttonIndex) {
|
switch (buttonIndex) {
|
||||||
@ -135,7 +140,8 @@ const SettingsApp: React.FC = () => {
|
|||||||
t('me.settings.browser.options.external'),
|
t('me.settings.browser.options.external'),
|
||||||
t('common:buttons.cancel')
|
t('common:buttons.cancel')
|
||||||
],
|
],
|
||||||
cancelButtonIndex: 2
|
cancelButtonIndex: 2,
|
||||||
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
buttonIndex => {
|
buttonIndex => {
|
||||||
switch (buttonIndex) {
|
switch (buttonIndex) {
|
||||||
|
@ -3,6 +3,7 @@ import { MenuContainer, MenuRow } from '@components/Menu'
|
|||||||
import { displayMessage } from '@components/Message'
|
import { displayMessage } from '@components/Message'
|
||||||
import CustomText from '@components/Text'
|
import CustomText from '@components/Text'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
|
import { androidActionSheetStyles } from '@helpers/androidActionSheetStyles'
|
||||||
import { persistor } from '@root/store'
|
import { persistor } from '@root/store'
|
||||||
import { getInstanceActive, getInstances } from '@utils/slices/instancesSlice'
|
import { getInstanceActive, getInstances } from '@utils/slices/instancesSlice'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
@ -13,7 +14,7 @@ import { DevSettings } from 'react-native'
|
|||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
|
|
||||||
const SettingsDev: React.FC = () => {
|
const SettingsDev: React.FC = () => {
|
||||||
const { colors, mode } = useTheme()
|
const { colors } = useTheme()
|
||||||
const { showActionSheetWithOptions } = useActionSheet()
|
const { showActionSheetWithOptions } = useActionSheet()
|
||||||
const instanceActive = useSelector(getInstanceActive)
|
const instanceActive = useSelector(getInstanceActive)
|
||||||
const instances = useSelector(getInstances, () => true)
|
const instances = useSelector(getInstances, () => true)
|
||||||
@ -58,7 +59,7 @@ const SettingsDev: React.FC = () => {
|
|||||||
})
|
})
|
||||||
.concat(['Cancel']),
|
.concat(['Cancel']),
|
||||||
cancelButtonIndex: instances.length,
|
cancelButtonIndex: instances.length,
|
||||||
userInterfaceStyle: mode
|
...androidActionSheetStyles(colors)
|
||||||
},
|
},
|
||||||
() => {}
|
() => {}
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user