Skip to content

Commit

Permalink
[TIMOB-26300] (7_3_X) iOS: Fix crash when using (deprecated) kroll-th…
Browse files Browse the repository at this point in the history
…read (#10255)

* [TIMOB-26300] Fix crash when using kroll-thread

* Add unit-test

* Linting

* Improve test-case
  • Loading branch information
hansemannn committed Aug 21, 2018
1 parent d8486be commit 0e4c581
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 8 deletions.
10 changes: 3 additions & 7 deletions iphone/Classes/TiUITextArea.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,17 @@ - (void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds
{
if (textWidgetView == nil) {
TiUITextViewImpl *textViewImpl = [[TiUITextViewImpl alloc] initWithFrame:CGRectZero];
textViewImpl.delaysContentTouches = NO;
[textViewImpl setTouchHandler:self];
textViewImpl.delaysContentTouches = NO;
textViewImpl.delegate = self;
textViewImpl.text = @"";

[self addSubview:textViewImpl];
[textViewImpl setContentInset:UIEdgeInsetsZero];
self.clipsToBounds = YES;

lastSelectedRange.location = 0;
lastSelectedRange.length = 0;
//Temporarily setting text to a blank space, to set the editable property [TIMOB-10295]
//This is a workaround for a Apple Bug.
textViewImpl.text = @" ";
textViewImpl.editable = YES;

textViewImpl.text = @""; //Setting TextArea text to empty string

textWidgetView = textViewImpl;
}
Expand Down
69 changes: 69 additions & 0 deletions tests/Resources/ti.ui.textarea.addontest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Appcelerator Titanium Mobile
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* global Ti, Titanium */
/* eslint no-unused-expressions: "off" */
'use strict';

describe('Titanium.UI.TextArea', function () {
var win;

afterEach(function () {
if (win) {
win.close();
}
win = null;
});

// Tests adding and removing a TextArea's focus.
it('textArea in tabGroup', function (finish) {
var windowA, windowB, tabA, tabB, tabGroup;

this.timeout(7500);

windowA = Ti.UI.createWindow();
windowB = Ti.UI.createWindow();

tabA = Ti.UI.createTab({
window: windowA,
title: 'Tab A'
});

tabB = Ti.UI.createTab({
window: windowB,
title: 'Tab B'
});

tabGroup = Titanium.UI.createTabGroup({
tabs: [ tabA, tabB ]
});

windowA.addEventListener('open', function () {
var subwin, typingView, keyboardMessageView, keyboardMessage;

subwin = Ti.UI.createWindow({ backgroundColor: 'blur' });

subwin.addEventListener('open', function () {
finish();
});

typingView = Ti.UI.createView();
keyboardMessageView = Ti.UI.createView();
keyboardMessage = Ti.UI.createTextArea();

keyboardMessageView.add(keyboardMessage);
typingView.add(keyboardMessageView);
subwin.add(typingView);

setTimeout(function () {
tabA.open(subwin);
}, 1000);
});

tabGroup.open();
});
});
2 changes: 1 addition & 1 deletion tests/Resources/ti.ui.textfield.addontest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* global Ti, Titanium */
/* global Ti */
/* eslint no-unused-expressions: "off" */
'use strict';
var should = require('./utilities/assertions');
Expand Down

0 comments on commit 0e4c581

Please sign in to comment.