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

Refine RN 0.64

This commit is contained in:
Zhiyuan Zheng
2021-03-16 23:15:37 +01:00
parent d2addd1b11
commit bcb55254f9
18 changed files with 91 additions and 88 deletions

View File

@ -140,20 +140,13 @@ const TimelineConversation: React.FC<Props> = ({
/>
)}
</View>
<View
style={{
paddingLeft: highlighted
? 0
: StyleConstants.Avatar.M + StyleConstants.Spacing.S
}}
>
<TimelineActions
queryKey={queryKey}
status={conversation.last_status}
accts={conversation.accounts.map(account => account.acct)}
reblog={false}
/>
</View>
<TimelineActions
queryKey={queryKey}
status={conversation.last_status}
highlighted={highlighted}
accts={conversation.accounts.map(account => account.acct)}
reblog={false}
/>
</>
) : null}
</Pressable>

View File

@ -132,27 +132,19 @@ const TimelineDefault: React.FC<Props> = ({
<TimelineActionsUsers status={actualStatus} highlighted={highlighted} />
{queryKey && !disableDetails && (
<View
style={{
paddingLeft: highlighted
? 0
: StyleConstants.Avatar.M + StyleConstants.Spacing.S
}}
>
<TimelineActions
queryKey={queryKey}
rootQueryKey={rootQueryKey}
status={actualStatus}
accts={uniqBy(
([actualStatus.account] as Mastodon.Account[] &
Mastodon.Mention[])
.concat(actualStatus.mentions)
.filter(d => d.id !== instanceAccount?.id),
d => d.id
).map(d => d.acct)}
reblog={item.reblog ? true : false}
/>
</View>
<TimelineActions
queryKey={queryKey}
rootQueryKey={rootQueryKey}
highlighted={highlighted}
status={actualStatus}
accts={uniqBy(
([actualStatus.account] as Mastodon.Account[] & Mastodon.Mention[])
.concat(actualStatus.mentions)
.filter(d => d?.id !== instanceAccount?.id),
d => d.id
).map(d => d.acct)}
reblog={item.reblog ? true : false}
/>
)}
</Pressable>
)

View File

@ -129,28 +129,21 @@ const TimelineNotifications: React.FC<Props> = ({
) : null}
</View>
{notification.status && (
<View
style={{
paddingLeft: highlighted
? 0
: StyleConstants.Avatar.M + StyleConstants.Spacing.S
}}
>
<TimelineActions
queryKey={queryKey}
status={notification.status}
accts={uniqBy(
([notification.status.account] as Mastodon.Account[] &
Mastodon.Mention[])
.concat(notification.status.mentions)
.filter(d => d.id !== instanceAccount?.id),
d => d.id
).map(d => d.acct)}
reblog={false}
/>
</View>
)}
{notification.status ? (
<TimelineActions
queryKey={queryKey}
status={notification.status}
highlighted={highlighted}
accts={uniqBy(
([notification.status.account] as Mastodon.Account[] &
Mastodon.Mention[])
.concat(notification.status.mentions)
.filter(d => d.id !== instanceAccount?.id),
d => d.id
).map(d => d.acct)}
reblog={false}
/>
) : null}
</Pressable>
)
}

View File

@ -9,7 +9,7 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text, View } from 'react-native'
import { Platform, StyleSheet, Text, View } from 'react-native'
import { Circle } from 'react-native-animated-spinkit'
import Animated, {
Extrapolate,
@ -45,6 +45,9 @@ const TimelineRefresh: React.FC<Props> = ({
fetchingType,
disableRefresh = false
}) => {
if (Platform.OS !== 'ios') {
return null
}
if (disableRefresh) {
return null
}

View File

@ -17,13 +17,14 @@ import { useQueryClient } from 'react-query'
export interface Props {
queryKey: QueryKeyTimeline
rootQueryKey?: QueryKeyTimeline
highlighted: boolean
status: Mastodon.Status
accts: Mastodon.Account['acct'][] // When replying to conversations
reblog: boolean
}
const TimelineActions = React.memo(
({ queryKey, rootQueryKey, status, accts, reblog }: Props) => {
({ queryKey, rootQueryKey, highlighted, status, accts, reblog }: Props) => {
const navigation = useNavigation()
const { t } = useTranslation('componentTimeline')
const { mode, theme } = useTheme()
@ -256,7 +257,13 @@ const TimelineActions = React.memo(
)
return (
<>
<View
style={{
paddingLeft: highlighted
? 0
: StyleConstants.Avatar.M + StyleConstants.Spacing.S
}}
>
<View style={styles.actions}>
<Pressable
style={styles.action}
@ -285,7 +292,7 @@ const TimelineActions = React.memo(
children={childrenBookmark}
/>
</View>
</>
</View>
)
},
() => true

View File

@ -24,9 +24,9 @@ const TimelineFullConversation = React.memo(
).length) ? (
<Text
style={{
...StyleConstants.FontStyle.M,
...StyleConstants.FontStyle.S,
color: theme.blue,
marginTop: StyleConstants.Font.Size.M / 2
marginTop: StyleConstants.Font.Size.S
}}
>
{t('shared.fullConversation')}

View File

@ -36,7 +36,7 @@ export default {
function: '转嘟'
},
bookmarked: {
function: '收藏嘟文'
function: '喜欢嘟文'
}
},
actionsUsers: {

View File

@ -1,4 +1,4 @@
export default {
heading: '收藏',
heading: '喜欢',
content: {}
}

View File

@ -6,7 +6,7 @@ export default {
},
statuses: {
reblogged_by: '{{count}} 人转嘟',
favourited_by: '{{count}} 人收藏'
favourited_by: '{{count}} 人喜欢'
}
}
}

View File

@ -1,5 +1,5 @@
import analytics from '@components/analytics'
import { HeaderLeft, HeaderRight } from '@components/Header'
import { HeaderCenter, HeaderLeft, HeaderRight } from '@components/Header'
import { StackScreenProps } from '@react-navigation/stack'
import haptics from '@root/components/haptics'
import formatText from '@screens/Compose/formatText'
@ -371,6 +371,13 @@ const ScreenCompose: React.FC<ScreenComposeProp> = ({
},
headerTintColor:
totalTextCount > maxTootChars ? theme.red : theme.secondary,
headerCenter: () => (
<HeaderCenter
content={`${totalTextCount} / ${maxTootChars}${
__DEV__ ? ` Dirty: ${composeState.dirty.toString()}` : ''
}`}
/>
),
headerRight
}}
/>

View File

@ -39,7 +39,8 @@ const ComposeEditAttachmentSubmit: React.FC<Props> = ({ index }) => {
) {
formData.append(
'focus',
`${theAttachment.meta.focus.x},${-theAttachment.meta.focus.y}`
`${theAttachment.meta.focus.x || 0},${-theAttachment.meta.focus.y ||
0}`
)
}

View File

@ -211,7 +211,14 @@ const sharedScreens = (
}
}: SharedUsersProp) => ({
headerLeft: () => <HeaderLeft onPress={() => navigation.goBack()} />,
headerTitle: t(`sharedUsers:heading.${reference}.${type}`, { count })
headerTitle: t(`sharedUsers:heading.${reference}.${type}`, { count }),
...(Platform.OS === 'android' && {
headerCenter: () => (
<HeaderCenter
content={t(`sharedUsers:heading.${reference}.${type}`, { count })}
/>
)
})
})}
/>
]

View File

@ -6,14 +6,14 @@ export const StyleConstants = {
LineHeight: {
S: 20,
M: 22,
L: 30
L: 28
},
Weight: { Normal: '400' as '400', Bold: '600' as '600' }
},
FontStyle: {
S: { fontSize: 14, lineHeight: 20 },
M: { fontSize: 16, lineHeight: 22 },
L: { fontSize: 20, lineHeight: 30 }
L: { fontSize: 20, lineHeight: 28 }
},
Spacing: {

View File

@ -1,11 +1,11 @@
import { Dimensions } from 'react-native'
// import { Dimensions } from 'react-native'
const { width } = Dimensions.get('screen')
// const { width } = Dimensions.get('screen')
const guidelineBaseWidth = 375
// const guidelineBaseWidth = 375
// const guidelineBaseHeight = 667
const scale = (size: number) => (width / guidelineBaseWidth) * size
// const scale = (size: number) => (width / guidelineBaseWidth) * size
// const verticalScale = (size: number) => (height / guidelineBaseHeight) * size
// const adaptiveScale = (size: number, factor: number = 0) =>
// size + (scale(size) - size) * factor