diff --git a/src/core/ui/components/AddonPage.tsx b/src/core/ui/components/AddonPage.tsx index 7a07141..66b82bc 100644 --- a/src/core/ui/components/AddonPage.tsx +++ b/src/core/ui/components/AddonPage.tsx @@ -2,6 +2,7 @@ import { CardWrapper } from "@core/ui/components/AddonCard"; import { findAssetId } from "@lib/api/assets"; import { settings } from "@lib/api/settings"; import { useProxy } from "@lib/api/storage"; +import AlertModal, { AlertActionButton } from "@lib/ui/components/wrappers/AlertModal"; import isValidHttpUrl from "@lib/utils/isValidHttpUrl"; import { lazyDestructure } from "@lib/utils/lazy"; import { findByProps } from "@metro"; @@ -14,7 +15,6 @@ import { Image, ScrollView, View } from "react-native"; const { showSimpleActionSheet, hideActionSheet } = lazyDestructure(() => findByProps("showSimpleActionSheet")); const { openAlert, dismissAlert } = lazyDestructure(() => findByProps("openAlert", "dismissAlert")); -const { AlertModal, AlertActionButton } = lazyDestructure(() => findByProps("AlertModal", "AlertActions")); type SearchKeywords = Array string)>; @@ -55,7 +55,7 @@ function InputAlert(props: { label: string, fetchFn: (url: string) => Promise findByProps("AlertModal", "AlertActions")); + +type ActionButtonProps = Omit, "onPress"> & { + onPress?: () => void | Promise; +}; + +export const AlertActionButton = _AlertActionButton as ComponentType; + +export default function AlertModal(props: Record) { + const { width: windowWidth } = useWindowDimensions(); + + // ponyfill for extraContent + if ("extraContent" in props) { + props.content = ( + + + {props.content as string} + + + {props.extraContent as ReactNode} + + + ); + + delete props.extraContent; + } + + return <_AlertModal {...props} />; +} diff --git a/src/metro/common/types/components.ts b/src/metro/common/types/components.ts index 24b2a95..43c4233 100644 --- a/src/metro/common/types/components.ts +++ b/src/metro/common/types/components.ts @@ -25,6 +25,7 @@ interface ButtonProps { scaleAmountInPx?: number; icon?: ImageSourcePropType | ReactNode; style?: Style; + grow?: boolean; } export type Button = React.ForwardRefExoticComponent;