[TIMOB-25897] iOS: Ti.UI.iOS.Stepper handles "value" boundaries incorrect
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-05-15T23:59:27.000+0000 |
| Affected Version/s | Release 6.3.0, Release 7.1.0 |
| Fix Version/s | Release 7.3.0 |
| Components | iOS |
| Labels | ios, stepper |
| Reporter | Hans Knöchel |
| Assignee | Vijay Singh |
| Created | 2018-03-23T12:41:07.000+0000 |
| Updated | 2018-05-15T23:59:30.000+0000 |
Description
We handle allowed values for our Stepper UI element with:
if (newValue < [[self stepper] maximumValue] && newValue > [[self stepper] minimumValue]) {
[[self stepper] setValue:newValue];
} else {
NSNumber *currentValue = [NSNumber numberWithDouble:[[self stepper] value]];
[self.proxy replaceValue:currentValue forKey:@"value" notification:NO];
NSLog(@"[WARN] The value passed in must be smaller than the maximum and bigger than the minimum stepper values");
}
Which is wrong. It should be newValue <= maximum && newValue >= minimum.
PR - https://github.com/appcelerator/titanium_mobile/pull/10046 Test Case -
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var stepper = Ti.UI.iOS.createStepper({ top: 50, tintColor: "green", steps: 3, maximum: 30, minimum: 0, value: 30 }); var button = Ti.UI.createButton({ top: 100, title: 'Get stepper Value' }); button.addEventListener('click', function(e){ Ti.API.info(stepper.value); }); win.add(button); win.add(stepper); win.open();