Add back disabled color

This commit is contained in:
Zhiyuan Zheng 2020-12-26 14:40:10 +01:00
parent 7a15cceb28
commit 3ea88d025b
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
12 changed files with 37 additions and 69 deletions

View File

@ -171,7 +171,7 @@ export const Index: React.FC<Props> = ({ localCorrupt }) => {
})}
tabBarOptions={{
activeTintColor: theme.primary,
inactiveTintColor: theme.secondary,
inactiveTintColor: localInstance ? theme.secondary : theme.disabled,
showLabel: false
}}
>
@ -182,11 +182,6 @@ export const Index: React.FC<Props> = ({ localCorrupt }) => {
tabPress: e => {
if (!localInstance) {
e.preventDefault()
toast({
type: 'error',
content: '请先登录',
onHide: () => navigation.navigate('Screen-Me')
})
}
}
})}
@ -201,12 +196,6 @@ export const Index: React.FC<Props> = ({ localCorrupt }) => {
navigation.navigate(getCurrentTab(navigation), {
screen: 'Screen-Shared-Compose'
})
} else {
toast({
type: 'error',
content: '请先登录',
onHide: () => navigation.navigate('Screen-Me')
})
}
}
})}
@ -224,15 +213,10 @@ export const Index: React.FC<Props> = ({ localCorrupt }) => {
backgroundColor: theme.red
}
}}
listeners={({ navigation }) => ({
listeners={() => ({
tabPress: e => {
if (!localInstance) {
e.preventDefault()
toast({
type: 'error',
content: '请先登录',
onHide: () => navigation.navigate('Screen-Me')
})
}
}
})}

View File

@ -27,7 +27,12 @@ const Core: React.FC<Props> = ({ text, destructive = false }) => {
return (
<View style={styles.core}>
<Text style={{ color: destructive ? theme.red : theme.primary }}>
<Text
style={{
color: destructive ? theme.red : theme.primary,
fontWeight: destructive ? StyleConstants.Font.Weight.Bold : undefined
}}
>
{text}
</Text>
</View>

View File

@ -8,7 +8,6 @@ import { useTheme } from '@utils/styles/ThemeManager'
import { Feather } from '@expo/vector-icons'
import { StyleConstants } from '@utils/styles/constants'
import openLink from '@root/utils/openLink'
import layoutAnimation from '@root/utils/styles/layoutAnimation'
// Prevent going to the same hashtag multiple times
const renderNode = ({
@ -154,7 +153,6 @@ const ParseContent: React.FC<Props> = ({
}
}, [])
const rootComponent = useCallback(({ children }) => {
// layoutAnimation()
const lineHeight = StyleConstants.Font.LineHeight[size]
const [heightOriginal, setHeightOriginal] = useState<number>()
@ -200,7 +198,9 @@ const ParseContent: React.FC<Props> = ({
/>
{allowExpand && (
<Pressable
onPress={() => setShowAllText(!showAllText)}
onPress={() => {
setShowAllText(!showAllText)
}}
style={{ marginTop: showAllText ? 0 : -lineHeight * 1.25 }}
>
<LinearGradient

View File

@ -144,10 +144,7 @@ const TimelineActions: React.FC<Props> = ({
})
}, [])
const onPressReblog = useCallback(() => {
if (status.visibility === 'private' || status.visibility === 'direct') {
console.log('awjerio')
toast({ type: 'error', content: '禁止转发' })
} else {
if (status.visibility !== 'private' && status.visibility !== 'direct') {
mutate({
id: status.id,
type: 'reblog',
@ -221,7 +218,11 @@ const TimelineActions: React.FC<Props> = ({
() => (
<Feather
name='repeat'
color={iconColorAction(status.reblogged)}
color={
status.visibility === 'private' || status.visibility === 'direct'
? theme.disabled
: iconColorAction(status.reblogged)
}
size={StyleConstants.Font.Size.M + 2}
/>
),

View File

@ -10,6 +10,7 @@ import { useNavigation } from '@react-navigation/native'
import AttachmentUnsupported from './Attachment/Unsupported'
import AttachmentAudio from './Attachment/Audio'
import { Feather } from '@expo/vector-icons'
import layoutAnimation from '@root/utils/styles/layoutAnimation'
export interface Props {
status: Pick<Mastodon.Status, 'media_attachments' | 'sensitive'>
@ -21,6 +22,7 @@ const TimelineAttachment: React.FC<Props> = ({ status, contentWidth }) => {
const [sensitiveShown, setSensitiveShown] = useState(status.sensitive)
const onPressBlurView = useCallback(() => {
layoutAnimation()
setSensitiveShown(false)
}, [])

View File

@ -2,7 +2,6 @@ import React, { useCallback, useState } from 'react'
import { Image, Pressable, StyleSheet, View } from 'react-native'
import { Audio } from 'expo-av'
import { ButtonRow } from '@components/Button'
import layoutAnimation from '@root/utils/styles/layoutAnimation'
import { Surface } from 'gl-react-expo'
import { Blurhash } from 'gl-react-blurhash'
import Slider from '@react-native-community/slider'
@ -15,8 +14,6 @@ export interface Props {
}
const AttachmentAudio: React.FC<Props> = ({ sensitiveShown, audio }) => {
layoutAnimation()
const { theme } = useTheme()
const [audioPlayer, setAudioPlayer] = useState<Audio.Sound>()
@ -93,8 +90,8 @@ const AttachmentAudio: React.FC<Props> = ({ sensitiveShown, audio }) => {
minimumValue={0}
maximumValue={audio.meta.original.duration * 1000}
value={audioPosition}
minimumTrackTintColor={theme.primary}
maximumTrackTintColor={theme.secondary}
minimumTrackTintColor={theme.secondary}
maximumTrackTintColor={theme.disabled}
onSlidingStart={() => {
audioPlayer?.pauseAsync()
setAudioPlaying(false)

View File

@ -3,7 +3,6 @@ import { Blurhash } from 'gl-react-blurhash'
import React, { useCallback, useEffect, useState } from 'react'
import { Image, StyleSheet, Pressable } from 'react-native'
import { StyleConstants } from '@utils/styles/constants'
import layoutAnimation from '@root/utils/styles/layoutAnimation'
export interface Props {
sensitiveShown: boolean
@ -18,8 +17,6 @@ const AttachmentImage: React.FC<Props> = ({
imageIndex,
navigateToImagesViewer
}) => {
layoutAnimation()
let isMounted = false
useEffect(() => {
isMounted = true

View File

@ -2,7 +2,6 @@ import React, { useCallback, useRef, useState } from 'react'
import { Pressable, StyleSheet } from 'react-native'
import { Video } from 'expo-av'
import { ButtonRow } from '@components/Button'
import layoutAnimation from '@root/utils/styles/layoutAnimation'
import { Surface } from 'gl-react-expo'
import { Blurhash } from 'gl-react-blurhash'
@ -19,8 +18,6 @@ const AttachmentVideo: React.FC<Props> = ({
width,
height
}) => {
layoutAnimation()
const videoPlayer = useRef<Video>(null)
const [videoLoaded, setVideoLoaded] = useState(false)
const [videoPosition, setVideoPosition] = useState<number>(0)

View File

@ -34,7 +34,6 @@ const Emojis: React.FC<Props> = ({
marginBottom: -1
}
})
const hasEmojis = content.match(regexEmoji)
return (
<Text numberOfLines={numberOfLines || undefined}>
@ -72,4 +71,4 @@ const Emojis: React.FC<Props> = ({
)
}
export default Emojis
export default React.memo(Emojis, () => true)

View File

@ -56,7 +56,7 @@ const ToastBase = ({ config }: { config: Config }) => {
enum colorMapping {
success = 'blue',
error = 'red',
warning = 'primary'
warning = 'secondary'
}
return (

View File

@ -12,6 +12,7 @@ const ComposeActions: React.FC = () => {
const { theme } = useTheme()
const attachmentColor = useMemo(() => {
if (composeState.poll.active) return theme.disabled
if (composeState.attachmentUploadProgress) return theme.primary
if (composeState.attachments.uploads.length) {
@ -25,13 +26,7 @@ const ComposeActions: React.FC = () => {
composeState.attachmentUploadProgress
])
const attachmentOnPress = useCallback(async () => {
if (composeState.poll.active) {
toast({
type: 'error',
content: '长毛象不支持同时发布附件及投票'
})
return
}
if (composeState.poll.active) return
if (composeState.attachmentUploadProgress) return
if (!composeState.attachments.uploads.length) {
@ -44,6 +39,9 @@ const ComposeActions: React.FC = () => {
])
const pollColor = useMemo(() => {
if (composeState.attachments.uploads.length) return theme.disabled
if (composeState.attachmentUploadProgress) return theme.disabled
if (composeState.poll.active) {
return theme.primary
} else {
@ -55,17 +53,6 @@ const ComposeActions: React.FC = () => {
composeState.attachmentUploadProgress
])
const pollOnPress = useCallback(() => {
if (
composeState.attachments.uploads.length ||
composeState.attachmentUploadProgress
) {
toast({
type: 'error',
content: '长毛象不支持同时发布附件及投票'
})
return
}
if (
!composeState.attachments.uploads.length &&
!composeState.attachmentUploadProgress
@ -134,6 +121,8 @@ const ComposeActions: React.FC = () => {
}, [composeState.spoiler.active, composeState.textInputFocus])
const emojiColor = useMemo(() => {
if (!composeState.emoji.emojis) return theme.disabled
if (composeState.emoji.active) {
return theme.primary
} else {
@ -141,14 +130,6 @@ const ComposeActions: React.FC = () => {
}
}, [composeState.emoji.active, composeState.emoji.emojis])
const emojiOnPress = useCallback(() => {
if (!composeState.emoji.emojis) {
toast({
type: 'error',
content: '提取emoji错误'
})
return
}
if (composeState.emoji.emojis) {
if (composeState.emoji.active) {
composeDispatch({
@ -186,7 +167,7 @@ const ComposeActions: React.FC = () => {
<Feather
name={visibilityIcon}
size={24}
color={composeState.visibilityLock ? theme.primary : theme.secondary}
color={composeState.visibilityLock ? theme.disabled : theme.secondary}
onPress={visibilityOnPress}
/>
<Feather

View File

@ -4,6 +4,7 @@ export type ColorDefinitions =
| 'primary'
| 'primaryOverlay'
| 'secondary'
| 'disabled'
| 'blue'
| 'red'
| 'background'
@ -31,6 +32,10 @@ const themeColors: {
light: 'rgb(135, 135, 135)',
dark: 'rgb(135, 135, 135)'
},
disabled: {
light: 'rgb(200, 200, 200)',
dark: 'rgb(66, 66, 66)'
},
blue: {
light: 'rgb(43, 144, 221)',
dark: 'rgb(43, 144, 221)'
@ -54,7 +59,7 @@ const themeColors: {
},
backgroundOverlay: {
light: 'rgba(18, 18, 18, 0.5)',
dark: 'rgba(255, 255, 255, 0.5)'
dark: 'rgba(0, 0, 0, 0.5)'
},
border: {
light: 'rgba(0, 0, 0, 0.3)',