Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20204] iOS: ListView - onload events of template items not fired

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-07-27T08:03:26.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelslistview, mainthread, qe-5.4.0
ReporterFeon Sua Xin Miao
AssigneeHans Knöchel
Created2016-01-06T23:11:35.000+0000
Updated2016-10-01T23:11:30.000+0000

Description

For iOS, onload event attached to any listview template items is not fired. It does fire for Android.

Step to reproduce

1. Run attach app on iOS Simulator 2. Run attach app on on Android Emulator 3. Compare both results

Expected Result

On 3rd row, images are animating for both OS

Actual Result

On 3rd row, images are animating on Android, but not on iOS.

Attachments

FileDateSize
classiApp.zip2016-01-06T23:06:51.000+0000120516
Simulator Screen Shot Mar 22, 2016, 4.11.56 PM.png2016-03-22T23:12:19.000+000048535

Comments

  1. Srikanth Sombhatla 2016-02-15

    [~fmiao] Since expected result is: On 3rd row, images are animating for both OS I see them animated in 3rd row and load event is invoked on all three rows as well.
       [INFO] - imageLoad:  [object TiUIImageView]
       [INFO] - imageLoad:  [object TiUIImageView]
       [INFO] - imageLoad:  [object TiUIImageView]
       
    Can you please reverify and update this ticket.
  2. Feon Sua Xin Miao 2016-03-22

    [~ssombhatla], I still get the same result, the 3rd row is blank, attached a screenshot of what I see after the simulator is loaded.
       SDK: 5.4.0.v20160322115854 
       iOS Simulator: iPhone 5
       iOS: 9.2
       Xcode: 7.2
       
  3. Srikanth Sombhatla 2016-03-24

    This is TI_USE_KROLL_THREAD issue. A quick work around is to set
    <run-on-main-thread>true</run-on-main-thread>
    under ios in tiapp.xml. I need to investigate for the fix.
  4. Srikanth Sombhatla 2016-03-24

    When TI_USE_KROLL_THREAD is enabled, the image is loaded before the events are added. So load event is not fired. This fix will listen to added events and then fire the load event. PR: https://github.com/appcelerator/titanium_mobile/pull/7879 Use the attached app.js. Test by changing values on
     <run-on-main-thread>true</run-on-main-thread> 
    under ios in tiapp.xml
  5. Josh Longton 2016-07-07

    Verified as fixed, the event is fired and the image is animated with run-on-main-thread set to true/false. Tested on:
 iPhone 5s (9.2) iOS Simulator (9.3) Android emulator (6.0) 
Mac OSX El Capitan 10.11.5 Studio: 4.7.0.201607070843 
Ti SDK: 5.4.0.v20160705213725 
Appc NPM: 4.2.8-1 Appc CLI: 5.4.0-26 
Xcode 7.3.1 Node v4.4.4 *
Closing Ticket*
  6. Hans Knöchel 2016-07-26

    Reopening. This fix produces a regression for all images in both standalone imageviews and embedded imageviews in lists/tables. The exact issue is [here](https://github.com/appcelerator/titanium_mobile/commit/a2ce6d1dfac7d75d73ad66656ffbe11200061db3#diff-bda46bd3120801c618c5afee61c97391R67), so we need to check what's going wrong there exactly Demo to reproduce:
       var win = Ti.UI.createWindow({
           backgroundColor: "#fff"
       });
       var img1 = Ti.UI.createImageView({
           image: "default_app_logo.png",
           imageActive: "/images/apple_logo.jpg",
           height: 50,
           top: 50,
       });
       var img2 = Ti.UI.createImageView({
           image: "",
           backgroundColor: "#ff0",
           width: 50,
           imageActive: "/images/apple_logo.jpg",
           height: 50,
           top: 125,
       });
       var img3 = Ti.UI.createImageView({
           image: "default_app_logo.png",
           imageActive: "/images/apple_logo.jpg",
           height: 50,
           top: 200
       });
       
       var lbl = Ti.UI.createLabel({
           bottom: 20
       });
       
       win.add(lbl);
       win.add(img1);
       win.add(img2);
       win.add(img3);
       
       function cl(e){
           lbl.text = "Before " +e.source.image;
           e.source.image = e.source.imageActive;
           console.log(e.source.image);
           lbl.text += " after " +e.source.image;
       }
       
       img1.addEventListener("click", cl);
       img2.addEventListener("click", cl);
       img3.addEventListener("click", cl);
       
       win.open();
       
    Expected behavior: The images change on click Actual behaior: The images do not change on click Thanks to [~michael] for reporting! *EDIT*: Diving deeper into that issue, I noticed that he overwrote a proxy delegate method which has bad impact on the whole proxy handling. So we may -revert this PR for 5.4.0 so the regression to the user-cases is fixed and try to- fix this issue differently.
  7. Hans Knöchel 2016-07-26

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/8158 PR (5_4_X): https://github.com/appcelerator/titanium_mobile/pull/8159 This needs be tested against both the original demo-code (list-view with images) as well as the regression demo in the comment above. For QE: Please also test this with the KitchenSink app and the "Employee Directory" app from Studio. [~bgrantges@appcelerator.com] reported a possible regression issue (TIMOB-23669) recently that is surely related to this one.
  8. Michael Gangolf 2016-07-27

    @hansknoechel 5_4_x patched worked fine with the provided demo. All images update on click with and without main-thread.
  9. Chee Kiat Ng 2016-07-27

    CR and FT passed. Approved!
  10. Harry Bryant 2016-08-03

    Verified as fixed. Tested both the original demo-code as well as the second test case above. Also verified TIMOB-23669 and closed. Tested On: iPhone 6S (9.3.3) Device Mac OSX El Capitan 10.11.6 Ti SDK: 5.4.0.v20160802165655 Appc Studio: 4.7.0.201607111053 Appc NPM: 4.2.7 App CLI: 5.4.0-37 Xcode 7.3 Node v4.4.7 *Closing ticket.*

JSON Source