Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25897] iOS: Ti.UI.iOS.Stepper handles "value" boundaries incorrect

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-05-15T23:59:27.000+0000
Affected Version/sRelease 6.3.0, Release 7.1.0
Fix Version/sRelease 7.3.0
ComponentsiOS
Labelsios, stepper
ReporterHans Knöchel
AssigneeVijay Singh
Created2018-03-23T12:41:07.000+0000
Updated2018-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.

Comments

  1. Vijay Singh 2018-05-15

    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();
       

JSON Source