fix tab switching state issues
- Add useFocusEffect to calendar for automatic event reload on tab focus - Create ChatStore (Zustand) for persistent chat messages across tab switches - Replace local useState with store in chat screen
This commit is contained in:
@@ -90,6 +90,7 @@ src/
|
||||
└── stores/ # Zustand state management
|
||||
├── index.ts # Re-exports all stores
|
||||
├── AuthStore.ts # user, token, isAuthenticated, login(), logout(), setToken()
|
||||
├── ChatStore.ts # messages[], addMessage(), updateMessage(), clearMessages()
|
||||
└── EventsStore.ts # events[], setEvents(), addEvent(), updateEvent(), deleteEvent()
|
||||
```
|
||||
|
||||
@@ -298,7 +299,9 @@ MONGODB_URI=mongodb://root:mongoose@localhost:27017/calchat?authSource=admin
|
||||
- Orange dot indicator for days with events
|
||||
- Tap-to-open modal overlay showing EventCards for selected day
|
||||
- Supports events from adjacent months visible in grid
|
||||
- Uses `useFocusEffect` for automatic reload on tab focus
|
||||
- Chat screen functional with FlashList, message sending, and event confirm/reject
|
||||
- Messages persisted via ChatStore (survives tab switches)
|
||||
- `ApiClient`: get(), post(), put(), delete() implemented
|
||||
- `EventService`: getAll(), getById(), getByDateRange(), create(), update(), delete() - fully implemented
|
||||
- `ChatService`: sendMessage(), confirmEvent(convId, msgId, action, event?, eventId?, updates?), rejectEvent() - supports create/update/delete actions
|
||||
@@ -306,6 +309,7 @@ MONGODB_URI=mongodb://root:mongoose@localhost:27017/calchat?authSource=admin
|
||||
- `ProposedEventCard`: Displays proposed events (title, date, description, recurring indicator) with confirm/reject buttons
|
||||
- `Themes.tsx`: Centralized color definitions including textPrimary, borderPrimary, eventIndicator
|
||||
- `EventsStore`: Zustand store with setEvents(), addEvent(), updateEvent(), deleteEvent() - stores ExpandedEvent[]
|
||||
- `ChatStore`: Zustand store with addMessage(), updateMessage(), clearMessages() - persists messages across tab switches
|
||||
- Auth screens (Login, Register), Event Detail, and Note screens exist as skeletons
|
||||
- AuthStore defined with `throw new Error('Not implemented')`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user