uitextview - Correct way to dismiss keyboard from a TextView in Nativescript -
i have following textview:
<textview id="textfieldbody" hint="some hint" text="{{ }}" editable="true" class="textfield" returnkeytype="done" />
i'm trying correctly implement that:
- when user presses "done", keyboard disappears
- when user touches outside (blur) of textview, keyboard disappears
- maybe when focus on textview, scroll rest of view doesn't disappear behind keyboard? (not sure yet one)
it's unclear me how achieve that. kind of backend code need implement?
ideally, i'm looking solution works both ios , android.
when user press done, keyboard disappears
for one, can put listener textview triggered when user press done
button. had @ nativescript api, listener applied textfield, can give textview try:
in xml:
<textfield returnpress="donetap"/>
in .js file:
function donetap(args) { var mytextfield = args.object; mytextfield.dismisssoftinput(); } exports.donetap = donetap
when user touches outside (blur) of textview, keyboard disappears
for one, put listener parent view of textfield. when tap outside, invoke function hide keyboard. thing listener overrided textfield tap. when tap on textfield, keyboard still shows up. can find answer here
when focus on textview, scroll rest of view doesn't disappear behind keyboard?
using plugin prevent keyboard covering textfield
Comments
Post a Comment