# brunnohofmann/react-native-left-and-right-navigator architecture

> Architecture diagram of the GitHub repository brunnohofmann/react-native-left-and-right-navigator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brunnohofmann/react-native-left-and-right-navigator
- Repository: https://github.com/brunnohofmann/react-native-left-and-right-navigator

## Overview

##### Project type and purpose
- This is a React Native mobile application demonstrating a Left and Right Drawer Navigator pattern.
- It targets both Android and iOS platforms and has no backend service—it’s purely a client-side app using Redux for state management and React Navigation for routing.

##### File structure
- Top-level native folders:
- android/ (Gradle-based Android project)
- ios/ (Xcode workspace and projects for iOS and tvOS)
- JS entry points and configuration:
- index.js → App registration
- App.js → root component, wraps NavigationContainer and Redux Provider
- metro.config.js, babel.config.js → bundler/transpiler configs
- Source code under src/:
- src/routes/ → drawer and stack navigator definitions (LeftDrawer.js, RightDrawer.js, MainStack.js, MainNavigator.js)
- src/screens/ → screen components (Home.js, Users.js)
- src/redux/ → Redux “duck” modules, actions.js, types.js, configureStore.js
- src/assets/ → styles, images, other static assets
- Tests under __tests__ for unit tests of core components

##### README for additional insights
- The README confirms the goal: implement two drawer navigators.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Native Host Layer
    subgraph "Native Host" 
        direction TB
        MainActivity["MainActivity.java"]:::native
        AppDelegate["AppDelegate.m"]:::native
    end

    %% JS Bundle & Runtime
    subgraph "JS Bundle & Runtime"
        direction TB
        Metro["Metro Bundler"]:::jsframework
        JSRuntime["JS Runtime (Hermes/JSC)"]:::jsframework
    end

    %% Entry Points & Root
    subgraph "Entry & Root"
        direction TB
        index["index.js"]:::jsframework
        App["App.js"]:::jsframework
        Asset["styles & Static Assets\n(src/assets/styles.js)"]:::jsframework
    end

    %% Redux State Management
    subgraph "Redux State" 
        direction TB
        Ducks["appConfig duck\n(src/redux/appConfig/duck.js)"]:::state
        Actions["actions.js\n(src/redux/actions.js)"]:::state
        Types["types.js\n(src/redux/types.js)"]:::state
        Store["Redux Store\n(configureStore.js)"]:::state
    end

    %% Navigation Layer
    subgraph "Navigation" 
        direction TB
        NavContainer["MainNavigator.js"]:::nav
        LeftDrawer["LeftDrawer.js"]:::nav
        RightDrawer["RightDrawer.js"]:::nav
        Stack["MainStack.js"]:::nav
    end

    %% Screens
    subgraph "Screens" 
        direction TB
        Home["Home.js"]:::screen
        Users["Users.js"]:::screen
    end

    %% Startup & Data Flow
    MainActivity -->|launches| index
    AppDelegate -->|launches| index
    index -->|"loads bundle"| Metro
    Metro -->|"provides bundle to"| JSRuntime
    JSRuntime -->|"executes"| App
    App -->|"imports"| Asset
    App -->|"wraps with Provider"| Store
    Ducks --> Store
    Actions --> Store
    Types --> Store
    App -->|"contains NavigationContainer"| NavContainer
    NavContainer -->|"uses"| LeftDrawer
    NavContainer -->|"uses"| RightDrawer
    NavContainer -->|"wraps"| Stack
    Stack -->|"navigates to"| Home
    Stack -->|"navigates to"| Users
    Home -->|"dispatches actions"| Actions
    Users -->|"dispatches actions"| Actions
    Store -->|"provides state to"| Home
    Store -->|"provides state to"| Users

    %% Click Events
    click MainActivity "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/android/app/src/main/java/com/reactnativeleftandrightdrawernavigators/MainActivity.java"
    click AppDelegate "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/ios/ReactNativeLeftAndRightDrawerNavigators/AppDelegate.m"
    click Metro "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/metro.config.js"
    click index "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/index.js"
    click App "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/App.js"
    click Store "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/redux/configureStore.js"
    click Ducks "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/redux/appConfig/duck.js"
    click Actions "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/redux/actions.js"
    click Types "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/redux/types.js"
    click NavContainer "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/routes/MainNavigator.js"
    click LeftDrawer "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/routes/LeftDrawer.js"
    click RightDrawer "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/routes/RightDrawer.js"
    click Stack "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/routes/MainStack.js"
    click Home "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/screens/Home.js"
    click Users "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/screens/Users.js"
    click Asset "https://github.com/brunnohofmann/react-native-left-and-right-navigator/blob/master/src/assets/styles.js"

    %% Styles
    classDef native fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef jsframework fill:#cce5ff,stroke:#339,stroke-width:1px
    classDef state fill:#ffe5b4,stroke:#e65c00,stroke-width:1px
    classDef nav fill:#d4edda,stroke:#228B22,stroke-width:1px
    classDef screen fill:#f8f9fa,stroke:#666,stroke-width:1px
```
