How kawaki0101/flot-design works
Project Type and Purpose
• This is a React Native mobile application targeting both Android and iOS platforms.
• It implements a multi-step loan application flow (intro screens, login/OTP, KYC/Aadhaar verification, selfie upload, loan application, confirmation, and dashboard).
• The project uses JavaScript/TypeScript (TSX) for UI and business logic, with native wrappers (Kotlin/Swift) for platform integration.
High-Level File Structure Analysis
• Top-level native folders:
• android/ – Android project, Gradle build scripts, MainActivity.kt, MainApplication.kt
• ios/ – iOS Xcode project, AppDelegate.swift, Info.plist, CocoaPods setup
• JS/TS source folder:
• src/
– Screens/ – UI screens organized by feature flow
– components/ – Reusable UI components (headers, inputs, banners)
– navigation/ – React Navigation setup (AppNavigator.js, BottomTabNavigation.js)
– utils/ – Helpers, custom hooks, constants, theming, scaling, date utils
– hooks/ – Custom hooks (e.g. back button handler)
– assets/, animations/, DummyData/ – Static assets, Lottie animations, mock data
• Configuration and tooling:
• metro.config.js, babel.config.js, jest.config.js, tsconfig.json
• package.json defining dependencies (react-native, react-navigation, etc.)
• build scripts and linters (.eslintrc.js, .prettierrc.js)
Key Components
a. Native Shells
• Android Layer (Gradle, MainActivity → ReactRootView)
• iOS Layer (Xcode, AppDelegate → RCTRootView)
b. JS Runtime & Bundler
• Metro Bundler / JavaScriptCore or Hermes VM
• Bundled JS/TS code (App.tsx entry point)
c. React Native Bridge
• Communication channel between JS code and native modules (camera, file, networking)
d. Application Modules
• Navigation Module
• AppNavigator (stack navigator for flows)
• BottomTabNavigation (dashboard tabs)
• UI Screens
• Intro, Login/OTP, Aadhaar Verification, KYC Details, Selfie Upload, Apply Loan, Confirm Address, Dashboard (History, Info, Payments)
• Shared Components
• AppHeader, OTPInput, NetworkStatusBanner, CustomButton/Input/Map/Text
• Utilities & Hooks
• Constants, DateUtils, Themes, Scaling, NavigationUtils, useBackButtonExitApp, useKeyboardOffsetHeight
• Data Layer
• Remote API service calls (not in source tree but implied)
• DummyData folder for local mocking in development
e. Assets & Animations
• Lottie JSON files under src/animations
• Images under src/assets/Image
Relationships and Data Flow
1. User taps on device → Native event captured in React Native bridge
2. JS runtime processes event → React Navigation directs to the appropriate Screen
3. Screen components call utils/hooks for form state, validation, and networking (via fetch/axios)
4. API requests flow out to external backend services (authentication, Aadhaar, loan processing)
5. Responses update application state → UI updates via component re-render
6. Assets (images, animations) are loaded locally from the bundle
Architectural Patterns & Principles
• Modular folder structure by feature (screens) and concern (components, utils, hooks)
• Single source of truth via navigation state managed by React Navigation
• Separation of presentation (components/screens) from business logic (utils/services)
• Use of custom hooks for cross-cutting concerns (keyboard offset, back-button handling)
• Mock data layering for offline development/testing