# tokkozhin/react-native-qrcode-styled architecture

> Architecture diagram of the GitHub repository tokkozhin/react-native-qrcode-styled, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tokkozhin/react-native-qrcode-styled
- Repository: https://github.com/tokkozhin/react-native-qrcode-styled

## Overview

This is a React Native QR-code rendering library. The main workflow accepts QR content and encoding options, creates a bit matrix, then renders styled SVG pieces, optional eyes, gradients, backgrounds, and a logo. The graph reflects the sampled runtime modules and README capabilities; some helper behavior and the radial-gradient implementation were not fully sampled, so uncertain internal links are omitted.

Main entry points: [`src/components/SVGQRCodeStyled.tsx`](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGQRCodeStyled.tsx) (Styled QR renderer), [`src/components/SVGPieces.tsx`](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGPieces.tsx) (Piece and eye renderer), [`src/adapters/qrcode.ts`](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/adapters/qrcode.ts) (QR encoder adapter), [`src/components/SVGGradient.tsx`](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGGradient.tsx) (Gradient selector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_encoding["QR encoding"]
  node_datahook["QR data hook<br/>[useQRCodeData.ts]"]
  node_encoder["QR encoder adapter<br/>[qrcode.ts]"]
end

subgraph group_rendering["QR rendering"]
  node_renderer["Styled QR renderer"]
  node_pieces["Piece and eye renderer<br/>[SVGPieces.tsx]"]
  node_helpers["Path and matrix helpers<br/>[helpers.ts]"]
  node_constants["QR constants<br/>[constants.ts]"]
end

subgraph group_styling["Visual styling"]
  node_gradient["Gradient selector<br/>[SVGGradient.tsx]"]
  node_linear["Linear gradient"]
  node_radial["Radial gradient"]
end

subgraph group_logo["Logo overlay"]
  node_logo["Logo SVG overlay<br/>[SVGQRLogo.tsx]"]
  node_logosize["Logo sizing hook"]
end

node_consumer(("Library consumer"))
node_api["Public API<br/>[index.ts]"]
node_svg["react-native-svg"]
node_qrcode["qrcode package"]
node_image["React Native image sizing"]

node_consumer -->|"imports"| node_api
node_api -->|"exports"| node_renderer
node_renderer -->|"requests matrix"| node_datahook
node_datahook -->|"creates QR"| node_encoder
node_encoder -->|"encodes data"| node_qrcode
node_encoder -->|"transforms bits"| node_helpers
node_renderer -->|"renders pieces"| node_pieces
node_pieces -->|"builds paths"| node_helpers
node_pieces -->|"uses eye sizes"| node_constants
node_renderer -->|"renders gradients"| node_gradient
node_gradient -->|"selects linear"| node_linear
node_gradient -->|"selects radial"| node_radial
node_renderer -->|"renders logo"| node_logo
node_logo -->|"calculates size"| node_logosize
node_logosize -->|"gets dimensions"| node_image
node_renderer -->|"composes SVG"| node_svg
node_pieces -->|"draws paths"| node_svg
node_logo -->|"draws image"| node_svg
node_linear -->|"defines gradient"| node_svg

click node_api "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/index.ts"
click node_renderer "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGQRCodeStyled.tsx"
click node_datahook "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/hooks/useQRCodeData.ts"
click node_encoder "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/adapters/qrcode.ts"
click node_pieces "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGPieces.tsx"
click node_helpers "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/helpers.ts"
click node_constants "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/constants.ts"
click node_gradient "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGGradient.tsx"
click node_linear "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGLinearGradient.tsx"
click node_radial "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGRadialGradient.tsx"
click node_logo "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGQRLogo.tsx"
click node_logosize "https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/hooks/useQRCodeLogoSize.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_datahook,node_encoder toneBlue
class node_renderer,node_pieces,node_helpers,node_constants toneAmber
class node_gradient,node_linear,node_radial,node_api toneMint
class node_logo,node_logosize toneRose
class node_consumer,node_svg,node_qrcode,node_image toneIndigo
```

## Components

### QR encoding

- [QR data hook](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/hooks/useQRCodeData.ts): `src/hooks/useQRCodeData.ts`
- [QR encoder adapter](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/adapters/qrcode.ts): `src/adapters/qrcode.ts`

### QR rendering

- [Styled QR renderer](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGQRCodeStyled.tsx): `src/components/SVGQRCodeStyled.tsx`
- [Piece and eye renderer](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGPieces.tsx): `src/components/SVGPieces.tsx`
- [Path and matrix helpers](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/helpers.ts): `src/helpers.ts`
- [QR constants](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/constants.ts): `src/constants.ts`

### Visual styling

- [Gradient selector](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGGradient.tsx): `src/components/SVGGradient.tsx`
- [Linear gradient](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGLinearGradient.tsx): `src/components/SVGLinearGradient.tsx`
- [Radial gradient](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGRadialGradient.tsx): `src/components/SVGRadialGradient.tsx`

### Logo overlay

- [Logo SVG overlay](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/components/SVGQRLogo.tsx): `src/components/SVGQRLogo.tsx`
- [Logo sizing hook](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/hooks/useQRCodeLogoSize.ts): `src/hooks/useQRCodeLogoSize.ts`

### Other components

- **Library consumer**
- [Public API](https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/src/index.ts): `src/index.ts`
- **react-native-svg**
- **qrcode package**
- **React Native image sizing**

## Connections

- Library consumer → Public API: imports (evidence: `README.md`)
- Public API → Styled QR renderer: exports (evidence: `src/index.ts`)
- Styled QR renderer → QR data hook: requests matrix (evidence: `src/components/SVGQRCodeStyled.tsx`)
- QR data hook → QR encoder adapter: creates QR (evidence: `src/hooks/useQRCodeData.ts`)
- QR encoder adapter → qrcode package: encodes data (evidence: `src/adapters/qrcode.ts`)
- QR encoder adapter → Path and matrix helpers: transforms bits (evidence: `src/adapters/qrcode.ts`)
- Styled QR renderer → Piece and eye renderer: renders pieces (evidence: `src/components/SVGQRCodeStyled.tsx`)
- Piece and eye renderer → Path and matrix helpers: builds paths (evidence: `src/components/SVGPieces.tsx`)
- Piece and eye renderer → QR constants: uses eye sizes (evidence: `src/components/SVGPieces.tsx`)
- Styled QR renderer → Gradient selector: renders gradients (evidence: `src/components/SVGQRCodeStyled.tsx`)
- Gradient selector → Linear gradient: selects linear (evidence: `src/components/SVGGradient.tsx`)
- Gradient selector → Radial gradient: selects radial (evidence: `src/components/SVGGradient.tsx`)
- Styled QR renderer → Logo SVG overlay: renders logo (evidence: `src/components/SVGQRCodeStyled.tsx`)
- Logo SVG overlay → Logo sizing hook: calculates size (evidence: `src/components/SVGQRLogo.tsx`)
- Logo sizing hook → React Native image sizing: gets dimensions (evidence: `src/hooks/useQRCodeLogoSize.ts`)
- Styled QR renderer → react-native-svg: composes SVG (evidence: `src/components/SVGQRCodeStyled.tsx`)
- Piece and eye renderer → react-native-svg: draws paths (evidence: `src/components/SVGPieces.tsx`)
- Logo SVG overlay → react-native-svg: draws image (evidence: `src/components/SVGQRLogo.tsx`)
- Linear gradient → react-native-svg: defines gradient (evidence: `src/components/SVGLinearGradient.tsx`)
