Titanium JIRA Archive
Alloy (ALOY)

[ALOY-485] Collection binding on views for iOS incorrectly repopulating UI

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-10-24T19:28:00.000+0000
Affected Version/sAlloy 1.0.0
Fix Version/sAlloy 1.3.0, 2013 Sprint 22
ComponentsRuntime
Labelsios
ReporterTony Lukasavage
AssigneeTony Lukasavage
Created2013-01-23T22:19:54.000+0000
Updated2013-12-10T00:03:12.000+0000

Description

problem

This issue is covered in detail in the related and dependent linked tickets. In brief, iOS remove() calls (used in collection binding for views) are performed asynchronously. If you are doing a "remove all" in a loop, this unfortunately means that operations that are performed after those remove() calls may actually be performed before the remove() is complete. This will cause some weird behavior if you are attempting to add views to the view hierarchy directly after the "remove all", which collection binding for views does.

impact

Any Titanium views that use the typical add()/remove() functions to establish parent/child relationships in the UI will behave unreliably on iOS until TIMOB-12399 is resolved. For the sake of clarity, here is a brief listing of views that would and would not work. The list is not comprehensive, but a few examples should make it more readily apparent exactly what this issue impacts: * Will work ** Ti.UI.ScrollableView, as it uses *views* to establish its view hierarchy ** Ti.UI.TableView, as it uses *data* to establish its rows ** Ti.UI.ListView (in Alloy 1.2.0) as it uses *sections* to establish its sections ** Other UI components with special APIs for managing views (Buttonbar, TabbedBar) * Will not work (as it uses add()/remove()) ** Ti.UI.View ** Ti.UI.ScrollView ** Ti.UI.Window ** Essentially any UI component that does not have a special API for managing views contained within it

notes

Even after this ticket is resolved, TiSDK 3.2.0 or greater will be required for this to work in Alloy.

Comments

  1. Fokke Zandbergen 2013-07-27

    As a (manual) workaround I populate a new "wrapper" Ti.UI.View, remove the previous wapper and then add the new one to the Ti.UI.View I need to populate.
  2. Tony Lukasavage 2013-10-24

    Resolved as a result TIMOB-12399. TiSDK should be pulled from master, must be at least as recent as this commit: https://github.com/appcelerator/titanium_mobile/commit/affad6c1b077db76c795a91f861fa0a45c7c6af6 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/models/journal Functional testing should be performed on an iOS sim/device.

    Run the app on iOS

    Repeatedly add entries to the journal. Make sure to do around 10 to be sure.

    Ensure that each time a journal entry is added that they are sorted in the right order, with the most recent journal entry at the top, the oldest at the bottom. Before the above version of the TiSDK, the order of the journal entries was not guaranteed and was often out of order.

  3. Federico Casali 2013-12-10

    Verified fixed. TiSDK 3.2.0.v20131209000852 CLI 3.2.0-beta Alloy 1.3.0-beta Titanium Studio 3.2.0.201312081251 iOS simulator iPad Mini iOS 7 iPad Mini iOS 6 Nexus Galaxy 4.3 Closing

JSON Source