Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No onKeyboardDidShow / onKeyboardDidHide on Android #85

Open
DennisNicolas opened this issue Aug 6, 2018 · 0 comments
Open

No onKeyboardDidShow / onKeyboardDidHide on Android #85

DennisNicolas opened this issue Aug 6, 2018 · 0 comments

Comments

@DennisNicolas
Copy link

DennisNicolas commented Aug 6, 2018

Hi Eddy,

i try to use this plugin in an Ionic 2 App.

Installed it with
$ ionic cordova plugin add cordova-plugin-native-keyboard $ npm install --save @ionic-native/native-keyboard
as described here.
https://ionicframework.com/docs/native/native-keyboard/

added
providers: [NativeKeyboard]
to app.module.ts

and this is how my code looks like:

import { StatusBar } from 'ionic-native'
import { ViewChild, Component } from '@angular/core';
import { Content, IonicPage } from 'ionic-angular';

import { NativeKeyboard } from '@ionic-native/native-keyboard';

@IonicPage()
@Component({
  selector: 'page-draft',
  templateUrl: 'draft.html'
})
export class DraftPage {
   @ViewChild(Content) content: Content;

   constructor(private nativeKeyboard: NativeKeyboard) {

   }

   ngAfterViewInit() {
      var options = {
         onSubmit: function() {
            alert("ho");
         },
         onKeyboardWillShow: function(){},
         onKeyboardDidShow: function() {
            alert("hi");
         },
         onKeyboardWillHide: function(){},
         onKeyboardDidHide: function() {
            alert("he");
         },
         onTextChanged:function() {},
         autoscrollElement: document.getElementById("content"),
         scrollToBottomAfterMessengerShows: true,
         keepOpenAfterSubmit: true,
         animated: true,
         showKeyboard: false,
         text: "",
         textColor: "#444444",
         placeholder: "...",
         placeholderColor: "#CCCCCC",
         backgroundColor: "#F6F6F6",
         textViewBackgroundColor: "#F6F6F6",
         textViewBorderColor: "#666666",
         maxChars: 0,
         counterStyle: "none",
         type: "default",
         appearance: "light",
         secure: false,
         leftButton:  {
            type: 'ionicon',
            value: '\uf48a',
            color: '#ff0000', 
            textStyle: 'normal', 
            disabledWhenTextEntered: false,
            onPress: function () {
            }
         },
         rightButton: {
            type: 'text', // or 'fontawesome' or 'ionicon', default 'text'
            value: 'Send', // 'fa-battery-quarter', // '\uf2c3', // 'Send', // default 'Send'
            textStyle: 'bold', // 'normal' (default), 'bold', 'italic'
            color: '#FF0000', // default iOS blue
            onPress: function () {
              console.log("Right button was pressed - text was passed to 'onSubmit' if provided.");
            }
         }
      }
      this.nativeKeyboard.showMessenger(options);
      
   }

}

Unfortunately it looks like none of the functions like onKeyboardDidShow or onKeyboardDidHide are ever called on Android. The messenger appears but as soon as i tap into it the keyboard is shown but the functions are not called. (And the keyboard overlays the input but i think thats a different issue.)

iOS works like expected.

Is there anything wrong with my code or are there any known conflicts with other plugins like cordova-plugin-statusbar or something like that?

Needles to say that i would be happy to pay for this amazing piece of work as soon as it actually works in my environment.

Thanks,
Dennis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant