# simformsolutionspvtltd/react-native-sticky-table architecture

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

- Interactive diagram: https://gitdiagram.com/simformsolutionspvtltd/react-native-sticky-table
- Repository: https://github.com/simformsolutionspvtltd/react-native-sticky-table

## Overview

##### Main Components
- Library Core Module – Represent the reusable StickyTable component. This is the heart of the library and consists of:
- UI sub-components: for rendering the sticky table (found in src/components/sticky-table) including ListItem, StickyTable containers, Title components, etc.
- Hooks: Custom hooks (located in src/components/sticky-table/hooks) handling the sticky behavior and managing state.

- External Dependencies – List out key third-party libraries the component relies on:
- React Native Reanimated (for fluid animations and handling the sticky behavior),
- React Native Gesture Handler (for touch interactions),
- Lodash (for utility operations).

- Example (Integration Consumer) – The example project shows how a host React Native app consumes and integrates the library:
- The “example/src” folder features an App.tsx which uses the StickyTable component and provides sample data.
- Native integration details: The example Android and iOS directories show how the library is linked with platform-specific configuration (e.g., Gradle scripts, Podfile in iOS).

##### Relationships and Interactions
- The consumer (or integrating application) provides the data object to the StickyTable component. The data flows into the component, which then uses the configuration (rowTitleProps, tableItemProps, etc.) to render the table.
- Within the StickyTable component, the module is composed of smaller building blocks (e.g., separate components for the table header, row titles, and cell items); these components communicate via props and hooks.
- The custom hooks manage scrolling and sticky behavior in a declarative, animated fashion (leveraging React Native Reanimated’s API).
- External libraries interact with the component by providing animation properties and gesture recognition, which are used throughout the UI rendering process.

##### Architectural Patterns and Principles
- Separation of Concerns: Distinct layers are visible – (1) presentation (components, themes, styles), (2) behavior (custom hooks for sticky behavior), and (3) integration (data passed from the consumer and demonstration in the example app).
- Dependency Management: The integration with third-party libraries is critical and should be highlighted as part of the overall architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Library Domain
    subgraph "Core Library"
        ST["StickyTable Component"]:::component
        subgraph "UI Sub-Components"
            LI["ListItem Component"]:::component
            Tit["Title Component"]:::component
        end
        subgraph "Custom Hooks"
            Hook1["useStickyTable"]:::hook
            Hook2["useTitle"]:::hook
        end
        subgraph "Theming & Constants"
            Const["Constants Module"]:::theme
            Theme["Theme Module"]:::theme
        end
    end

    %% External Dependencies Domain
    subgraph "External Dependencies"
        RNRe["React Native Reanimated\n(for animations)"]:::external
        RNGh["React Native Gesture Handler\n(for touch interactions)"]:::external
        Lod["Lodash\n(for utilities)"]:::external
    end

    %% Example / Consumer Project Domain
    subgraph "Example / Consumer Project"
        App["Example App"]:::consumer
        Android["Android Integration"]:::consumer
        iOS["iOS Integration"]:::consumer
    end

    %% Relationships and Data Flow
    App -->|"passesData"| ST
    ST -->|"renders"| LI
    ST -->|"renders"| Tit
    ST -->|"utilizes"| Hook1
    ST -->|"utilizes"| Hook2
    ST -->|"applies"| Const
    ST -->|"applies"| Theme
    RNRe -->|"animates"| ST
    RNGh -->|"handlesGestures"| ST
    Lod -->|"providesUtils"| ST
    App -->|"integratesNative"| Android
    App -->|"integratesNative"| iOS

    %% Click Events for Components
    click ST "https://github.com/simformsolutionspvtltd/react-native-sticky-table/blob/master/src/components/sticky-table/StickyTable.tsx"
    click LI "https://github.com/simformsolutionspvtltd/react-native-sticky-table/blob/master/src/components/sticky-table/ListItem.tsx"
    click Tit "https://github.com/simformsolutionspvtltd/react-native-sticky-table/blob/master/src/components/sticky-table/Title.tsx"
    click Hook1 "https://github.com/simformsolutionspvtltd/react-native-sticky-table/blob/master/src/components/sticky-table/hooks/useStickyTable.ts"
    click Hook2 "https://github.com/simformsolutionspvtltd/react-native-sticky-table/blob/master/src/components/sticky-table/hooks/useTitle.ts"
    click Const "https://github.com/simformsolutionspvtltd/react-native-sticky-table/tree/master/src/constants/"
    click Theme "https://github.com/simformsolutionspvtltd/react-native-sticky-table/tree/master/src/theme/"
    click App "https://github.com/simformsolutionspvtltd/react-native-sticky-table/blob/master/example/src/App.tsx"
    click Android "https://github.com/simformsolutionspvtltd/react-native-sticky-table/tree/master/example/android/"
    click iOS "https://github.com/simformsolutionspvtltd/react-native-sticky-table/tree/master/example/ios/"

    %% Style Definitions
    classDef component fill:#f9f,stroke:#333,stroke-width:2px;
    classDef hook fill:#ff9,stroke:#333,stroke-width:2px;
    classDef theme fill:#9f9,stroke:#333,stroke-width:2px;
    classDef external fill:#9ff,stroke:#333,stroke-width:2px;
    classDef consumer fill:#fc9,stroke:#333,stroke-width:2px;
```
