From 4247a755676019547bacf0b46fc401c26bd4034d Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Thu, 13 Aug 2026 01:43:43 +0700 Subject: [PATCH] feat(lib/discord/types): type ActionSheet related exports more accurately --- lib/discord/src/types/index.ts | 60 +++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/lib/discord/src/types/index.ts b/lib/discord/src/types/index.ts index f87f343..5aa566d 100644 --- a/lib/discord/src/types/index.ts +++ b/lib/discord/src/types/index.ts @@ -1,10 +1,11 @@ import type { StackScreenProps } from '@react-navigation/stack' import type { ReactNavigationParamList } from '@revenge-mod/externals/react-navigation' -import type { AnyFunction } from '@revenge-mod/utils/types' +import type { AnyFunction, AnyObject } from '@revenge-mod/utils/types' import type { ComponentProps, ComponentType, FC, + ForwardRefExoticComponent, MemoExoticComponent, ReactElement, ReactNode, @@ -180,9 +181,20 @@ export namespace DiscordModules { openLazy>( sheet: Promise<{ default: T }>, key: string, - props: ComponentProps, + props: { + impressionName?: string + impressionProperties?: AnyObject + backdropKind?: string + disableHapticOnOpen?: boolean + appEntryKey?: string + } & ComponentProps, + // See ActionSheetStore reducer + stackingBehavior?: 'replaceTopSheet' | 'replaceAll' | 'stack', ): void hideActionSheet(key?: string): void + hideAllActionSheets(): void + setActionSheetZIndex(zIndex: number): void + resetActionSheetsForAppEntryKey(appEntryKey: string): void } // export namespace ActionSheetActionCreators { @@ -397,10 +409,50 @@ export namespace DiscordModules { // export type FormCheckbox = FC export interface ActionSheetProps { - children: ReactNode + scrollable?: boolean + startExpanded?: boolean + /** Whether the bottom sheet handle is disabled. */ + handleDisabled?: boolean + showGradient?: boolean + + startHeight?: number + maxHeight?: number + containerHeight?: number + contentHeight?: number + backdropOpacity?: number + + children?: ReactNode + header?: ReactNode + footer?: ReactNode + extraContent?: ReactNode + backdropChildren?: ReactNode + + handleComponent?: ComponentType | null + backgroundComponent?: ComponentType + + bodyStyles?: StyleProp + contentStyles?: StyleProp + backgroundStyles?: StyleProp + borderGradient?: string[] | Record + + onExpand?: () => void + onDismiss?: () => void + animatedIndex?: unknown + + keyboardShouldPersistTaps?: 'always' | 'never' | 'handled' | boolean + dismissAccessibilityLabel?: string } - export type ActionSheet = FC + export type ActionSheet = ForwardRefExoticComponent< + ActionSheetProps & + // See useBottomSheetImperativeHandle + RefAttributes<{ + expandActionSheet(): void + closeActionSheet(force?: boolean): void + collapseActionSheet(): void + snapToIndex(index: number): void + }> + > export interface ActionSheetCloseButtonProps extends Pick, 'variant' | 'onPress'> {}