airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
206 stars 11 forks source link

Application service keyboard doesn't seem to return correct value #2117

Open coelhonix opened 2 years ago

coelhonix commented 2 years ago

I'm not sure if i'm using this the correct way, but i'm trying to move some elements around when I get a soft keyboard activate, using the application service keyboard height. However I'm not beeing able to get the correct keyboard height.

private function onKeyboardActivate(e:SoftKeyboardEvent):void 
{
  TweenLite.delayedCall(1, delayedKeyboard);
}

private static var offsetTopo:int = 0;
private function delayedKeyboard(){

  #...some code...#

  CONFIG::AIR {
    trace("KEYBOARDACTIVATE -> Application.service.keyboard.height:", Application.service.keyboard.height);
    if(Application.service.keyboard.height > 0){
      offset = Application.service.keyboard.height;

      trace("Distriqt Application", offset);
      trace("* AppScale", scaleApp*offset);

      #...some code...#

      new TweenLite(chatMC, 0.2, {delay:0, y:newY});
      new TweenLite(chatMC.top, 0.2, {delay:0, y:chatMC.top.y+offsetTopo});
    }
  }

  new TweenLite(chatMC, 0.2, {delay:0.4, y:offset});
  new TweenLite(chatMC.top, 0.2, {delay:0.4, y:offsetTopo});
}

I may be doing something wrong, but I even tried to scale the keyboard height but it doesn't seem to return the correct value.

Thanks in advance!

ajwfrost commented 2 years ago

Are you able to say what you get for the height from that trace, vs what the actual height of the keyboard is?

I'm not entirely sure why you're adding two tweens - for chatMC and for chatMC.top - and also don't forget that the last two lines written above to tween back to offset/offsetTopo will get added as well so essentially there are four TweenLite constructors being called here.. not sure whether that's what you actually want/need to do.

(@marchbold fyi..)

marchbold commented 2 years ago

The keyboard can be a little tricky depending on the device and OS you are using.

https://docs.airnativeextensions.com/docs/application/display/soft-keyboard

If you are still experiencing issues, I suggest logging an issue in the extensions github repository and including as much information as you can, such as device, platform, version etc. and ideally the device logs.