1

ive got an error in a hybrid app build with cordova phoneGap 3.3. The error is only shown on a device with ios7 (maybe only iOS7+iphone4) Its about a Text input. By touching the input the keyboard will shown up -> nice. But the cursor focus is not shown in the input field. Typen text has no effect at this moment. Clicking the input field twice the cursor will appear and typing workds well know.

I hope that is enough informations to reproduce that tricky error.

lin
  • 17,956
  • 4
  • 59
  • 83
  • Have you fixed this issue, without updating viewport meta with height=device-height? – peterkr Jan 20 '14 at 09:06
  • No, its not fixed for this moment. I did not add meta height=device-height because its not a case of use in my app. As far as i can see. you got the same problem. ;) – lin Jan 22 '14 at 17:00
  • 1
    Yes I fixed this by add following code into CDVViewController.m for example it added into webViewDidFinishLoad function `CGRect newFrame = self.webView.bounds; NSString *JS = [NSString stringWithFormat:@"viewport = document.querySelector('meta[name=viewport]'); viewport.setAttribute('content', 'user-scalable=no, initial-scale=1.0, maximum-scale=1, minimum-scale=1, width=device-width, height=%d, target-densitydpi=device-dpi');", (int) newFrame.size.height*1 ]; [self.webView stringByEvaluatingJavaScriptFromString:JS];` – peterkr Jan 24 '14 at 13:41
  • @peterkr, this also resolved my problem. please could you post it as an answer to this question with a little explanation of what the code is doing? – Daniel Bank Mar 04 '14 at 16:52
  • Adding native codes to hybrid apps is not the "clean" solution. I dont want to add this codes any time I add/remove the iOS platform. Also this bug does not happn any time. Its seems to come up with "transparent" css backgrounds? – lin Mar 05 '14 at 08:30

2 Answers2

0

Solution for iOS 7.0.0 > 7.0.2 is none

This Bug was an native one and cant be fixed by adding "meta-tags". As I said before, height=device=height is no solution for my app. Scrolling-Y is allowed!

iOS 7.0 comes up with a lot of Errors arround "input cursors". All of those are fixed in 7.0.3. No way to fix this without editing "native object C codes".

Community
  • 1
  • 1
lin
  • 17,956
  • 4
  • 59
  • 83
-1

Without using the native code solution suggested by @peterkr, we were able to get around this issue by putting the following meta element in our index.html:

<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width, target-densitydpi=device-dpi" />

Credit due to Andrew McWatters for this answer.

Community
  • 1
  • 1
Daniel Bank
  • 3,581
  • 3
  • 39
  • 50