Skip to content

[MEDIUM] react-native-keyboard-controller migration plan #37203

Description

@kirillzyusko

Problem statement

In Expensify app keyboard handling is not consistent across iOS/Android platforms:

  • on Android we mostly rely on default keyboard avoiding mechanism adjustResize (it works great, but lacks of synchronous animations - which means the screen will be instantly resized, and there will be no animation at all. For chat-like apps this is quite important to have for good UX)
  • since Android handles it automatically - it's very hard to add any customization to keyboard handling (for example to preserve elements position which are obscured by keyboard)
  • on iOS we are using JS code mixture to handle keyboard avoidance (KeyboardAvoidingView, subscriptions to keyboard events)
    since iOS keyboard handling is done in JS code, on Android we use native keyboard avoidance provided by OS and we are writing cross-platform code -> we have a lot of Platform dependent code (like enabling KeyboardAvoidingView only on iOS), which eventually leads to UI inconsistency
  • react-native offers a limited API for keyboard handling (especially on Android, where we can detect only Did events)
  • react-native API is far behind from modern ways of keyboard handling

With react-native-keyboard-controller:

  • we are getting cross-platform behavior (done in feat: edge-to-edge mode on Android #52392):
    • edge-to-edge mode -> identical work with insets on both platforms
    • disabled default keyboard handling - all keyboard handling is delegated to developer providing basics primitives
  • consistent API for working with the keyboard (all events are available on both platforms, including Will events which were not available prior to RN API)
  • interactive keyboard support - an ability to dismiss keyboard via gesture (default RN implementation only works on iOS and has severe limitations, such as multiline TextInput can not grow)

Migration plan

I see next potential way for improving keyboard handling (aka migration plan):

Additional resources

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01360efa253e7a2c60
  • Upwork Job ID: 1762155306344951808
  • Last Price Increase: 2024-04-23

Metadata

Metadata

Labels

ImprovementItem broken or needs improvement.InternalRequires API changes or must be handled by Expensify staffMonthlyKSv2

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions