add layout animation to contenthider
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
import React from 'react'
|
import {useMemo, useState} from 'react'
|
||||||
import {type StyleProp, View, type ViewStyle} from 'react-native'
|
import {
|
||||||
|
LayoutAnimation,
|
||||||
|
type StyleProp,
|
||||||
|
View,
|
||||||
|
type ViewStyle,
|
||||||
|
} from 'react-native'
|
||||||
import {type ModerationUI} from '@atproto/api'
|
import {type ModerationUI} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
@@ -64,16 +69,17 @@ function ContentHiderActive({
|
|||||||
style,
|
style,
|
||||||
childContainerStyle,
|
childContainerStyle,
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<{
|
}: {
|
||||||
testID?: string
|
testID?: string
|
||||||
modui: ModerationUI
|
modui: ModerationUI
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
childContainerStyle?: StyleProp<ViewStyle>
|
childContainerStyle?: StyleProp<ViewStyle>
|
||||||
}>) {
|
children?: React.ReactNode
|
||||||
|
}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const [override, setOverride] = React.useState(false)
|
const [override, setOverride] = useState(false)
|
||||||
const control = useModerationDetailsDialogControl()
|
const control = useModerationDetailsDialogControl()
|
||||||
const {labelDefs} = useLabelDefinitions()
|
const {labelDefs} = useLabelDefinitions()
|
||||||
const globalLabelStrings = useGlobalLabelStrings()
|
const globalLabelStrings = useGlobalLabelStrings()
|
||||||
@@ -81,7 +87,7 @@ function ContentHiderActive({
|
|||||||
const blur = modui?.blurs[0]
|
const blur = modui?.blurs[0]
|
||||||
const desc = useModerationCauseDescription(blur)
|
const desc = useModerationCauseDescription(blur)
|
||||||
|
|
||||||
const labelName = React.useMemo(() => {
|
const labelName = useMemo(() => {
|
||||||
if (!modui?.blurs || !blur) {
|
if (!modui?.blurs || !blur) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
@@ -150,6 +156,7 @@ function ContentHiderActive({
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if (!modui.noOverride) {
|
if (!modui.noOverride) {
|
||||||
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
||||||
setOverride(v => !v)
|
setOverride(v => !v)
|
||||||
} else {
|
} else {
|
||||||
control.open()
|
control.open()
|
||||||
|
|||||||
Reference in New Issue
Block a user