[ALOY-1707] TextField property "value" generate a bug in iOS
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Resolved |
| Resolution | Not Our Bug |
| Resolution Date | 2019-11-07T22:17:01.000+0000 |
| Affected Version/s | Alloy 1.14.1 |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | ACF, en |
| Reporter | Nazmus Salahin |
| Assignee | Nazmus Salahin |
| Created | 2019-10-11T05:42:01.000+0000 |
| Updated | 2019-11-07T22:17:01.000+0000 |
Description
Just found a rather odd bug using a textfield. Looks like it refuses to take a value of 86.6 instead setting it to 86.599999999
*Test Environment:*
Appcelerator Command-Line Interface, version 7.0.12
Operating System
Name = Mac OS X
Version = 10.13.6
Architecture = 64bit
# CPUs = 4
Memory = 8589934592
Node.js
Node.js Version = 10.16.3
npm Version = 6.9.0
Titanium CLI
CLI Version = 5.1.1
Titanium SDK
SDK Version = 8.2.0.GA
Target Platform = iphone
*Test code:*
*Index.xml*
<Alloy>
<Window layout="vertical">
<TextField top="50" value="86.6" id="Text1" onClick="onClick" width="80%"/>
</Window>
</Alloy>
*Index.js*
function onClick() {
Ti.API.info('@@@ Setting focus');
alert($.Text1.getValue());
}
$.index.open();
*Test result:* See the attachment section.
*Test steps:*
1. Open Appcelerator studio and create an alloy project.
2. Add index.xml and index.js in the project.
3. Run the project with iOS 13 or iOS 12 device or simulator.
Attachments
| File | Date | Size |
|---|---|---|
| Screenshot 2019-10-23 at 12.08.29 AM.png | 2019-10-22T18:46:39.000+0000 | 42971 |
| Simulator Screen Shot - iPhone X - 2019-10-11 at 11.34.27.png | 2019-10-11T05:35:09.000+0000 | 69418 |
A quick workaround is set the value in "index.js" instead of "index.xml". index.xml
index.js<Alloy> <Window layout="vertical"> <TextField top="50" id="Text1" onClick="onClick" width="80%"/> </Window> </Alloy>function onClick() { Ti.API.info('@@@ Setting focus'); alert($.Text1.getValue()); } $.Text1.value = "86.6"; $.index.open();