[TIMOB-14065] Android: Slider fires 'change' event when it is laid out
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | Android |
Labels | alloy, mobile, reprod, slider |
Reporter | Carter Lathrop |
Assignee | Unknown |
Created | 2013-05-30T15:16:20.000+0000 |
Updated | 2018-02-28T20:04:21.000+0000 |
Description
*Problem*
When a 'change' event is added to a slider like this:
var win1 = Titanium.UI.createWindow({
backgroundColor: 'gray'
});
var slider = Titanium.UI.createSlider({
top: 50,
min: 0,
max: 100,
width: '100%',
value: 50
});
slider.addEventListener('change', onSliderChange)
function onSliderChange() {
alert('Slider says: Hello World!')
}
win1.add(slider);
win1.open();
While I believe that it makes sense in some cases, in others, it's a problem.
In my particular case, if the callback is launched when the window opens, it causes a problem because it should be fired only when *the user* moves the slider.
I don't know what you think of this but I believe it makes more sense that the 'change' event is not fired when the slider is simply added to the view.
Attachments
File | Date | Size |
---|---|---|
Archive.zip | 2013-05-31T07:59:31.000+0000 | 3683648 |
Hello Kevin, Thanks for bringing this to our attention. Would you mind providing a full test case of this issue? In order to review a bug we require a test case which can easily be added into an app.js or alloy project which displays the bug at hand. This is pertinent because it ensures a speedy review and that the problem is understood between everyone involved. Once you have provided the test case I will look into this further. For future reference: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report Thank you for your cooperation, Carter
app folder and tiapp.xml for test case. (This is an Alloy project)
Kevin, I couldn't get your project to work, I just made my own test case to show the issue. This is indeed a bug (or at least questionable behavior). Tested and confirmed with Android 4.1.2 on Ti SDK 3.2 CI. Moving to Ti-Mobile for engineering to review. Thanks for bringing this to our attention. Regards, Carter
Just make sure to ignore any slider change events prior to the first touchstart event and it's OK.
I am able to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA 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
I feel like this bug could use some attention. Right now when a slider is implemented with a pre-defined value a workaround is needed.