Posłuchaj wydarzenia zamknięcia klawiatury w JS
// event listener is triggered when keyboard is open or closed
window.visualViewport.addEventListener('resize', event => console.log(event.target));
Anxious Alligator