# thomino/expo-playground architecture

> Architecture diagram of the GitHub repository thomino/expo-playground, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thomino/expo-playground
- Repository: https://github.com/thomino/expo-playground

## Overview

##### Project type and purpose
- This is a single-page mobile application built with React Native + Expo.
- It’s a “playground” app demonstrating UI features: onboarding slider, masonry grid, light/dark theming, etc.

##### File structure
- Top-level code lives under:
- app/ – core React components, screens, hooks, contexts, and the entry point (index.tsx)
- components/ – reusable UI components (Header, SlideUp, ThemeToggle, etc.)
- utils/ & lib/ – pure utilities and helpers (date, BackHandlerManager, useShadow, etc.)
- assets/ – images and Lottie animation JSONs
- Config & build scripts: metro.config.js, babel.config.js, postcss.config.js, tailwind.config.js, tsconfig.json, plus standard package.json & app.json for Expo.

##### README for additional insights
- Light/dark theme toggle
- Masonry layout screen
- Onboarding slider
- Built with Expo + React Native, tailwind/nativewind for styling.

##### Diagramming recommendations
- Use **clear labels** for each layer/component (e.g., “ThemeContext Provider,” “Onboarding Screen”).
- From user → UI components → navigation → screens → contexts/utilities.
- From bundler → JS bundle → Expo runtime → native platform.
- Another for state management (contexts/hooks)
- A third for build/config (Metro/Babel/Expo)
- A fourth for assets & utils

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    User["User"]:::external

    %% Build & Config Layer
    subgraph "Build & Config" 
        Metro["Metro Bundler"]:::build
        Babel["Babel Transforms"]:::build
        ExpoRuntime["Expo Runtime"]:::build
        AppJSON["app.json"]:::build
        MetroConfig["metro.config.js"]:::build
        BabelConfig["babel.config.js"]:::build
        TSConfig["tsconfig.json"]:::build
        CesConfig["cesconfig.json"]:::build
        PrettierConfig["prettier.config.js"]:::build
        AppEnv["app-env.d.ts"]:::build
        PackageJSON["package.json"]:::build
        PackageLock["package-lock.json"]:::build
        Metro -->|bundles JS| Babel
        Babel -->|outputs bundle| ExpoRuntime
        ExpoRuntime -->|runs on| User
    end

    %% Entry & Context Layer
    subgraph "Entry & Context"
        Entry["app/index.tsx"]:::entry
        ThemeCtx["ThemeContext Provider"]:::state
        ColorsCtx["ThemeColors Context"]:::state
        Entry -->|wraps| ThemeCtx
        Entry -->|wraps| ColorsCtx
        ThemeCtx -->|provides theme| Navigation
        ColorsCtx -->|provides colors| Navigation
    end

    %% Navigation Layer
    subgraph "Navigation"
        Navigation["NavigationContainer"]:::navigation
        ThemedNav["useThemedNavigation()"]:::navigation
        Navigation -->|uses hook| ThemedNav
    end

    %% UI Layer
    subgraph "UI Layer"
        subgraph "Screens"
            Onboarding["Onboarding Screen"]:::ui
            Masonry["Masonry Grid Screen"]:::ui
        end
        subgraph "Components"
            Header["Header"]:::ui
            SlideUp["SlideUp"]:::ui
            ThemeToggle["ThemeToggle"]:::ui
            ThemeToggleNew["ThemeToggleNew"]:::ui
        end
        Navigation -->|routes to| Onboarding
        Navigation -->|routes to| Masonry
        Onboarding -->|uses| Header
        Onboarding -->|uses| SlideUp
        Onboarding -->|uses| ThemeToggle
        Masonry -->|uses| Header
        Masonry -->|uses| ThemeToggleNew
    end

    %% Styling Engine
    subgraph "Styling Engine"
        TailwindConfig["tailwind.config.js"]:::build
        PostCSS["postcss.config.js"]:::build
        NativewindTypes["nativewind-env.d.ts"]:::build
        GlobalStyles["global.css"]:::build
        TailwindConfig --> PostCSS
        PostCSS --> GlobalStyles
    end
    UIStyle["Nativewind/Tailwind"]:::build
    GlobalStyles -->|styles applied at runtime| UIStyle
    UIStyle -->|used by| Onboarding
    UIStyle -->|used by| Masonry
    UIStyle -->|used by| Header

    %% Utilities & Helpers
    subgraph "Utilities & Helpers"
        Utils["lib/utils.ts"]:::utils
        BackHandler["utils/BackHandlerManager.tsx"]:::utils
        DateUtils["utils/date.ts"]:::utils
        ShadowHook["utils/useShadow.ts"]:::utils
        Onboarding -->|calls| Utils
        Onboarding -->|uses| BackHandler
        Masonry -->|uses| DateUtils
        Header -->|uses| ShadowHook
    end

    %% Assets
    subgraph "Assets"
        ImgDir["assets/img"]:::assets
        Lottie1["welcome-1.json"]:::assets
        Lottie2["welcome-2.json"]:::assets
        Lottie3["welcome-3.json"]:::assets
        Onboarding -->|loads| ImgDir
        Onboarding -->|loads| Lottie1
        Onboarding -->|loads| Lottie2
        Onboarding -->|loads| Lottie3
    end

    %% Connections from Entry
    User -->|launches| Entry
    ExpoRuntime -->|loads bundle| Entry

    %% Click Events
    click MetroConfig "https://github.com/thomino/expo-playground/blob/main/metro.config.js"
    click BabelConfig "https://github.com/thomino/expo-playground/blob/main/babel.config.js"
    click AppJSON "https://github.com/thomino/expo-playground/blob/main/app.json"
    click TSConfig "https://github.com/thomino/expo-playground/blob/main/tsconfig.json"
    click Entry "https://github.com/thomino/expo-playground/blob/main/app/index.tsx"
    click ThemeCtx "https://github.com/thomino/expo-playground/blob/main/app/contexts/ThemeContext.tsx"
    click ColorsCtx "https://github.com/thomino/expo-playground/blob/main/app/contexts/ThemeColors.tsx"
    click ThemedNav "https://github.com/thomino/expo-playground/blob/main/app/hooks/useThemedNavigation.tsx"
    click Onboarding "https://github.com/thomino/expo-playground/blob/main/app/screens/onboarding.tsx"
    click Masonry "https://github.com/thomino/expo-playground/blob/main/app/screens/masonry.tsx"
    click Header "https://github.com/thomino/expo-playground/blob/main/components/Header.tsx"
    click SlideUp "https://github.com/thomino/expo-playground/blob/main/components/SlideUp.tsx"
    click ThemeToggle "https://github.com/thomino/expo-playground/blob/main/components/ThemeToggle.tsx"
    click ThemeToggleNew "https://github.com/thomino/expo-playground/blob/main/components/ThemeToggleNew.tsx"
    click TailwindConfig "https://github.com/thomino/expo-playground/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/thomino/expo-playground/blob/main/postcss.config.js"
    click NativewindTypes "https://github.com/thomino/expo-playground/blob/main/nativewind-env.d.ts"
    click GlobalStyles "https://github.com/thomino/expo-playground/blob/main/global.css"
    click Utils "https://github.com/thomino/expo-playground/blob/main/lib/utils.ts"
    click BackHandler "https://github.com/thomino/expo-playground/blob/main/utils/BackHandlerManager.tsx"
    click DateUtils "https://github.com/thomino/expo-playground/blob/main/utils/date.ts"
    click ShadowHook "https://github.com/thomino/expo-playground/blob/main/utils/useShadow.ts"
    click ImgDir "https://github.com/thomino/expo-playground/tree/main/assets/img"
    click Lottie1 "https://github.com/thomino/expo-playground/blob/main/assets/lottie/welcome-1.json"
    click Lottie2 "https://github.com/thomino/expo-playground/blob/main/assets/lottie/welcome-2.json"
    click Lottie3 "https://github.com/thomino/expo-playground/blob/main/assets/lottie/welcome-3.json"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:2px
    classDef build fill:#f96,stroke:#333,stroke-width:1px
    classDef entry fill:#ccf,stroke:#333,stroke-width:1px
    classDef state fill:#9cf,stroke:#333,stroke-width:1px
    classDef navigation fill:#6cf,stroke:#333,stroke-width:1px
    classDef ui fill:#cfc,stroke:#333,stroke-width:1px
    classDef utils fill:#ff9,stroke:#333,stroke-width:1px
    classDef assets fill:#ddd,stroke:#333,stroke-width:1px
```
