import { FC, useCallback, useMemo } from "react" import { LayoutAnimation, Linking, Platform, TextStyle, useColorScheme, View, ViewStyle, } from "react-native" import * as Application from "expo-application" import { Button } from "@/components/Button" import { ListItem } from "@/components/ListItem" import { Screen } from "@/components/Screen" import { Text } from "@/components/Text" import { useAuth } from "@/context/AuthContext" import { isRTL } from "@/i18n" import { DemoTabScreenProps } from "@/navigators/navigationTypes" import type { ThemedStyle } from "@/theme/types" import { useAppTheme } from "@/theme/context" import { $styles } from "@/theme/styles" /** * @param {string} url - The URL to open in the browser. * @returns {void} - No return value. */ function openLinkInBrowser(url: string) { Linking.canOpenURL(url).then((canOpen) => canOpen && Linking.openURL(url)) } const usingHermes = typeof HermesInternal === "object" && HermesInternal !== null export const DemoDebugScreen: FC> = function DemoDebugScreen( _props, ) { const { setThemeContextOverride, themeContext, themed } = useAppTheme() const { logout } = useAuth() // @ts-expect-error const usingFabric = global.nativeFabricUIManager != null const demoReactotron = useMemo( () => async () => { if (__DEV__) { console.tron.display({ name: "DISPLAY", value: { appId: Application.applicationId, appName: Application.applicationName, appVersion: Application.nativeApplicationVersion, appBuildVersion: Application.nativeBuildVersion, hermesEnabled: usingHermes, }, important: true, }) } }, [], ) const toggleTheme = useCallback(() => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut) // Animate the transition setThemeContextOverride(themeContext === "dark" ? "light" : "dark") }, [themeContext, setThemeContextOverride]) // Resets the theme to the system theme const colorScheme = useColorScheme() const resetTheme = useCallback(() => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut) setThemeContextOverride(undefined) }, [setThemeContextOverride]) return ( openLinkInBrowser("https://github.com/infinitered/ignite/issues")} /> Current system theme: {colorScheme} Current app theme: {themeContext}