ionic-team / ionic-team/capacitor-keyboard

Include duration in argument passed to keyboardWillShow and keyboardWillHide

Open
#11 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3
Forks
21
PR merge metrics
No merged PRs in 30d

Description

## Feature Request

### Plugin

Keyboard

### Description

I am doing JS/CSS animations in response to the keyboard opening/closing. The exact easing is secret, but I am using an [estimation](https://gist.github.com/jondot/1317ee27bab54c482e87#gistcomment-1670223) that looks okay and could always be improved upon. The duration of this animation is always (as far as I know) 0.25s for a complete open or close:

https://user-images.githubusercontent.com/218725/109733473-24075e80-7b8d-11eb-8097-733c9d217f7b.mov

However, `keyboardWillShow` is also fired when the keyboard resizes due to the autocomplete bar showing/hiding. In this case, the duration always seems to be 0s:

https://user-images.githubusercontent.com/218725/109733460-1e117d80-7b8d-11eb-982b-f290cac555dc.mov

In this case, the JS/CSS transition needs to be disabled.

It's easy enough to distinguish these two types of keyboard changes heuristically. However, why not just send the duration in the notification? It's already being read here:

https://github.com/ionic-team/capacitor-plugins/blob/c704ab6c24723c3f46aac07bc949aac00ca631cd/keyboard/ios/Plugin/Keyboard.m#L135

### Platform(s)

iOS

### Preferred Solution

Send the duration to listeners

### Alternatives

Use a heuristic (small height difference means the autocomplete toolbar is being shown/hidden).

### Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.