Optimize ContentHider (#6501)
This commit is contained in:
@@ -31,6 +31,37 @@ export function ContentHider({
|
|||||||
ignoreMute?: boolean
|
ignoreMute?: boolean
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
childContainerStyle?: StyleProp<ViewStyle>
|
childContainerStyle?: StyleProp<ViewStyle>
|
||||||
|
}>) {
|
||||||
|
const blur = modui?.blurs[0]
|
||||||
|
if (!blur || (ignoreMute && isJustAMute(modui))) {
|
||||||
|
return (
|
||||||
|
<View testID={testID} style={style}>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<ContentHiderActive
|
||||||
|
testID={testID}
|
||||||
|
modui={modui}
|
||||||
|
style={style}
|
||||||
|
childContainerStyle={childContainerStyle}>
|
||||||
|
{children}
|
||||||
|
</ContentHiderActive>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ContentHiderActive({
|
||||||
|
testID,
|
||||||
|
modui,
|
||||||
|
style,
|
||||||
|
childContainerStyle,
|
||||||
|
children,
|
||||||
|
}: React.PropsWithChildren<{
|
||||||
|
testID?: string
|
||||||
|
modui: ModerationUI
|
||||||
|
style?: StyleProp<ViewStyle>
|
||||||
|
childContainerStyle?: StyleProp<ViewStyle>
|
||||||
}>) {
|
}>) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
@@ -40,7 +71,6 @@ export function ContentHider({
|
|||||||
const {labelDefs} = useLabelDefinitions()
|
const {labelDefs} = useLabelDefinitions()
|
||||||
const globalLabelStrings = useGlobalLabelStrings()
|
const globalLabelStrings = useGlobalLabelStrings()
|
||||||
const {i18n} = useLingui()
|
const {i18n} = useLingui()
|
||||||
|
|
||||||
const blur = modui?.blurs[0]
|
const blur = modui?.blurs[0]
|
||||||
const desc = useModerationCauseDescription(blur)
|
const desc = useModerationCauseDescription(blur)
|
||||||
|
|
||||||
@@ -99,14 +129,6 @@ export function ContentHider({
|
|||||||
globalLabelStrings,
|
globalLabelStrings,
|
||||||
])
|
])
|
||||||
|
|
||||||
if (!blur || (ignoreMute && isJustAMute(modui))) {
|
|
||||||
return (
|
|
||||||
<View testID={testID} style={style}>
|
|
||||||
{children}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View testID={testID} style={[a.overflow_hidden, style]}>
|
<View testID={testID} style={[a.overflow_hidden, style]}>
|
||||||
<ModerationDetailsDialog control={control} modcause={blur} />
|
<ModerationDetailsDialog control={control} modcause={blur} />
|
||||||
|
|||||||
Reference in New Issue
Block a user