FIX: rely only on one keyboard computation solution (#21492)

We were combining both solutions which was apparently causing issues from chrome 113 on Android at least.

The commit will now use `geometrychange` (android) only when available and fallback to `visualViewport` otherwise (iOS).
This commit is contained in:
Joffrey JAFFEUX 2023-05-11 08:58:29 +02:00 committed by GitHub
parent 55c4a550c1
commit 5b12d23b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,18 +11,20 @@ export default class ChatVh extends Component {
didInsertElement() {
this._super(...arguments);
this.setVHFromVisualViewPort();
(window?.visualViewport || window).addEventListener(
"resize",
this.setVHFromVisualViewPort
);
if ("virtualKeyboard" in navigator) {
this.setVHFromKeyboard();
navigator.virtualKeyboard.addEventListener(
"geometrychange",
this.setVHFromKeyboard
);
} else {
this.setVHFromVisualViewPort();
(window?.visualViewport || window).addEventListener(
"resize",
this.setVHFromVisualViewPort
);
}
}