Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23712] iOS: Ti.UI.IOS.Stepper.value does not default to correct value

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2016-08-02T15:25:25.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sRelease 6.0.0
ComponentsiOS
Labelsqe-5.4.0, qe-6.0.0
ReporterEric Wieber
AssigneeAngel Petkov
Created2016-08-01T18:28:31.000+0000
Updated2016-09-15T08:57:25.000+0000

Description

The default value for Ti.UI.IOS.Stepper.value is null, when it should be 0 according to: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIStepper_Class/index.html#//apple_ref/occ/instp/UIStepper/value *Steps to Reproduce Issue*: 1. Create a new Alloy project 2. Use the below code to demonstrate the issue 3. Run the project and click on "OK" *Actual Results* The value is output as null *Expected Results* The value is output as 0 *Notes* This impacts trying to decrement the stepper on first click. Trying to increment the stepper sets it to the step value. *Code*: *index.xml*
<Alloy>
    <Window class="container">
        <Stepper id="stepper" onClick="doClick" 
             top="30" tintColor="green" steps ="3" />
        <Button onClick="btnClick">OK</Button>
    </Window>
</Alloy>
*index.js*
function doClick(e) {
    Ti.API.info($.stepper.value);
}

function btnClick(e) {
    Ti.API.info($.stepper.value);
}

$.index.open();

Comments

  1. Angel Petkov 2016-08-02

    PR: https://github.com/appcelerator/titanium_mobile/pull/8186 Demo Code:
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       var stepper = Ti.UI.iOS.createStepper({
           top: 20,
           tintColor:"green",
           steps:3,
           maximum:30,
           minimum:0
       });
       
       var button = Titanium.UI.createButton({
          title: 'Get Value',
          top: "50%",
          middle: 0,
          width: 100,
          height: 50
       });
       
       button.addEventListener("click",function(e){
          alert(stepper.value); // or (stepper.getValue())
       });
       
       win.add(button);
       win.add(stepper);
       win.open();
       
  2. Harry Bryant 2016-09-15

    Verified as fixed, Ti.UI.IOS.Stepper.value default value is 0. Tested On: iPhone 6 Plus 10.0.1 Device & Simulator iPhone 5S 9.3.5 Device Mac OSX El Capitan 10.11.6 Ti SDK: 6.0.0.v20160914165725 Appc Studio: 4.8.0.201609101003 Appc NPM: 4.2.8-6 App CLI: 6.0.0-42 Xcode 8.0 Node v4.4.7 *Closing ticket.*

JSON Source