Fix image peek in carousels for quote posts (#10688)
Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -87,8 +87,7 @@ export function ImageEmbed({
|
|||||||
crop={
|
crop={
|
||||||
rest.viewContext === PostEmbedViewContext.ThreadHighlighted
|
rest.viewContext === PostEmbedViewContext.ThreadHighlighted
|
||||||
? 'none'
|
? 'none'
|
||||||
: rest.viewContext ===
|
: rest.isWithinQuote
|
||||||
PostEmbedViewContext.FeedEmbedRecordWithMedia
|
|
||||||
? 'square'
|
? 'square'
|
||||||
: 'constrained'
|
: 'constrained'
|
||||||
}
|
}
|
||||||
@@ -103,10 +102,7 @@ export function ImageEmbed({
|
|||||||
onPress(0, [containerRef], [dims])
|
onPress(0, [containerRef], [dims])
|
||||||
}
|
}
|
||||||
onPressIn={() => onPressIn(0)}
|
onPressIn={() => onPressIn(0)}
|
||||||
hideBadge={
|
hideBadge={rest.isWithinQuote}
|
||||||
rest.viewContext ===
|
|
||||||
PostEmbedViewContext.FeedEmbedRecordWithMedia
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</ImageContextMenu>
|
</ImageContextMenu>
|
||||||
</View>
|
</View>
|
||||||
@@ -121,6 +117,7 @@ export function ImageEmbed({
|
|||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
onPressIn={onPressIn}
|
onPressIn={onPressIn}
|
||||||
viewContext={rest.viewContext}
|
viewContext={rest.viewContext}
|
||||||
|
isWithinQuote={rest.isWithinQuote}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ interface GalleryProps {
|
|||||||
) => void
|
) => void
|
||||||
onPressIn?: (index: number) => void
|
onPressIn?: (index: number) => void
|
||||||
viewContext?: PostEmbedViewContext
|
viewContext?: PostEmbedViewContext
|
||||||
|
isWithinQuote?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const Context = createContext<{
|
const Context = createContext<{
|
||||||
@@ -97,6 +98,7 @@ export function Gallery({
|
|||||||
onPress,
|
onPress,
|
||||||
onPressIn,
|
onPressIn,
|
||||||
viewContext,
|
viewContext,
|
||||||
|
isWithinQuote,
|
||||||
}: GalleryProps) {
|
}: GalleryProps) {
|
||||||
const {t: l} = useLingui()
|
const {t: l} = useLingui()
|
||||||
const ax = useAnalytics()
|
const ax = useAnalytics()
|
||||||
@@ -104,14 +106,21 @@ export function Gallery({
|
|||||||
const largeAltBadge = useLargeAltBadgeEnabled()
|
const largeAltBadge = useLargeAltBadgeEnabled()
|
||||||
const bps = useBreakpoints()
|
const bps = useBreakpoints()
|
||||||
const window = useWindowDimensions()
|
const window = useWindowDimensions()
|
||||||
const isWithinQuote =
|
|
||||||
viewContext === PostEmbedViewContext.FeedEmbedRecordWithMedia
|
|
||||||
const isWithinChat = viewContext === PostEmbedViewContext.ChatMessage
|
const isWithinChat = viewContext === PostEmbedViewContext.ChatMessage
|
||||||
const hideBadges = isWithinQuote
|
const hideBadges = isWithinQuote
|
||||||
const contentHeight = useMemo(() => {
|
const contentHeight = useMemo(() => {
|
||||||
if (isWithinChat) {
|
if (isWithinChat) {
|
||||||
return 120
|
return 120
|
||||||
}
|
}
|
||||||
|
if (isWithinQuote) {
|
||||||
|
if (bps.gtMobile) {
|
||||||
|
return 220
|
||||||
|
} else if (bps.gtPhone) {
|
||||||
|
return 190
|
||||||
|
} else {
|
||||||
|
return 150
|
||||||
|
}
|
||||||
|
}
|
||||||
if (bps.gtMobile) {
|
if (bps.gtMobile) {
|
||||||
return 300
|
return 300
|
||||||
} else if (bps.gtPhone) {
|
} else if (bps.gtPhone) {
|
||||||
@@ -119,7 +128,7 @@ export function Gallery({
|
|||||||
} else {
|
} else {
|
||||||
return 200
|
return 200
|
||||||
}
|
}
|
||||||
}, [bps, isWithinChat])
|
}, [bps, isWithinChat, isWithinQuote])
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Container overflow styles
|
* Container overflow styles
|
||||||
@@ -220,7 +229,7 @@ export function Gallery({
|
|||||||
crop={
|
crop={
|
||||||
viewContext === PostEmbedViewContext.ThreadHighlighted
|
viewContext === PostEmbedViewContext.ThreadHighlighted
|
||||||
? 'none'
|
? 'none'
|
||||||
: viewContext === PostEmbedViewContext.FeedEmbedRecordWithMedia
|
: isWithinQuote
|
||||||
? 'square'
|
? 'square'
|
||||||
: 'constrained'
|
: 'constrained'
|
||||||
}
|
}
|
||||||
@@ -229,9 +238,7 @@ export function Gallery({
|
|||||||
onPress?.(index, [containerRef], [dims])
|
onPress?.(index, [containerRef], [dims])
|
||||||
}
|
}
|
||||||
onPressIn={() => onPressIn?.(index)}
|
onPressIn={() => onPressIn?.(index)}
|
||||||
hideBadge={
|
hideBadge={isWithinQuote}
|
||||||
viewContext === PostEmbedViewContext.FeedEmbedRecordWithMedia
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user