The TNC Mobile application is a cross-platform mobile app developed using Expo and React Native, providing a seamless experience for real-time chat and community interactions.
- Framework: Expo (~54.0.30) / React Native
- Navigation: React Navigation (Native Stack)
- Real-time: Socket.io-client
- HTTP Client: Axios
- Storage: React Native Async Storage
- Notifications: Expo Notifications
- Permissions: Expo Device and Image Picker
tnc-mobile/
├── assets/ # App icons and images
├── components/ # UI components (Buttons, Inputs, etc.)
├── context/ # React Context for global state (e.g., Toast)
├── hooks/ # Custom hooks (e.g., Push Notifications)
├── screens/ # Screen-level components (Login, Chat, Room)
├── services/ # API clients and socket management
├── types/ # TypeScript definitions
├── App.tsx # App entry point and navigation setup
└── index.ts # Entry point for development
The app leverages Socket.io for real-time messaging. It manages socket connections within the services/socket.ts and integrates them into the ChatScreen.
Integrates with Expo Notifications to provide real-time updates even when the app is in the background. Token synchronization with the backend is handled in App.tsx.
The application uses a Native Stack navigator. It performs an initial token check from AsyncStorage to determine whether to show the Welcome/Login screens or navigate directly to the chat Rooms.
- Node.js installed.
- Expo Go app on your physical device or an emulator.
- Navigate to the mobile directory:
cd tnc-mobile - Install dependencies:
npm install
The mobile app requires a backend API URL. Create a .env file in the tnc-mobile directory:
| Variable | Description |
|---|---|
EXPO_PUBLIC_API_URL |
The URL of your backend server (e.g., http://192.168.1.5:8001) |
Note: When testing on a physical device, use your machine's local IP address instead of localhost.
- Start:
npm start(opens Expo Dev Tools) - Android:
npm run android - iOS:
npm run ios - Web:
npm run web