Repository navigation
Commit 010d3a0
fix(mobile): prevent soft keyboard from obscuring chat input on Android (#142)
On Android devices, tapping the message input caused the soft keyboard to
display directly over the text input field, obscuring what the user was typing.
Root cause:
In `ChatScreen`, `KeyboardAvoidingView` was configured with:
`behavior={Platform.OS === 'ios' ? 'padding' : undefined}`.
On Android, behavior resolved to `undefined`. With React Native 0.81 and
edge-to-edge display enabled (`edgeToEdgeEnabled=true`), `KeyboardAvoidingView`
calculates displacement using `frame.y + frame.height - keyboardY`. On Android
edge-to-edge, `keyboardY` reports the window display bottom area, which results
in zero or negative displacement.
Fix:
- Register Android `keyboardDidShow` and `keyboardDidHide` listeners to track the
exact virtual keyboard height.
- Compute dynamic bottom padding offset subtracting the bottom navigation bar height (74dp).
- Apply this padding to `KeyboardAvoidingView` on Android while leaving iOS `behavior="padding"` untouched.
- Tested and verified on physical Samsung Galaxy Android device.
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>1 parent bba4780 commit 010d3a0
1 file changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
240 | 257 | | |
241 | 258 | | |
242 | 259 | | |
| |||
710 | 727 | | |
711 | 728 | | |
712 | 729 | | |
713 | | - | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
714 | 734 | | |
715 | 735 | | |
716 | 736 | | |
| |||
0 commit comments