A React Native mobile application demonstrating user authentication flows using React Context API for state management with Material Design UI.
- User Registration & Login
- Form Validation with error messages
- Global State Management using React Context API
- Protected Routes
- User Profile Display
- Logout Functionality
- Material Design UI
| Technology | Purpose |
|---|---|
| React Native | Mobile app framework |
| TypeScript | Type-safe JavaScript |
| React Context API | Global state management |
| React Navigation | Screen navigation |
| AsyncStorage | Local data persistence |
UserAuthenticationApp/
├── src/
│ ├── components/
│ │ ├── common/
│ │ │ ├── styles/
│ │ │ ├── AppHeader.tsx
│ │ │ ├── InputField.tsx
│ │ │ ├── PrimaryButton.tsx
│ │ │ ├── Card.tsx
│ │ │ └── index.ts
│ │ └── icons/
│ │ └── index.tsx
│ ├── constants/
│ │ ├── colors.ts
│ │ └── strings.ts
│ ├── context/
│ │ └── AuthContext.tsx
│ └── screens/
│ ├── login/
│ ├── signup/
│ └── home/
├── App.tsx
├── package.json
└── README.md
- Node.js (v18 or higher)
- npm or yarn
- React Native CLI
- Xcode (for iOS)
- Android Studio (for Android)
- CocoaPods (for iOS)
# Clone the repository
git clone https://github.com/harryharihar/UserAuthenticationApp.git
cd UserAuthenticationApp
# Install dependencies
npm install
# Install iOS dependencies (macOS only)
cd ios && pod install && cd ..# Start Metro Bundler
npm start
# Run on iOS
npm run ios
# Run on Android
npm run android┌─────────────────────────────────────────────────────────┐
│ App.tsx │
│ (Navigation Setup) │
└─────────────────────────┬───────────────────────────────┘
│
┌─────────────────────────▼───────────────────────────────┐
│ AuthProvider │
│ (Context API Wrapper) │
│ ┌─────────────────────────────────────────────────┐ │
│ │ State: │ │
│ │ - user: Current logged-in user │ │
│ │ - registeredUsers: Array of all users │ │
│ │ - isAuthenticated: Boolean flag │ │
│ └─────────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Functions: │ │
│ │ - login(email, password) │ │
│ │ - signup(name, email, password) │ │
│ │ - logout() │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────┬───────────────────────────────┘
│
┌─────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ LoginScreen │ │ SignUpScreen │ │ HomeScreen │
│ │ │ │ │ │
│ useAuth() │ │ useAuth() │ │ useAuth() │
└───────────────┘ └───────────────┘ └───────────────┘
| Screen | Description |
|---|---|
| Login | Email & password authentication |
| Sign Up | New user registration |
| Home | User profile with logout |
Harihar Khobragade
- GitHub: @harryharihar