Closed templatetuners closed 5 years ago
iOS? Android? both?
Are you using cordova-plugin-ionic-webview?
Android Cordova and not using ionic-webview
Have you solved it? I have the same problem as you
@templatetuners I solved this by setting "readonly".
<ion-input (focus)="handleScanInputFocus()" #scanInput id="scan_input" ></ion-input>
@ViewChild('scanInput') scanInputElement: any;
handleScanInputFocus(){ let elm = this.scanInputElement.getElementRef().nativeElement.firstElementChild;
elm.setAttribute('readonly','readonly'); //The keyboard will not pop up
setTimeout(() => {
elm.removeAttribute('readonly'); //Remove the "readonly", and the cursor is still in
}, 200)
}
The keyboard will always appear when you focus it, for preventing it you can do some approaches as the suggested by @OMGFoxChen.
How about you have some activity with the page like gestures tap swipe pan, is the cursor still in? @OMGFoxChen
@OMGFoxChen you save me <3 Thank you!
You could use inputRef.setBlur()
immediately after you focused <IonInput>
Then: 1) keyboard will not be appear, 2) input will not be focused 3) but content will be scrolled to that input
I have an input and I need to focus it to populate with data from a bluetooth barcode scanner. On
input:focus()
the keyboard is always opening. Tried withKeyboard.hide();
withsetTimeout
nothing works.