My understanding is that the following…
-- TextField Listener
local function fieldHandler( getObj )
return function( event )
if ( "began" == event.phase ) then
-- This is the "keyboard has appeared" event
elseif ( "submitted" == event.phase ) then
-- This event is called when the user stops editing a field:
-- for example, when they touch a different field or keyboard focus goes away
comment.text = tostring( getObj().text )
native.setKeyboardFocus( nil ) --nothing happens?
elseif ( "ended" == event.phase ) then
end
end
end
inputTextField = native.newTextField(322, 1160, \_W \* 0.68, \_W \* 0.28)
inputTextField:addEventListener("userInput", fieldHandler)
native.setKeyboardFocus( inputTextField )
…should close the keyboard when the user presses “return”.
This has NEVER worked for me on iOS or Android, is there a require or something that I may have missed?
Everything else in the listener works, such as retrieving the text from textfield in the ended phase. The only way I can dismiss the keyboard on Android is to press the back key, and on iOS I can only get rid of it by touching elsewhere.
Have I missed something? [import]uid: 84115 topic_id: 32775 reply_id: 332775[/import]