Skip to content

Instantly share code, notes, and snippets.

@rakhimoni
Last active November 21, 2017 11:06
Show Gist options
  • Save rakhimoni/032468d5c4a41ba02714b40632c7eb26 to your computer and use it in GitHub Desktop.
Save rakhimoni/032468d5c4a41ba02714b40632c7eb26 to your computer and use it in GitHub Desktop.
Changing view properties directly instead of calling applyProperties:
/**
Issue Description: Changing view properties directly instead of calling applyProperties
(e.g. someProperty = value instead of applyProperties({someProperty: value}) ) results in a crash on Android. 
**/
I have tested the issue and unable to reproduce the issue using SDK 6.3.0.GA with the sample code provided below.
Test Environment:
Appcelerator Command-Line Interface, version 6.3.0
Mac OS X 10.13.1
Architecture 64bit
CPUs 4
Memory 8589934592
Axway Appcelerator Studio, build: 4.10.0.201709271713
Appcelerator Command-Line Interface, version 6.2.4,
SDK Version = SDK 6.3.0.GA
Node.js Version = 4.7.0
npm Version = 2.15.11
Android Device: HUAWEI GR3 2017
Test Code:
var win = Ti.UI.createWindow({
backgroundColor: 'pink',
});
var view = Titanium.UI.createView({
width:300,
});
win.add(view);
view.height=400; // use properties directly instead of calling applyProperties
view.applyProperties({ // calling applyProperties for making backgroundGradient of the view
backgroundGradient: {
type: 'linear',
startPoint: { x: '0%', y: '50%' },
endPoint: { x: '100%', y: '50%' },
colors: [
{ color: 'red', offset: 0.0},
{ color: 'blue', offset: 0.25 },
{ color: 'red', offset: 1.0 }
],
}
});
win.open();
Test Steps:
1. Open Studio and create a classic project
2. Run the project.
3. After running,we will see that the displayed view which has height 400,is using view properties directly instead of calling applyProperties and
and the Gradient background color of the view is using applyProperties method.Both methods are working as expected.
Output: https://s18.postimg.org/txh9acdh5/Screenshot_20171121-130250.png
Helpful Ticket: https://jira.appcelerator.org/browse/TIMOB-14285
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment