You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/01/12 14:22:35 UTC

[GitHub] farrisbar edited a comment on issue #417: Keyboard Dismissal Leaves Viewport Shifted in iOS 12 / XCode 10

farrisbar edited a comment on issue #417: Keyboard Dismissal Leaves Viewport Shifted in iOS 12 / XCode 10
URL: https://github.com/apache/cordova-ios/issues/417#issuecomment-453751209
 
 
   I found another fix if you are using the cordova-plugin-keyboard.  It is based on the scroll(0,0) technique.  Basically, if the keyboard is dismissed and remains dismissed for 50ms, the workaround is applied.
   
   ```javascript
       // Create boolean variable in document or other state variable, initialize to false
       state.keyboardNeedsWorkaround = false;
       
       // ... Place code below inside the deviceready handler ... 
       
       // Apply Workaround for iOS 12 keyboard dismissal bug
       window.addEventListener('keyboardDidShow', function () {
           // Describe your logic which will be run each time keyboard is shown.
           state.keyboardNeedsWorkaround = false;
       });
       window.addEventListener('keyboardDidHide', function () {
           // Describe your logic which will be run each time keyboard is closed.
           state.keyboardNeedsWorkaround = true;
           setTimeout(function () {
               if(state.keyboardNeedsWorkaround){
                   window.scroll(0,0);
               }
           }, 50)
       });
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org