[ALOY-1221] Support Widgets and Require in ListItem Templates
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Critical |
Status | Resolved |
Resolution | Duplicate |
Resolution Date | 2018-06-27T08:18:16.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Tooling, Widgets, XML |
Labels | TCSupportTriage |
Reporter | Manuel Lehner |
Assignee | Tim Poulsen |
Created | 2014-08-26T12:52:27.000+0000 |
Updated | 2019-05-02T19:34:42.000+0000 |
I think this ticket should also be expanded to include the Module element inside the template as well, e.g.
Using SDK 3.4.1.GA and Alloy 1.5.1 on iOS I am not getting any compile or runtime errors, but the module proxy (e.g. createPaintView in the example above) is just not getting called. I'm trying to create a Facebook Like button per list item - to no avail :(
Is this issue due to Alloy or the ListView implementation in the SDK? And why is this still a Titanium Community issue since August?
There's a mix of limitations going on here. * The Alloy compiler doesn't currently support using widgets and require in templates. See ALOY-1220 and read through Tony's comments on ALOY-611 (which led to the creation of this ticket). * The SDK supports just a limited set of View proxies as children of ListItem, see the list at http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ListItem I'm pretty sure there's a TIMOB ticket directly related to using modules (that expose view proxies) as children of listitems. But the best I can find at the moment is TIMOB-15091 I've moved this ticket to the Alloy project but I can't make commitments on when we'll get a chance to work on it considering our other priorities on the Tooling team.
[~skypanther] please change the title to "Support Widgets, Require, and Module in...." Thanks
Here is an example of requested functionality: In my [Facebook module](https://github.com/mokesmokes/titanium-ios-facebook) I am exposing a View proxy for the Like Button. I want a Like button per ListItem, e.g.
Then in the controller code (and perhaps binding with the collection of teams) I want to set the Like Button's objectId (a property on the like) to "https://www.facebook.com/NYKnicks" and enable the user to like one of the NBA teams in the list. Currently this doesn't work - fb.createLikeButton() is not called, no support in the SDK and Alloy.
The challenge is that your
<Module..
would need to be aware of it's context (an ItemTemplate) and then instead of generatingrequire("com.facebook").createLikeButton({..})
return something like:And then the ListView API needs to know how to construct the actual view for each ListItem by parsing the
type
property on the native-side. But if the module is a CommonJS module this wouldn't work because the native-side can't ask the module for the view.[~fokke] perhaps I'm missing the conceptual difference between Ti.UI and require("com.facebook"). The view components are View Proxy and View in all cases. What's the big difference regarding the module? If one would need to add code to the module to make it compatible with item templates - so be it. This requirement should then be added to the module API.... But at this point this is entirely unclear/undocumented. Thanks :)
The ListView would need to know if the required module is a native module (in which case it should indeed be able to get the view) or a commonjs module - in which case it would almost certainly not.
Let's assume only compiled, native modules such as Facebook.
@fokke Why, in a case of CommonJS module, wouldn't work?
[~kopiro] because the views are composed on the native side. So then it would reach back to the JS VM and get the CommonJS module to do it there. Prone for errors if not impossible at all.
+1 for this feature request. Really desire for this!!! I would have open this JIRA if this one not here!
Any update on this?
Fixed as part of ALOY-1518 and related tickets for SDK 7.4.0.
This is only partly fixed, Require tags are still unsupported
Can we get this reopened? We also need to use Require inside an ItemTemplate for reuse.