# thegamenicorus/react-native-phone-input architecture

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

- Interactive diagram: https://gitdiagram.com/thegamenicorus/react-native-phone-input
- Repository: https://github.com/thegamenicorus/react-native-phone-input

## Overview

React Native Phone Input is a reusable phone-number input component with country selection, flags, and number utilities. The main workflow is user entry into the input, optional formatting and country detection, then access to validation or number details; users can also select a country through the built-in picker or provide a custom picker. The README documents custom country data and picker integrations. Source excerpts show the component wiring and utility calls; the graph omits unverified implementation details of unsampled modules.

Main entry points: [`lib/index.js`](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/index.js) (Phone input), [`lib/countryPicker.js`](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/countryPicker.js) (Country picker), [`lib/phoneNumber.js`](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/phoneNumber.js) (Phone number logic), [`lib/country.js`](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/country.js) (Country lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Phone Input"]
  node_phone_input["Phone input<br/>[index.js]"]
  node_picker["Country picker<br/>[countryPicker.js]"]
  node_styles["Component styles<br/>[styles.js]"]
end

subgraph group_country["Country Data"]
  node_country_data["Country lookup<br/>[country.js]"]
  node_country_list["Country records<br/>[countries.json]"]
  node_flags["Flag resources<br/>[index.js]"]
end

subgraph group_number["Number Utilities"]
  node_phone_number["Phone number logic<br/>[phoneNumber.js]"]
  node_number_types["Number type map<br/>[numberType.json]"]
end

node_user(("App user"))
node_phone_lib["Phone parsing library"]
node_react_native["React Native UI"]

node_user -->|"uses"| node_phone_input
node_phone_input -->|"renders"| node_picker
node_phone_input -->|"formats and checks"| node_phone_number
node_phone_input -->|"sets custom data"| node_country_data
node_phone_input -->|"gets flags"| node_flags
node_phone_input -->|"uses styles"| node_styles
node_picker -->|"lists countries"| node_country_data
node_picker -->|"uses styles"| node_styles
node_picker -->|"submits selection"| node_phone_input
node_country_data -->|"loads records"| node_country_list
node_phone_number -->|"looks up codes"| node_country_data
node_phone_number -->|"maps number type"| node_number_types
node_phone_number -->|"parses and formats"| node_phone_lib
node_phone_input -->|"renders controls"| node_react_native
node_picker -->|"renders modal"| node_react_native

click node_phone_input "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/index.js"
click node_picker "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/countryPicker.js"
click node_styles "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/styles.js"
click node_country_data "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/country.js"
click node_country_list "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/resources/countries.json"
click node_flags "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/resources/flags/index.js"
click node_phone_number "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/phoneNumber.js"
click node_number_types "https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/resources/numberType.json"

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_phone_input,node_picker,node_styles,node_user,node_react_native toneBlue
class node_country_data,node_country_list,node_flags toneAmber
class node_phone_number,node_number_types toneMint
class node_phone_lib toneIndigo
```

## Components

### Phone Input

- [Phone input](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/index.js): `lib/index.js`
- [Country picker](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/countryPicker.js): `lib/countryPicker.js`
- [Component styles](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/styles.js): `lib/styles.js`

### Country Data

- [Country lookup](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/country.js): `lib/country.js`
- [Country records](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/resources/countries.json): `lib/resources/countries.json`
- [Flag resources](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/resources/flags/index.js): `lib/resources/flags/index.js`

### Number Utilities

- [Phone number logic](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/phoneNumber.js): `lib/phoneNumber.js`
- [Number type map](https://github.com/thegamenicorus/react-native-phone-input/blob/master/lib/resources/numberType.json): `lib/resources/numberType.json`

### Other components

- **App user**
- **Phone parsing library**
- **React Native UI**

## Connections

- App user → Phone input: uses (evidence: `README.md`)
- Phone input → Country picker: renders (evidence: `lib/index.js`)
- Phone input → Phone number logic: formats and checks (evidence: `lib/index.js`)
- Phone input → Country lookup: sets custom data (evidence: `lib/index.js`)
- Phone input → Flag resources: gets flags (evidence: `lib/index.js`)
- Phone input → Component styles: uses styles (evidence: `lib/index.js`)
- Country picker → Country lookup: lists countries (evidence: `lib/countryPicker.js`)
- Country picker → Component styles: uses styles (evidence: `lib/countryPicker.js`)
- Country picker → Phone input: submits selection (evidence: `lib/index.js`)
- Country lookup → Country records: loads records (evidence: `lib/country.js`)
- Phone number logic → Country lookup: looks up codes (evidence: `lib/phoneNumber.js`)
- Phone number logic → Number type map: maps number type (evidence: `lib/phoneNumber.js`)
- Phone number logic → Phone parsing library: parses and formats (evidence: `lib/phoneNumber.js`)
- Phone input → React Native UI: renders controls (evidence: `lib/index.js`)
- Country picker → React Native UI: renders modal (evidence: `lib/countryPicker.js`)
