[Solved] Avoid scrolling if keyboard appears on ios app

Get help using Construct 2

Post » Tue Jun 13, 2017 3:22 pm

Hello there!

I need help with another scrolling issue: If iam opening the webview window where i can insert some informations (writing an email or something) - the ios keyboard appears, and the whole application is scrolled up. The weird thing is: i get a black bar (from the bottom of the app to the virtual keyboard)

iam using this line of code to avoid basically scrolling in the app (included into the intelxdk.additions file)

<preference name="DisallowOverscroll" value="true" />

Is there a solution to avoid the scrolling, if youre using a virtual keyboard?

thank you very much!

Screenshot:

http://imgur.com/a/YqOxn
Last edited by Congrats2u on Wed Jun 14, 2017 10:28 am, edited 1 time in total.
B
8
S
2
Posts: 141
Reputation: 1,002

Post » Tue Jun 13, 2017 3:46 pm

do a search on cordova issue or on ios safari iframe problems
google is your friend :D
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Tue Jun 13, 2017 5:13 pm

I found a cordova solution (ionic keyboard plugin you can add in the xdk manager)

but iam not sure where i would have to embed the code...

excample:
http://ionicframework.com/docs/v1/api/page/keyboard/

Do you know how to handle this?
B
8
S
2
Posts: 141
Reputation: 1,002

Post » Tue Jun 13, 2017 6:46 pm

i did never use ionic
i'm using standard cordova CLI
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Wed Jun 14, 2017 10:22 am

@All

I solved this issue - i did (of course a lot of research) and found a solution.

At first add the ionic keyboard plugin into cordova. Then you have to prepare your index.html file too.

Add:
cordova.plugins.Keyboard.disableScroll(true);

into the deviceready function.

in my case it looks like this:

<script>
document.addEventListener("deviceready", function ()
{
cordova.plugins.Keyboard.disableScroll(true);

window["c2iscordova"] = true;

// Create new runtime using the c2canvas
cr_createRuntime("c2canvas");

document.addEventListener("pause", function() {
cr_setSuspended(true);
}, false);

document.addEventListener("resume", function() {
cr_setSuspended(false);
}, false);

}, false);

</script>

In the intelxdk.confing.additions i added some preferences on top of the script. It looks like this:

<!-- Change the debuggable preference to true to build a remote CDT debuggable app for -->
<!-- Crosswalk apps on Android 4.0+ devices and Cordova apps on Android 4.4+ devices. -->
<preference name="debuggable" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="KeyboardDisplayRequiresUserAction" value="false"/>

Thats it. It works in my case.

Have a nice day!
B
8
S
2
Posts: 141
Reputation: 1,002


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests