pec1985 / tismsview Goto Github PK
View Code? Open in Web Editor NEWExpandable Text Area Module - iOS - Titanium
License: Other
Expandable Text Area Module - iOS - Titanium
License: Other
I have a feature request. In my app, I have a community messaging system. There I have an Incoming and an Outgoing mailbox. In the Outgoing mailbox I only want to show the messages, but not the possibilty to send a new one.
Is that possible to have a function: hideTextArea or something like that?
Can you add the ability to disable/enable the send button?
Just like the SMS app. I don't want the user to be able to click the button if there is no text in the textArea.
If I do a .receiveMessage()
right after an .sendMessage()
, the scrolling is set on the .sendMessage()
and not on the last item .receiveMessage()
, like it should, so the last .receiveMessage()
is not shown, and I have to scroll to see it.
When building the example app (commit 9f56bfa) with the iOS 5 SDK it crashes. It works fine with 4.3.2.
Titanium Mobile SDK 1.7.3
Console dump:
[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x02e49052 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x02c69d0a objc_exception_throw + 44
2 CoreFoundation 0x02df1a78 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x02df19e9 +[NSException raise:format:] + 57
4 UIKit 0x009ffda4 __windowForView + 158
5 UIKit 0x00a01bf2 -[UIView(Hierarchy) _postMovedFromSuperview:] + 30
6 UIKit 0x00a06a4f -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1633
7 UIKit 0x00a0072b -[UIView(Hierarchy) addSubview:] + 56
8 SMSViewTest 0x0031fe9f -[PESMSTextArea layoutSubviews] + 275
9 UIKit 0x00a08322 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 178
10 CoreFoundation 0x02e4ae72 -[NSObject performSelector:withObject:] + 66
11 QuartzCore 0x01cbc92d -[CALayer layoutSublayers] + 266
12 QuartzCore 0x01cc6827 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 231
13 QuartzCore 0x01c4cfa7 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 377
14 QuartzCore 0x01c4eea6 _ZN2CA11Transaction6commitEv + 374
15 QuartzCore 0x01c4e580 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 80
16 CoreFoundation 0x02e1d9ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
17 CoreFoundation 0x02db4670 __CFRunLoopDoObservers + 384
18 CoreFoundation 0x02d804f6 __CFRunLoopRun + 1174
19 CoreFoundation 0x02d7fdb4 CFRunLoopRunSpecific + 212
20 CoreFoundation 0x02d7fccb CFRunLoopRunInMode + 123
21 GraphicsServices 0x0285d879 GSEventRunModal + 207
22 GraphicsServices 0x0285d93e GSEventRun + 114
23 UIKit 0x009c9a9b UIApplicationMain + 1175
24 SMSViewTest 0x0000479a main + 442
25 SMSViewTest 0x000030e5 start + 53
2011-10-29 19:27:27.999 SMSViewTest[5789:17603] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Requesting the window of a view (<UIButton: 0x8c06e40; frame = (0 0; 0 0); transform = [0, 0, 0, 0, 0, 0]; alpha = 0; opaque = NO; autoresize = TM; layer = (null)>) with a nil layer. This view probably hasn't received initWithFrame: or initWithCoder:.'
*** First throw call stack:
(0x2e49052 0x2c69d0a 0x2df1a78 0x2df19e9 0x9ffda4 0xa01bf2 0xa06a4f 0xa0072b 0x31fe9f 0xa08322 0x2e4ae72 0x1cbc92d 0x1cc6827 0x1c4cfa7 0x1c4eea6 0x1c4e580 0x2e1d9ce 0x2db4670 0x2d804f6 0x2d7fdb4 0x2d7fccb 0x285d879 0x285d93e 0x9c9a9b 0x479a 0x30e5)
terminate called throwing an exception
[DEBUG] App Spec: <DTiPhoneSimulatorApplicationSpecifier 0x100126f00> specified by path /Users/sindresorhus/Projects/Titanium/SMSViewTest/build/iphone/build/Debug-iphonesimulator/SMSViewTest.app
[DEBUG] SDK Root: <DTiPhoneSimulatorSystemRoot 0x100125fb0> path=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk version=5.0 name=Simulator - iOS 5.0
[DEBUG] using device family iphone
[DEBUG] Session started
[DEBUG] Session did end with error (null)
[INFO] Application has exited from Simulator
Hi,
I am looking for a standalone module. I don't need the complete sms view package, just a simple and effective way to integrate expandable textarea.
@pec1985 how can I contact you through github? Just get the message "pec1985 has not provided an email address". Would be great if you can drop me a line at [email protected]
Best
Danny
It would be useful to get the index of the message clicked and the type (send/recieve) in the message click event object.
Hello,
Thanks really much for your awesome module !
It works great but everytime I try to modify the button title my app simply crashes. Maybe it is due to the fact that i'm running iOS 5.
If you could help me out on this one, maybe it's all my fault
Bye!
In simulator everything looks fine, but installing the app with Ti.SmsView on device, it produces
[ERROR] Error: Traceback (most recent call last):
File "/Users/sebastian/Library/Application Support/Titanium/mobilesdk/osx/1.7.3/iphone/builder.py", line 1305, in main
execute_xcode("iphoneos%s" % iphone_version,args,False)
File "/Users/sebastian/Library/Application Support/Titanium/mobilesdk/osx/1.7.3/iphone/builder.py", line 1066, in execute_xcode
output = run.run(args,False,False,o)
File "/Users/sebastian/Library/Application Support/Titanium/mobilesdk/osx/1.7.3/iphone/run.py", line 39, in run
sys.exit(rc)
SystemExit: 65
on build
In the comments in the example app, it says that autocorrect
defaults to false
. This is not correct. It actually defaults to true
.
opens window fine on ios 4.3 but crashes on iOS 5;
Can you include the source view of the message in the event object of the message click event?
On iPad OptionDialog needs a source view to know where to place the OptionDialog popover. I'm showing a OptionDialog when a message is clicked. I tried using event.source
, but it seems to be the source view of the message table.
The label should have some margin on the sides. Currently it fills the screen width.
In the Appcelerator Marketplace seems to be an old version. There isn't the "addLabel" function within. And I'm poorly not able to get my own compiled version running :-/
I am using the following:
var textArea = Ti.Pedro.createSMSView({
backgroundColor: '#b7d4fa',
assets:'assets',
buttonTitle: 'Post',
autocorrect: true,
});
and the screen does not show the control at all.
When using .getAllMessages()
, label is the type send
, it should be type label
.
There is an UI bug with the toolbar when running the example app on a physical iPhone. This doesn't happen in the simulator.
This happens when the textArea is focused:
Tested with commit 78eb297
There is still a bug that the first message, sent or received, will not appear on the screen, but 40 pixels up (offscreen)
Gotta look into it.
It seems that right now only an image blob or a text is part of the messages. I would like to include a reference to an object. This way I can insert views with eventlisteners, to say, open a link or something like that.
Is there any easy way to do that?
Thanks
Is there a way to get the textArea
to be focused when the app opens?
I've tried adding textArea.focus();
to the example app, but it just crashes:
2011-09-17 02:36:59.636 Nynorsk2[85673:18a07] bool _WebTryThreadLock(bool), 0x6b22c60: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
It works if I focus the textArea
in the window focus event:
win.addEventListener('focus', function() {
textArea.focus();
});
But then it only focuses after the app has loaded, so it's a noticeable keyboard slideup animation.
Activating .focus()
on the built-in textArea works without having to have it in the window focus event.
Can you try to fix this?
If I have the textArea focused and try to hit the view background to blur it and accidentally hit a label, nothing happens, since the label absorbs the click event. This should not happen.
The .sendColor
property is useful for distinguishing different types of messages.
Currently I'm changing the .sendColor
before sending a message depending on what kind of message it is.
The problem is that I want the conversation to be persistent, so i save and load the conversation, but the .sendColor
is not persisted.
What I would like is the that the .getAllMessages()
method returned and array like this:
[
{
index: 0,
send: 'dsfdsf',
sendColor: 'Purple',
selectedColor: 'Blue'
},
{
index: 1,
recieve: 'dsfdsf',
recieveColor: 'Gray',
selectedColor: 'Blue'
}
]
And the .loadMessages()
would accept an array like this, and apply the colors.
need a possibility to set the width of the bubbles. best practice would be in percent.
I want to use this in an iPad app, but currently it does not support landscape view. The textArea toolbar disappears when rotated to landscape.
If the "assets" property is missing, the module will not find the smsview.bundle.
If that property is missing, the module has to look for the smsview.bundle in the Resources directory by default.
Is there a way to make the list scroll down to the bottom after sending a message? Is this feature already supported?
when you load messages that go over the height of the page, it doesn't scroll to the bottom, but to the top.
So I can't read the last messages that I received, until I manually scroll down.
The assets
of property of textArea
should default to the string assets
for consistency, since every other property has a default value.
App crashes when the buttons are not disabled.
if i want to translate the "send" of the send button, the button has a fixed width.
some translations goes out the button
Old:
Could you help me with this?
If the button title gets to long, it now truncates the text. For example "lipsum" becomes "li...um".
It should instead resize the text to fit.
After successful compiling the newest version of Ti.smsview, everthing looks fine. but..
I tried to use the addLabel function. The response is:
Result of expression 'smsView.addLabel' [undefined] is not a function.
Here is some code:
var smsView = Ti.SMSView.createView({
//maxLines:6, // <--- Defaults to 4
//minLines:2, // <--- Defaults to 1
backgroundColor : config.backgroundColor, // <--- Defaults to #dae1eb
assets : 'assets', // <--- Defaults to nothing, smsview.bundle can be places in the Resources dir
// sendColor: 'Green', // <--- Defaults to "Green"
recieveColor : 'Gray', // <--- Defaults to "White"
// selectedColor: 'Blue', // <--- Defaults to "Blue"
// editable: true, // <--- Defaults to true, do no change it
// animated: false, // <--- Defaults to true
// buttonTitle:L('send'), // <--- Defaults to "Send"
// font: { fontSize: 12 ... }, // <--- Defaults to... can't remember
// autocorrect: false, // <--- Defaults to true
// textAlignment: 'left', // <--- Defaults to left
// textColor: 'blue', // <--- Defaults to "black"
returnType : Ti.SMSView.RETURNKEY_DONE // <---- Defaults to Ti.SMSView.RETURNKEY_DEFAULT
// camButton : true // <--- Defaults to false
});
smsView.addEventListener('buttonClicked', function(e) {
smsView.addLabel(new Date()+'');
smsView.sendMessage(e.value);
});
The message bubbles jump a lot on rotating. Maybe they should be locked while rotating and scrolled to the right position after the rotation?
The built-in SMS app is lazy and just fades between the states.
Can we have an option to show the copy menu tooltip when a message is clicked?
Calling .empty()
on the SMSView now crashes the app. Happens in the example app.
Tested with commit 78eb297
When using the smsview on a window within a navigationGroup, and you try to send a message, there is a large space between the send message bar and the keyboard. It seems to work fine if you use the window in "modal" mode.
To make it even more like the built-in SMS app. You should add support for adding labels into the conversation. In the same style as the screenshot. There's a lot of use cases for this; like to separate conversation, add some additonal info, ...
Example:
addLabel('19. july 2011');
sendMessage('Lorem ipsum');
There is a method to load an array of messages. Could we also have a method that does the opposite?
To make the conversation persistent it would be useful if it was also possible to save the conversation to an array in the format it uses to load an array.
Hi Pedro! Great work on the SMSview module. Is it possible to detach the keyboard toolbar elements (camera / textarea / send) from the bubble chat view in this module? I need to code a messaging element that will use the keyboard toolbar to allow the user to post a message (to a tableview, not bubble chats). Can your module be modified to do this? I'm not familiar with iPhone modules or Xcode to figure this one on my own. Any guidance you can provide is appreciated.
I opened a ticket (http://support.appcelerator.com/tickets/APP-258734/tickets) about trying to get something to work on the iPhone, and then noticed you posted a version of SMSview for Android that works great, but I need something for iPhone. Thanks!!!
If a message is not sent because of various issues, there should be a way to resend it just like the sms app.
Since the iPad has a lot more screen real estate than the iPhone. It would be useful to have a property on the textArea
to set the max height it's allowed to expand. Right now it expands to about 4 lines.
The backgroundColor
property of the textArea
should default to the color of the built-in SMS app: #dae1eb
If you have the PSD files for the assets. Would you consider releasing them?
Would be nice to be able to modify the assets.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.