1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Add back disabled color

This commit is contained in:
Zhiyuan Zheng
2020-12-26 14:40:10 +01:00
parent 7a15cceb28
commit 3ea88d025b
12 changed files with 37 additions and 69 deletions

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 (