# hichamelbsi/react-native-body-highlighter architecture

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

- Interactive diagram: https://gitdiagram.com/hichamelbsi/react-native-body-highlighter
- Repository: https://github.com/hichamelbsi/react-native-body-highlighter

## Overview

##### Main Components Identification
The system should be represented as a component library architecture with the following key elements:

a. Core Components Layer:
- SvgMaleWrapper and SvgFemaleWrapper components
- Asset definitions (bodyBack, bodyFront, etc.)
- Main Body component (index.tsx)

b. Interface Layer:
- Props and Types definitions
- Event handlers for body part interactions

- [Consumer Application]
- ↓
- [Body Component (index.tsx)]
- ↓
- ┌─────────────────────────────────────┐
- ↓                                     ↓
- [SvgMaleWrapper.tsx]                 [SvgFemaleWrapper.tsx]
- ↓                                     ↓
- ┌───────────────────┐               ┌───────────────────┐
- ↓                   ↓               ↓                   ↓
**[bodyFront.ts]      [bodyBack.ts]  [bodyFemaleFront.ts] [bodyFemaleBack.ts]**

##### Important Elements

a. Data Flow Indicators:
- Props flow from top to bottom
- Event callbacks flow from bottom to top
- Data structure for body part highlighting

b. Component Interaction:
- How the gender prop affects component selection
- Side (front/back) switching mechanism

##### Technical Details to Highlight

- React Native compatibility
- Expo compatibility
- TypeScript integration
- SVG manipulation capabilities

##### Implementation Notes

- The component's plug-and-play nature
- The separation between male and female body representations
- The modular structure of body part definitions

##### Integration Points

How the component:
- Accepts external styling
- Handles touch events
- Provides callbacks for body part selection
- Manages state for highlighted parts

- Nested component hierarchy
- Clear labeling of props and events

- Component type indicators
- State management flow

This will create a comprehensive visualization of how this specialized UI component works within a React Native application while maintaining clarity about its purpose and implementation details.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Component]:::main
        L2[Wrapper]:::wrapper
        L3[Asset]:::asset
        L4[Config]:::config
        L5[Test]:::test
        
        style Legend fill:#f0f0f0,stroke:#333
    end

    ConsumerApp[Consumer Application]:::external

    subgraph MainComponent
        Body["Body Component"]:::main
        Props["Props & Types"]:::interface
    end

    subgraph WrapperComponents
        Male["SvgMaleWrapper"]:::wrapper
        Female["SvgFemaleWrapper"]:::wrapper
    end

    subgraph Assets
        MaleFront["Body Front"]:::asset
        MaleBack["Body Back"]:::asset
        FemaleFront["Body Female Front"]:::asset
        FemaleBack["Body Female Back"]:::asset
    end

    subgraph Configuration
        TSConfig["TypeScript Config"]:::config
        RNConfig["React Native Config"]:::config
        PackageJSON["Package.json"]:::config
    end

    subgraph Testing
        Tests["Component Tests"]:::test
    end

    subgraph CI
        CircleCI["CircleCI Config"]:::config
        NPMWorkflow["NPM Publishing"]:::config
    end

    ConsumerApp --> Body
    Body --> Props
    Body --> Male
    Body --> Female
    
    Male --> MaleFront
    Male --> MaleBack
    Female --> FemaleFront
    Female --> FemaleBack

    click Body "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/index.tsx"
    click Male "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/components/SvgMaleWrapper.tsx"
    click Female "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/components/SvgFemaleWrapper.tsx"
    click MaleFront "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/assets/bodyFront.ts"
    click MaleBack "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/assets/bodyBack.ts"
    click FemaleFront "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/assets/bodyFemaleFront.ts"
    click FemaleBack "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/assets/bodyFemaleBack.ts"
    click TSConfig "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/tsconfig.json"
    click RNConfig "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/rn-cli.config.js"
    click Tests "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/__tests__/test.tsx"
    click PackageJSON "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/package.json"
    click CircleCI "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/.circleci/config.yml"
    click NPMWorkflow "https://github.com/HichamELBSI/react-native-body-highlighter/blob/main/.github/workflows/npm-publish.yml"

    classDef main fill:#4a90e2,stroke:#2e5b99,color:white
    classDef wrapper fill:#2ecc71,stroke:#27ae60,color:white
    classDef asset fill:#f1c40f,stroke:#f39c12,color:black
    classDef interface fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef config fill:#e74c3c,stroke:#c0392b,color:white
    classDef test fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#bdc3c7,stroke:#95a5a6,color:black
```
