Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scroll view problem with ios12, xcode10, cordova 7.1, cordova-ios 4.5.4 on keyboard closing

I built a cordova app for iOS with Framework7 v2.3.1, using:

It works perfectly, but a few days ago I compiled the Cordova app for iOS with Xcode 10. On iOS 12 device, if the app is compiled with Xcode 10, when I select an input field the keyboard appears and the view scrolls up, but when the keyboard closes, the view doesn’t scroll down, the blank space of the keyboard remains. The problem there isn’t if I compile the app with Xcode 9.4 and I install it on a device with iOS 12, or if the app is compiled with Xcode 10 and installed on a device with iOS 11.x I uploaded a screenshot to explain better the problem Does anybody have a solution? Thanks

Steps to explain the problem on keyboard closing

like image 918
ciossi Avatar asked Sep 17 '18 14:09

ciossi


2 Answers

Use this plugin https://www.npmjs.com/package/cordova-plugin-keyboard#keyboarddidhide

or "cordova plugin add cordova-plugin-keyboard"

Then just add this on deviceReady:

Keyboard.automaticScrollToTopOnHiding = true;

This works for me in ios12

like image 148
doru Avatar answered Nov 12 '22 11:11

doru


I fix it by a tricky method,You should try:

- (void)keybordDidHide {
    if (!CGPointEqualToPoint(self.lastContentOffset, self.webView.scrollView.contentOffset)) {
        [self.webView.scrollView setContentOffset:self.lastContentOffset];
        [self.webView.scrollView setContentInset:UIEdgeInsetsMake(0, 0, 0, 0)];
    }
}

- (void)keybordWillShow {
    self.lastContentOffset = self.webView.scrollView.contentOffset;
}
like image 1
Ethan Hou Avatar answered Nov 12 '22 10:11

Ethan Hou