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

Remove most React memo

Maybe would solve iOS out of memory crashes
This commit is contained in:
xmflsct
2022-12-24 01:18:20 +01:00
parent 1e0e8842db
commit b6045e5121
19 changed files with 517 additions and 600 deletions

View File

@ -13,43 +13,34 @@ export interface Props {
highlighted?: boolean
}
const HeaderSharedCreated = React.memo(
({ created_at, edited_at, highlighted = false }: Props) => {
const { t } = useTranslation('componentTimeline')
const { colors } = useTheme()
const HeaderSharedCreated: React.FC<Props> = ({ created_at, edited_at, highlighted = false }) => {
const { t } = useTranslation('componentTimeline')
const { colors } = useTheme()
const actualTime = edited_at || created_at
const actualTime = edited_at || created_at
return (
<>
<CustomText fontStyle='S' style={{ color: colors.secondary }}>
{highlighted ? (
<>
<FormattedDate
value={new Date(actualTime)}
dateStyle='medium'
timeStyle='short'
/>
</>
) : (
<RelativeTime time={actualTime} />
)}
</CustomText>
{edited_at ? (
<Icon
accessibilityLabel={t(
'shared.header.shared.edited.accessibilityLabel'
)}
name='Edit'
size={StyleConstants.Font.Size.S}
color={colors.secondary}
style={{ marginLeft: StyleConstants.Spacing.S }}
/>
) : null}
</>
)
},
(prev, next) => prev.edited_at === next.edited_at
)
return (
<>
<CustomText fontStyle='S' style={{ color: colors.secondary }}>
{highlighted ? (
<>
<FormattedDate value={new Date(actualTime)} dateStyle='medium' timeStyle='short' />
</>
) : (
<RelativeTime time={actualTime} />
)}
</CustomText>
{edited_at ? (
<Icon
accessibilityLabel={t('shared.header.shared.edited.accessibilityLabel')}
name='Edit'
size={StyleConstants.Font.Size.S}
color={colors.secondary}
style={{ marginLeft: StyleConstants.Spacing.S }}
/>
) : null}
</>
)
}
export default HeaderSharedCreated