@@ -36,6 +36,8 @@ import { AppText as Text } from "../../components/AppText";
3636const ACTION_ITEM_WIDTH = 58 ;
3737const ACTION_CIRCLE_SIZE = 36 ;
3838const ACTION_ICON_SIZE = 15 ;
39+ const COMPACT_ACTION_CIRCLE_SIZE = 28 ;
40+ const COMPACT_ACTION_ICON_SIZE = 13 ;
3941
4042export const THREAD_SWIPE_ACTIONS_WIDTH = ACTION_ITEM_WIDTH * 2 ;
4143export const THREAD_SWIPE_SPRING = {
@@ -163,6 +165,9 @@ export function useSwipeableScrollGate(options?: {
163165export function ThreadSwipeable ( props : {
164166 readonly backgroundColor : ColorValue ;
165167 readonly children : ( close : ( ) => void ) => ReactNode ;
168+ /** Uses action visuals that fit inside compact 44pt rows. The press target
169+ * still spans the row's full height and width. */
170+ readonly compactActions ?: boolean ;
166171 readonly containerStyle ?: StyleProp < ViewStyle > ;
167172 /** Disables NEW swipe activations (e.g. while the list scrolls). */
168173 readonly enabled ?: boolean ;
@@ -258,6 +263,7 @@ export function ThreadSwipeable(props: {
258263 renderRightActions = { ( _progress , translation , methods ) => (
259264 < ThreadSwipeActions
260265 backgroundColor = { props . backgroundColor }
266+ compact = { props . compactActions === true }
261267 fullSwipeAction = { props . fullSwipeAction ?? "delete" }
262268 fullSwipeThreshold = { fullSwipeThreshold }
263269 onDelete = { props . onDelete }
@@ -285,6 +291,7 @@ export function ThreadSwipeable(props: {
285291function SwipeActionButton ( props : {
286292 readonly accessibilityLabel : string ;
287293 readonly backgroundColor : string ;
294+ readonly compact : boolean ;
288295 readonly entryRange : readonly [ number , number ] ;
289296 readonly fullSwipeThreshold : number ;
290297 readonly icon : ComponentProps < typeof SymbolView > [ "name" ] ;
@@ -293,6 +300,8 @@ function SwipeActionButton(props: {
293300 readonly stretchesOnFullSwipe : boolean ;
294301 readonly translation : SharedValue < number > ;
295302} ) {
303+ const circleSize = props . compact ? COMPACT_ACTION_CIRCLE_SIZE : ACTION_CIRCLE_SIZE ;
304+ const iconSize = props . compact ? COMPACT_ACTION_ICON_SIZE : ACTION_ICON_SIZE ;
296305 const actionStyle = useAnimatedStyle ( ( ) => {
297306 const reveal = Math . max ( - props . translation . value , 0 ) ;
298307 const entryProgress = interpolate ( reveal , props . entryRange , [ 0 , 1 ] , Extrapolation . CLAMP ) ;
@@ -324,7 +333,7 @@ function SwipeActionButton(props: {
324333
325334 return {
326335 transform : [ { translateX : - stretch } ] ,
327- width : ACTION_CIRCLE_SIZE + stretch ,
336+ width : circleSize + stretch ,
328337 } ;
329338 } ) ;
330339 const iconStyle = useAnimatedStyle ( ( ) => {
@@ -386,13 +395,13 @@ function SwipeActionButton(props: {
386395 width : "100%" ,
387396 } ) }
388397 >
389- < View style = { { height : ACTION_CIRCLE_SIZE , width : ACTION_CIRCLE_SIZE } } >
398+ < View style = { { height : circleSize , width : circleSize } } >
390399 < Animated . View
391400 style = { [
392401 {
393402 backgroundColor : props . backgroundColor ,
394403 borderRadius : 999 ,
395- height : ACTION_CIRCLE_SIZE ,
404+ height : circleSize ,
396405 left : 0 ,
397406 position : "absolute" ,
398407 top : 0 ,
@@ -404,25 +413,25 @@ function SwipeActionButton(props: {
404413 style = { [
405414 {
406415 alignItems : "center" ,
407- height : ACTION_CIRCLE_SIZE ,
416+ height : circleSize ,
408417 justifyContent : "center" ,
409418 left : 0 ,
410419 position : "absolute" ,
411420 top : 0 ,
412- width : ACTION_CIRCLE_SIZE ,
421+ width : circleSize ,
413422 } ,
414423 iconStyle ,
415424 ] }
416425 >
417- < SymbolView
418- name = { props . icon }
419- size = { ACTION_ICON_SIZE }
420- tintColor = "#ffffff"
421- type = "monochrome"
422- />
426+ < SymbolView name = { props . icon } size = { iconSize } tintColor = "#ffffff" type = "monochrome" />
423427 </ Animated . View >
424428 </ View >
425- < Animated . View style = { [ { paddingTop : 2 } , labelStyle ] } >
429+ < Animated . View
430+ style = { [
431+ { height : 14 , justifyContent : "center" , paddingTop : props . compact ? 0 : 2 } ,
432+ labelStyle ,
433+ ] }
434+ >
426435 < Text className = "text-3xs font-t3-medium text-foreground-muted" numberOfLines = { 1 } >
427436 { props . label }
428437 </ Text >
@@ -434,6 +443,7 @@ function SwipeActionButton(props: {
434443
435444export function ThreadSwipeActions ( props : {
436445 readonly backgroundColor : ColorValue ;
446+ readonly compact : boolean ;
437447 readonly fullSwipeAction ?: "delete" | "primary" ;
438448 readonly fullSwipeThreshold : number ;
439449 readonly onDelete : ( ) => void ;
@@ -466,6 +476,7 @@ export function ThreadSwipeActions(props: {
466476 < SwipeActionButton
467477 accessibilityLabel = { props . primaryAction . accessibilityLabel }
468478 backgroundColor = "#007aff"
479+ compact = { props . compact }
469480 entryRange = { [ ACTION_ITEM_WIDTH * 0.55 , THREAD_SWIPE_ACTIONS_WIDTH * 0.85 ] }
470481 fullSwipeThreshold = { props . fullSwipeThreshold }
471482 icon = { props . primaryAction . icon }
@@ -477,6 +488,7 @@ export function ThreadSwipeActions(props: {
477488 < SwipeActionButton
478489 accessibilityLabel = { `Delete ${ props . threadTitle } ` }
479490 backgroundColor = "#ff2d55"
491+ compact = { props . compact }
480492 entryRange = { [ 8 , ACTION_ITEM_WIDTH * 0.72 ] }
481493 fullSwipeThreshold = { props . fullSwipeThreshold }
482494 icon = "trash"
0 commit comments