Problem Description
When using border-related attributes in Search View, the app crashes
Testcase
1. Create a new mobile project (classic titanium)
2. Add this code to the app.js
var win = Ti.UI.createWindow({});
var searchingView = Ti.UI.Android.createSearchView({
borderColor : "#000000", //cause crash
borderRadius : 5, //cause crash
borderWidth : 1, //cause crash
backgroundColor : "#E5E4E2",
searchAsChild : true
});
var myTemplate = {
childTemplates : [{
type : 'Ti.UI.Label',
bindId : "title",
properties : {
width : Ti.UI.SIZE,
height : 44,
left : 10,
font : {
fontFamily : "Arial",
fontWeight : "normal",
fontSize : 14
},
color : "#6d6e76"
}
}]
};
var listView = Ti.UI.createListView({
top : 0,
templates : {
'template' : myTemplate
},
defaultItemTemplate : 'template',
separatorInsets : {
left : 0,
right : 0
},
backgroundColor : "#FFFFFF",
separatorColor : "#848482",
searchView : searchingView
});
var sections = [];
var fruitSection = Ti.UI.createListSection();
var fruitDataSet = [{
properties : {
"searchableText" : "Row One",
},
title : {
"text" : "Row One"
}
}];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
listView.setSections(sections);
win.setBackgroundColor("e2e2e2");
win.add(listView);
win.open();
Expected Result
Set border properties for searchView
Actual Result
Crash the app
Extra info
TiApplication: (main) [152,890] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.negoapps.searchcrash/org.appcelerator.titanium.TiTranslucentActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.; Titanium 3.3.0,2014/05/24 22:42,baea217
[ERROR] : TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.negoapps.searchcrash/org.appcelerator.titanium.TiTranslucentActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
[ERROR] :
Thanks for your report. The priority will be set by the Platform team.
Issue reproduces Titanium SDK version 3.4.0 master, 3.3.0.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Samsung Galaxy S3, Android version : 4.3
This is still an issue with 3.5.0 Alloy code:
tss:
If I remove the borderColor in tss it doesn't crash anymore.
I am able to reproduce this issue with the following environment; Pixel (7.1) Ti SDK 6.1.1.v20170626160851 Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131