# sciphergfx/react-native-kiosk-mode architecture

> Architecture diagram of the GitHub repository sciphergfx/react-native-kiosk-mode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sciphergfx/react-native-kiosk-mode
- Repository: https://github.com/sciphergfx/react-native-kiosk-mode

## Overview

##### Main Components

a. React Native Application Layer
- Main application component that implements the Immersive component
- JavaScript bridge interface

b. Native Module Layer
- KioskModeModule (Android)
- Native bridge implementation

c. Android System Integration
- MainActivity implementation
- Window/View System integration
- System UI flags handling

- [React Native App Layer]
- ↓
- [React Native Bridge]
- ↓
- [Native Module Layer]
- ↓
- [Android System Layer]

##### Key Elements to Highlight

a. Integration Points:
- How the Immersive component connects to KioskModeModule
- MainActivity modifications
- System UI flag configurations

b. Data Flow:
- Flow from React Native component to system UI changes
- Window focus change handling

##### Implementation Details

- KioskModeModule registration in MainApplication
- onWindowFocusChanged implementation
- System UI visibility flags
- Native module method calls

##### Component responsibilities

Keep the abstraction level focused on the architectural components while including enough detail to show the kiosk mode implementation specifics. This will help developers understand both the high-level structure and the technical implementation requirements.

- Component type indicators
- Any abbreviations used

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph RNLayer["React Native Application Layer"]
        RNApp["React Native App"]:::rnComponent
        ImmersiveComp["Immersive Component"]:::rnComponent
        JSBridge["JavaScript Bridge Interface"]:::bridge
    end

    subgraph NativeLayer["Native Module Layer"]
        KioskModule["KioskMode Module"]:::nativeModule
        NativeBridge["Native Bridge Implementation"]:::bridge
    end

    subgraph AndroidLayer["Android System Layer"]
        MainActivity["MainActivity"]:::androidComponent
        WindowSystem["Window/View System"]:::androidComponent
        SystemUI["System UI Flags"]:::androidComponent
    end

    RNApp --> ImmersiveComp
    ImmersiveComp --> JSBridge
    JSBridge --> NativeBridge
    NativeBridge --> KioskModule
    KioskModule --> MainActivity
    MainActivity --> WindowSystem
    MainActivity --> SystemUI

    %% Callback flows
    SystemUI -.-o KioskModule
    WindowSystem -.-o KioskModule
    KioskModule -.-o NativeBridge
    NativeBridge -.-o JSBridge
    JSBridge -.-o ImmersiveComp

    %% Click events for file mapping
    click RNApp "https://github.com/sciphergfx/react-native-kiosk-mode/blob/master/index.js"
    click KioskModule "https://github.com/sciphergfx/react-native-kiosk-mode/blob/master/android/src/main/java/com/rn/kiosk/mode/KioskModeModule.java"
    click MainActivity "https://github.com/sciphergfx/react-native-kiosk-mode/blob/master/example/android/app/src/main/java/com/example/MainActivity.java"
    click SystemUI "https://github.com/sciphergfx/react-native-kiosk-mode/blob/master/example/android/app/src/main/res/values/styles.xml"

    %% Styling
    classDef rnComponent fill:#4A90E2,stroke:#2171C7,color:white
    classDef bridge fill:#50C878,stroke:#2E8B57,color:white
    classDef nativeModule fill:#F5A623,stroke:#D4840D,color:white
    classDef androidComponent fill:#FF7F50,stroke:#E25822,color:white

    %% Legend
    subgraph Legend
        L1["React Native Components"]:::rnComponent
        L2["Bridge Components"]:::bridge
        L3["Native Module"]:::nativeModule
        L4["Android Components"]:::androidComponent
        L5[" → Direct Flow"]
        L6[" ⇢ Callback Flow"]
    end
```
