Fix font weight

This commit is contained in:
Zhiyuan Zheng 2022-05-10 23:19:26 +02:00
parent 282ba1267d
commit c105b36b3d
10 changed files with 31 additions and 54 deletions

View File

@ -1,5 +1,4 @@
import CustomText from '@components/Text'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
@ -17,9 +16,9 @@ const HeaderCenter = React.memo(
<CustomText
style={{
fontSize: 18,
fontWeight: StyleConstants.Font.Weight.Bold,
color: inverted ? colors.primaryOverlay : colors.primaryDefault
}}
fontWeight='Bold'
children={content}
/>
)

View File

@ -32,10 +32,10 @@ const InstanceInfo = React.memo(
<CustomText
fontStyle='S'
style={{
fontWeight: StyleConstants.Font.Weight.Bold,
marginBottom: StyleConstants.Spacing.XS,
color: colors.primaryDefault
}}
fontWeight='Bold'
children={header}
/>
{content ? (

View File

@ -46,8 +46,7 @@ const ParseEmojis = React.memo(
text: {
color: colors.primaryDefault,
fontSize: adaptedFontsize,
lineHeight: adaptedLineheight,
...(fontBold && { fontWeight: StyleConstants.Font.Weight.Bold })
lineHeight: adaptedLineheight
},
image: {
width: adaptedFontsize,
@ -58,7 +57,10 @@ const ParseEmojis = React.memo(
}, [theme, adaptiveFontsize])
return (
<CustomText style={styles.text}>
<CustomText
style={styles.text}
fontWeight={fontBold ? 'Bold' : undefined}
>
{emojis ? (
content
.split(regexEmoji)

View File

@ -23,7 +23,7 @@ const CustomText: React.FC<Props & TextProps> = ({
style,
fontStyle,
fontSize,
fontWeight = 'Normal',
fontWeight,
lineHeight,
...rest
}) => {
@ -46,9 +46,11 @@ const CustomText: React.FC<Props & TextProps> = ({
})
},
{
fontWeight: boldTextEnabled
? BoldMapping[fontWeight]
: StyleConstants.Font.Weight[fontWeight]
fontWeight: fontWeight
? boldTextEnabled
? BoldMapping[fontWeight]
: StyleConstants.Font.Weight[fontWeight]
: undefined
}
]}
{...rest}

View File

@ -53,9 +53,9 @@ const TimelineCard = React.memo(({ card }: Props) => {
numberOfLines={2}
style={{
marginBottom: StyleConstants.Spacing.XS,
fontWeight: StyleConstants.Font.Weight.Bold,
color: colors.primaryDefault
}}
fontWeight='Bold'
testID='title'
>
{card.title}

View File

@ -64,10 +64,8 @@ const ComposeEditAttachmentRoot: React.FC<Props> = ({ index }) => {
<View style={{ padding: StyleConstants.Spacing.Global.PagePadding }}>
<CustomText
fontStyle='M'
style={{
fontWeight: StyleConstants.Font.Weight.Bold,
color: colors.primaryDefault
}}
style={{ color: colors.primaryDefault }}
fontWeight='Bold'
>
{t('content.editAttachment.content.altText.heading')}
</CustomText>

View File

@ -2,7 +2,6 @@ import analytics from '@components/analytics'
import Icon from '@components/Icon'
import { useActionSheet } from '@expo/react-native-action-sheet'
import { getInstanceConfigurationStatusMaxAttachments } from '@utils/slices/instancesSlice'
import { StyleConstants } from '@utils/styles/constants'
import layoutAnimation from '@utils/styles/layoutAnimation'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useContext, useMemo } from 'react'
@ -175,13 +174,15 @@ const ComposeActions: React.FC = () => {
return (
<View
accessibilityRole='toolbar'
style={[
styles.additions,
{
backgroundColor: colors.backgroundDefault,
borderTopColor: colors.border
}
]}
style={{
height: 45,
borderTopWidth: StyleSheet.hairlineWidth,
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
backgroundColor: colors.backgroundDefault,
borderTopColor: colors.border
}}
>
<Pressable
accessibilityRole='button'
@ -271,18 +272,6 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
height: '100%'
},
additions: {
height: 45,
borderTopWidth: StyleSheet.hairlineWidth,
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center'
},
count: {
textAlign: 'center',
...StyleConstants.FontStyle.M,
fontWeight: StyleConstants.Font.Weight.Bold
}
})

View File

@ -85,15 +85,12 @@ const TabMeSettingsFontsize: React.FC<
marginBottom: StyleConstants.Spacing.M,
fontSize: adaptiveScale(StyleConstants.Font.Size.M, size),
lineHeight: adaptiveScale(StyleConstants.Font.LineHeight.M, size),
fontWeight:
initialSize === size
? StyleConstants.Font.Weight.Bold
: undefined,
color:
initialSize === size ? colors.primaryDefault : colors.secondary,
borderWidth: StyleSheet.hairlineWidth,
borderColor: colors.border
}}
fontWeight={initialSize === size ? 'Bold' : undefined}
>
{t(`me.fontSize.sizes.${mapFontsizeToName(size)}`)}
</CustomText>

View File

@ -73,10 +73,8 @@ const TabSharedRoot = ({
/>,
<CustomText
fontStyle='M'
style={{
color: colors.primaryDefault,
fontWeight: StyleConstants.Font.Weight.Bold
}}
style={{ color: colors.primaryDefault }}
fontWeight='Bold'
/>
]}
/>

View File

@ -92,11 +92,7 @@ const TabSharedSearch: React.FC<
<Trans
i18nKey='screenTabs:shared.search.empty.general'
components={{
bold: (
<CustomText
style={{ fontWeight: StyleConstants.Font.Weight.Bold }}
/>
)
bold: <CustomText fontWeight='Bold' />
}}
/>
</CustomText>
@ -154,10 +150,10 @@ const TabSharedSearch: React.FC<
<CustomText
fontStyle='M'
style={{
fontWeight: StyleConstants.Font.Weight.Bold,
textAlign: 'center',
color: colors.primaryDefault
}}
fontWeight='Bold'
>
{translation}
</CustomText>
@ -182,11 +178,7 @@ const TabSharedSearch: React.FC<
i18nKey='screenTabs:shared.search.notFound'
values={{ searchTerm: text, type: translation }}
components={{
bold: (
<CustomText
style={{ fontWeight: StyleConstants.Font.Weight.Bold }}
/>
)
bold: <CustomText fontWeight='Bold' />
}}
/>
</CustomText>