React Native Blog

How React Native Builds Input Accessory View For React Native

Original post Building Input Accessory View For React Native

M4 Related OWASP risk: Insufficient Input/Output Validation Learn more →

Article Summary

After three years and countless '+1s' on GitHub, React Native finally solved one of iOS development's most requested features. Here's how the team built InputAccessoryView from scratch.

The React Native team tackled a long-standing feature request to expose iOS's native input accessory view API. This deep dive reveals the engineering decisions behind building a component that enables keyboard toolbars and sticky text inputs, two patterns essential for messaging apps like iMessage and WhatsApp.

Key Takeaways

Critical Insight

React Native v0.55.0 shipped InputAccessoryView by cleverly bridging React's component model with iOS's responder infrastructure, solving keyboard synchronization without relying on notification events.

Continue reading

What This Article Covers

Problem

UIKeyboardDidChangeFrame notifications weren't firing quickly enough when users swiped between keyboards. The events also missed keyboard height changes, which created frame synchronization bugs on iPhone X since text and emoji keyboards have different heights.

Solution

React Native's team moved away from NSNotificationCenter and switched to the native .inputAccessoryView property instead. This lets the responder infrastructure handle all frame updates on its own.

Impact

InputAccessoryView shipped in React Native v0.55.0 and fixed keyboard synchronization. Apps using keyboard event listeners no longer hit the frame-update bugs that used to affect them.

The team's initial approach using NSNotificationCenter completely failed, leading to a frame synchronization bug that affected even major apps.

This page summarizes “Building Input Accessory View For React Native” by React Native Blog, published Mar 22, 2018. All credit for the original work goes to the authors.

Read the original on reactnative.dev (opens in new tab)

AI tools for React Native

Browse all AI tools →