# samuel-rl/react-native-squircle architecture

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

- Interactive diagram: https://gitdiagram.com/samuel-rl/react-native-squircle
- Repository: https://github.com/samuel-rl/react-native-squircle

## Overview

##### Main Components Layer
- Divide it into three main sections:
a. Core Component Layer
b. Utilities Layer
c. Integration Layer

##### Core Component Layer (Primary Focus)
- borderRadius
- backgroundColor
- borderSmoothing
- children
- maskChildren
- skiaChildren
- style

##### Dependencies Layer
- React Native (platform)
- React Native Skia (rendering engine)

##### Implementation Patterns
- Three usage patterns (from example/src/components):
- DefaultSquircle
- ReactChildrenSquircle
- SkiaMaskChildrenSquircle

##### Rendering Pipeline
a. Input Props Processing
b. Path Calculation
c. Skia Canvas Rendering
d. Final Output

- Use rounded rectangles for components
- Use sharp rectangles for utilities
- Use hexagons for external dependencies

- → for direct dependencies
- ⇢ for data flow
- ⇄ for two-way interactions

##### Labels
- Use clear, concise text
- Version numbers where relevant

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Main["react-native-squircle Library"]
        subgraph Core["Core Component Layer"]
            Squircle["Squircle Component"]:::core
            Props["Component Props<br/>- borderRadius<br/>- backgroundColor<br/>- borderSmoothing<br/>- children<br/>- maskChildren<br/>- skiaChildren<br/>- style"]:::props
            Squircle --- Props
        end

        subgraph Utils["Utilities Layer"]
            Functions["Path Calculations"]:::util
            Types["Type Definitions"]:::util
        end

        subgraph Integration["Integration Layer"]
            RNSkia["React Native Skia"]:::external
            ReactNative["React Native Platform"]:::external
        end

        subgraph Examples["Implementation Patterns"]
            Default["Default Squircle"]:::example
            ReactChildren["React Children Squircle"]:::example
            SkiaMask["Skia Mask Children Squircle"]:::example
        end

        subgraph Pipeline["Rendering Pipeline"]
            Input["Input Props"]:::pipeline
            Calc["Path Calculation"]:::pipeline
            Render["Skia Canvas Rendering"]:::pipeline
            Output["Final Output"]:::pipeline
            
            Input --> Calc
            Calc --> Render
            Render --> Output
        end
    end

    %% Connections
    Squircle --> Functions
    Squircle --> Types
    Squircle --> RNSkia
    Squircle --> ReactNative
    
    Default --> Squircle
    ReactChildren --> Squircle
    SkiaMask --> Squircle

    %% Click Events
    click Squircle "https://github.com/samuel-rl/react-native-squircle/blob/main/src/components/Squircle.tsx"
    click Functions "https://github.com/samuel-rl/react-native-squircle/blob/main/src/utils/functions.ts"
    click Types "https://github.com/samuel-rl/react-native-squircle/blob/main/src/utils/types.ts"
    click Default "https://github.com/samuel-rl/react-native-squircle/blob/main/example/src/components/DefaultSquircle.tsx"
    click ReactChildren "https://github.com/samuel-rl/react-native-squircle/blob/main/example/src/components/ReactChildrenSquircle.tsx"
    click SkiaMask "https://github.com/samuel-rl/react-native-squircle/blob/main/example/src/components/SkiaMaskChildrenSquircle.tsx"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef util fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white
    classDef example fill:#9b59b6,stroke:#8e44ad,color:white
    classDef pipeline fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef props fill:#ecf0f1,stroke:#bdc3c7,color:black

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Utilities"]:::util
        L3["External Dependencies"]:::external
        L4["Implementation Examples"]:::example
        L5["Pipeline Steps"]:::pipeline
    end
```
