feat: integrate unified message grouping into ChatScreen (Phase 3)
Replaced fragmented message rendering with unified MessageGroup system.
Messages with same ID (reasoning + assistant, tool_call + tool_return) now
render as single cohesive components instead of separate FlatList items.
Integration Changes:
- Imported useMessageGroups hook and MessageGroupBubble component
- Replaced displayMessages useMemo with useMessageGroups() call
- Passing currentStream from chatStore as streamingState
- Updated FlatList data source from messages to messageGroups
- Changed keyExtractor to use group.groupKey (unique per group type)
- Updated renderItem to renderMessageGroup with isLastGroup detection
- Changed hasMessages check to use messageGroups.length
Benefits:
- Reasoning and content always render together (no fragmentation)
- Tool calls and returns paired automatically
- Streaming appears as temporary group (id='streaming'), replaced on server refresh
- Fewer FlatList items (one per logical message turn vs one per message type)
- Cleaner scroll behavior (no reasoning/assistant separation)
Architecture:
- Non-breaking: MessageBubbleEnhanced still exists but unused
- Type-safe: Full MessageGroup typing throughout
- Backward compatible: Same interaction props (expandedReasoning, etc.)
Testing:
- Hot reload will pick up changes
- Existing messages should group correctly
- Streaming should append temporary group at end
- Server refresh replaces streaming group with real messages
Phase 3 complete. Next: Phase 4 (verify with real data, remove old code).