Input automatically gets focus after entering the page. There is no problem in the computer simulation test, but it does not work on the mobile phone and the keyboard does not pop up.
I have basically tried all the online search methods, such as adding <preference name="KeyboardDisplayRequiresUserAction" value="false" />
to config.xml
Or add a delay, such as *.ts
@ViewChild('input') myInput: any;
ngAfterViewInit() {
setTimeout(() => {
console.log('focus')
this.myInput.setFocus();
}, 2000);
}
*.html
<ion-input autofocus #input placeholder="input"></ion-input>
I don’t know if you have any other methods.
PS. The WeChat built-in browser and Safari used for the browser do not work. I have tried the WeChat built-in browser WKWebView
and UIWebView
and the kernel does not work either.
天蓬老师2017-06-24 09:45:52
You first try calling cordova.plugins.Keyboard.show() directly
If possible, breakpoint to track what is executed after this.myInput.setFocus()