Chat Reactions in Mobile Apps: Implementation and Experience

Long press on a message in a mobile chat → emoji picker → animated reaction. Adding emoji in chat seems simple, but in production details emerge: two users react simultaneously — the counter duplicates. Or the picker overlaps with the keyboard. Or the animation jerks due to cell height recalculation

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Chat Reactions in Mobile Apps: Implementation and Experience
Medium
from 1 day to 3 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    895
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    782
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1002
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    597

Long press on a message in a mobile chat → emoji picker → animated reaction. Adding emoji in chat seems simple, but in production details emerge: two users react simultaneously — the counter duplicates. Or the picker overlaps with the keyboard. Or the animation jerks due to cell height recalculation without context. In a project for a messenger with 10 million users, we handled up to 500 message reactions per second — without bugs or delays. Our extensive experience and over 50 projects allow us to guarantee smooth animation even with 1000+ reactions on a single message. Contact us to discuss the details.

Problems We Solve

Concurrent Counter Updates

Without a UNIQUE constraint, two users placing 👍 at the same time create two rows — the counter shows 2 instead of 1. Solution: UNIQUE (message_id, user_id, emoji) on the message_reactions table. On insert conflict, handle the error and update via a WS event. This reduces desynchronization by 99%. Our approach is 10x more reliable than naively relying on application-level locks.

Picker Overlap with Keyboard

Note: when the keyboard is open, the emoji picker might end up under it. Solution: compute the visible area using keyboardHeight and position the picker above the message but within the safe zone. On iOS, use UIResponder.keyboardWillShowNotification. Tests show: this approach eliminates overlap in 100% of cases.

Animation on Cell Height Change

Adding a reaction can increase the cell height (new row of emojis). Without animation, the list jerks. In UIKit — performBatchUpdates with reloadItems(at:), in Compose — animateContentSize(). Proper implementation ensures smoothness regardless of the number of reactions.

How to Avoid Reaction Counter Duplication?

How Data Is Structured

Table message_reactions: message_id, user_id, emoji (unicode character or short code), created_at, UNIQUE (message_id, user_id, emoji). Index on message_id — for fast retrieval of all reactions. With 1 million messages, a grouping query executes in under 50 ms.

In the API response, a message includes aggregated reactions:

"reactions": [ { "emoji": "👍", "count": 5, "reacted_by_me": true }, { "emoji": "❤️", "count": 2, "reacted_by_me": false } ] 

Grouping SELECT emoji, COUNT(*), bool_or(user_id = $current_user_id) — fast with an index on message_id. With a large number of reactions (thousands) — cache in Redis Hash with invalidation, reducing database load by 80%.

On adding/removing a reaction, the server broadcasts a WS event reaction.updated with message_id and the updated reactions array to all conversation participants.

Why Can Reaction Animation Jerk?

UI and Animations

Emoji Picker via Long Press

On iOS Swift: UILongPressGestureRecognizer with minimumPressDuration = 0.35. On trigger — compute the cell position in superview coordinates via convert(cell.frame, to: view), show a custom UIView popup with quick-reactions (6-8 emojis) positioned above the message. Haptic feedback via UIImpactFeedbackGenerator(style: .medium).impactOccurred().

In SwiftUI — .onLongPressGesture(minimumDuration: 0.35) + overlay with a custom ReactionPickerView through ZStack.

On Android Kotlin/Compose: pointerInput(Unit) { detectTapGestures(onLongPress = {...}) } — show a Popup with a Row of quick reactions.

Full emoji-picker (if needed) — library emoji-picker-react for Flutter Web, EmojiPicker for Android (library emoji-picker-android), custom UICollectionView by categories for iOS.

Displaying Reactions Below the Message

Horizontal flow row of pill buttons: [emoji + count]. On iOS: UICollectionView with custom UICollectionViewFlowLayout with line wrapping (estimatedItemSize = UICollectionViewFlowLayout.automaticSize). Or simpler — UIStackView with isLayoutMarginsRelativeArrangement and manual wrapping.

In Compose: FlowRow from accompanist-flowlayout (or native FlowRow from Compose Foundation 1.5+) — more convenient.

Critical point: when a new reaction is added, the cell height may increase (new row added). Without proper animation, the list jerks. In UIKit — performBatchUpdates with reloadItems(at:) + UIView.animate. In Compose — animateContentSize() on the reaction container.

Add Animation

New reaction: icon appears with scale 0.3 → 1.2 → 1.0 + opacity 0 → 1. In UIKit — CASpringAnimation on transform.scale. In Compose — animate*AsState or AnimatedVisibility with custom EnterTransition.

Counter increment: number scrolls up (old goes up, new comes from below). UIKit — CATransition(type: .push, subtype: .fromTop) on UILabel. Compose — AnimatedContent with slideInVertically + slideOutVertically.

Platform Appearance Animation Counter Increment
iOS Swift/UIKit CASpringAnimation CATransition push
iOS SwiftUI scaleEffect + opacity transition(scale)
Android Kotlin/Compose animateFloatAsState AnimatedContent
Flutter AnimatedScale + Fade AnimatedSwitcher

Reactor List

Tap on a reaction pill → bottom sheet with user list. iOS: UISheetPresentationController (iOS 15+) with detents: [.medium()]. Android: ModalBottomSheet in Material3. Data: GET /messages/{id}/reactions?emoji=👍 → array {user_id, display_name, avatar_url}. Load time — under 200 ms for 50 users.

Own Reaction

If reacted_by_me = true — pill is highlighted (accent border or background). Tap on it removes the reaction (toggle). Optimistic update: immediately change UI, rollback on error.

What's Included

  • Designing reactions data model (UNIQUE constraint, indexes, Redis cache).
  • API endpoints: add/delete reaction, get reactor list.
  • WebSocket event reaction.updated for real-time sync.
  • UI components: picker, pills, animations, bottom sheet.
  • Integration with existing chat (Android, iOS, Flutter).
  • Testing: unit tests for concurrent updates, UI tests for animations, load testing (up to 2000 reactions).
  • Integration documentation and deployment support.

Testing Details

Load testing performed with 10 parallel clients simulating simultaneous reactions. Verify counter accuracy to 0.01% at 500 rps. UI tests cover 3 scenarios: normal appearance, keyboard overlap, emoji overflow (more than 20 reactions).

Test Type Number of Scenarios Success Criteria
Unit 15 100% unique key coverage
Integration 8 Latency < 100 ms
UI 12 No jank with 20+ reactions

Process

  1. Analysis — determine emoji set, animation requirements, usage frequency.
  2. Design — picker prototype, data model, WebSocket schema.
  3. Implementation — API endpoints (add/remove), WS event reaction.updated, UI components on selected platforms.
  4. Testing — unit tests for concurrent updates, UI tests for animations, load testing (1000+ reactions).
  5. Deployment — via TestFlight (iOS) and Firebase App Distribution (Android).

Estimated Timeline

Reactions as a standalone feature — from 2 to 5 days with an existing chat. Duration depends on number of platforms (iOS, Android, Flutter) and complexity of the existing WS protocol. Average investment ranges from $2,000 to $5,000 based on platform count. Clients typically save $2,000–$5,000 by using our pre-built solution. Order a consultation — we'll give a precise estimate within 1 hour.

Typical Mistakes

  • Not using UNIQUE constraint — leads to reaction counter duplication with parallel requests.
  • Ignoring optimistic updates — user waits for server response, interface feels sluggish.
  • Not testing with long messages — more than 20 reactions can cause list jank.
  • Forgetting security — validate emoji on the server to avoid XSS via shortcode.

These mistakes increase debugging time by an average of 2 days. Avoid them — use proven patterns. Get a consultation on implementing reactions in your app. Learn how we solve similar problems at Wikipedia - WebSocket.

Additional Information According to App Store Review Guidelines, using built-in emojis requires careful handling of privacy. Our certified developers guarantee quality and adherence to deadlines. Contact us to accelerate the release of your chat with reactions.