Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (keyboard)
Viewing all articles
Browse latest Browse all 352

How to auto-resize textarea height in a toolbar

$
0
0

I need to automatically increase the height of a textarea when text is typed. Same behavior as when you type an SMS message. I found that people were able to achieve that by setting height: Ti.UI.SIZE but that doesn't work for some reason when you use textarea in a keyboard toolbar. Also the toolbar itself is not resizing automatically. I'm trying to do it the following way.

var toolbarMessagefield = Ti.UI.createTextArea({
    width:250,
    height: 30,
    left:1,
    bottom:6,
    suppressReturn:false,
    animate: true,          
    font: {fontSize:16}     
});
 
var sendButton = Titanium.UI.createButton({
    title: "send",      
    backgroundColor:'transparent',      
    right: 5        
});
 
var msgToolbar = Titanium.UI.iOS.createToolbar({
    items:[ toolbarMessagefield, sendButton],       
    height: "auto",
    width: Ti.UI.FILL
});
 
// Textfield you click on so that keyboard and textarea pop up
var messagefield = Ti.UI.createTextField({
    height:30,
    width:'80%',
    left:5,
    bottom:6,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    keyboardToolbar: msgToolbar
});

Viewing all articles
Browse latest Browse all 352

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>