import {TouchableWithoutFeedback, View} from 'react-native' import * as Clipboard from 'expo-clipboard' import {atoms as a, useTheme} from '#/alf' import * as Prompt from '#/components/Prompt' import * as Toast from '#/components/Toast' import {Text} from '#/components/Typography' import {useDevMode} from '#/storage/hooks/dev-mode' /** * Internal-use component to display debug information supplied by the appview. * The `debug` field only exists on some API views, and is only visible for * internal users in dev mode. As such, none of these strings need to be * translated. * * This component can be removed at any time if we don't find it useful. */ export function DebugFieldDisplay({ subject, }: { subject: T }) { const t = useTheme() const [devMode] = useDevMode() const prompt = Prompt.usePromptControl() if (!devMode) return if (!subject.debug) return return ( <> { Clipboard.setStringAsync(JSON.stringify(subject.debug, null, 2)) Toast.show('Copied to clipboard', {type: 'success'}) }} /> { e.preventDefault() e.stopPropagation() prompt.open() return false }}> Debug {JSON.stringify(subject.debug)} ) }