From 72b7516d9bcd23b1587d4fdf732c25c1b63bd78e Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 27 Jan 2026 20:02:55 -0600 Subject: [PATCH] Prompts refresh (#9781) * Round boi * Wrap a few things in Prompt.Content * Couple tweaks --- .../Post/Embed/ExternalEmbed/Gif.tsx | 10 +-- src/components/Prompt.tsx | 66 ++++++++----------- .../StarterPack/ProfileStarterPacks.tsx | 20 +++--- .../components/ThreadItemAnchor.tsx | 50 +++++++------- .../Profile/Header/ProfileHeaderLabeler.tsx | 16 +++-- .../components/DeactivateAccountDialog.tsx | 6 +- .../StarterPack/StarterPackLandingScreen.tsx | 20 +++--- 7 files changed, 88 insertions(+), 100 deletions(-) diff --git a/src/components/Post/Embed/ExternalEmbed/Gif.tsx b/src/components/Post/Embed/ExternalEmbed/Gif.tsx index 28310dba86..cbfafcf3a2 100644 --- a/src/components/Post/Embed/ExternalEmbed/Gif.tsx +++ b/src/components/Post/Embed/ExternalEmbed/Gif.tsx @@ -198,10 +198,12 @@ function AltText({text}: {text: string}) { - - Alt Text - - {text} + + + Alt Text + + {text} + control.close()} diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx index a7bd895219..cdafa85c7e 100644 --- a/src/components/Prompt.tsx +++ b/src/components/Prompt.tsx @@ -1,15 +1,9 @@ -import React from 'react' +import {createContext, useCallback, useContext, useId, useMemo} from 'react' import {type GestureResponderEvent, View} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' -import { - atoms as a, - useBreakpoints, - useTheme, - type ViewStyleProp, - web, -} from '#/alf' +import {atoms as a, useTheme, type ViewStyleProp, web} from '#/alf' import {Button, type ButtonColor, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {Text} from '#/components/Typography' @@ -20,7 +14,7 @@ export { useDialogControl as usePromptControl, } from '#/components/Dialog' -const Context = React.createContext<{ +const Context = createContext<{ titleId: string descriptionId: string }>({ @@ -37,12 +31,15 @@ export function Outer({ }: React.PropsWithChildren<{ control: Dialog.DialogControlProps testID?: string + /** + * Native-specific options for the prompt. Extends `BottomSheetViewProps` + */ nativeOptions?: Omit }>) { - const titleId = React.useId() - const descriptionId = React.useId() + const titleId = useId() + const descriptionId = useId() - const context = React.useMemo( + const context = useMemo( () => ({titleId, descriptionId}), [titleId, descriptionId], ) @@ -58,7 +55,7 @@ export function Outer({ + style={web([{maxWidth: 320, borderRadius: 36}])}> {children} @@ -70,7 +67,7 @@ export function TitleText({ children, style, }: React.PropsWithChildren) { - const {titleId} = React.useContext(Context) + const {titleId} = useContext(Context) return ( @@ -92,7 +89,7 @@ export function DescriptionText({ selectable, }: React.PropsWithChildren<{selectable?: boolean}>) { const t = useTheme() - const {descriptionId} = React.useContext(Context) + const {descriptionId} = useContext(Context) return ( ) { - const {gtMobile} = useBreakpoints() +export function Actions({children}: {children: React.ReactNode}) { + return {children} +} - return ( - - {children} - - ) +export function Content({children}: {children: React.ReactNode}) { + return {children} } export function Cancel({ @@ -130,9 +117,8 @@ export function Cancel({ cta?: string }) { const {_} = useLingui() - const {gtMobile} = useBreakpoints() const {close} = Dialog.useDialogContext() - const onPress = React.useCallback(() => { + const onPress = useCallback(() => { close() }, [close]) @@ -140,7 +126,7 @@ export function Cancel({