[ALOY-1325] Add PreviewContext element to XML views
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-11-12T18:22:38.000+0000 |
Affected Version/s | alloy 1.7.24 |
Fix Version/s | Release 5.2.0, alloy 1.7.25 |
Components | XML |
Labels | n/a |
Reporter | Fokke Zandbergen |
Assignee | Feon Sua Xin Miao |
Created | 2015-11-04T11:51:27.000+0000 |
Updated | 2016-02-02T22:47:55.000+0000 |
Description
Alloy should support the new
Ti.UI.iOS.createPreviewContext
.
* A PreviewContext can be added to most views via their previewContext
property.
* The PreviewContext itself has a preview
property which must be assigned a single View.
* The PreviewContext also has an actions
property for one or more actions or action groups.
<Alloy>
<View>
<PreviewContext onPeek="fn1" onPop="fn2" contentHeight="300">
<Preview>
<View>
<Label>Hello</Label>
</View>
</Preview>
</PreviewContext>
<View>
<ListView>
<PreviewContext onPeek="fn">
<Preview>
<View>
<Label>Hello</Label>
</View>
</Preview>
<Actions>
<Action title="Email" onClick="fn" />
<ActionGroup title="Delete">
<Action title="Confirm" onClick="fn" />
<Action title="Cancel" onClick="fn" />
</ActionGroup>
</Actions>
</PreviewContext>
<ListSection>
<ListItem title="Hello" />
</ListSection>
</ListView>
</Alloy>
How about something like this:
[~fmiao] The preview actions should be surrounded by
<Actions>
just like we do it with<ButtonNames>
etc. Overall, I would just suggest [~fokkezb]'s proposal.Sure, that's fine with me.
I also recommend wrapping the contextpreview preview view in a contentview or maybe better preview element. Just like the popover.
Semantically right would be the
<Preview>
tag to have parity with the API.I agree with [~hansknoechel], semantically it should be
Preview
. Although I would prefer to have less tags that don't correspond to a Ti.UI.* object.preview, actions
are after all properties ofTi.UI.iOS.PreviewContext
. [~fokkezb]'s initial proposal looks good to me,PR: https://github.com/appcelerator/alloy/pull/739 Test app: https://github.com/feons/alloy/tree/ALOY-1325-1/test/apps/testing/ALOY-1325
Found 2 more typos but with those fixed in my local version it works.
PR merged.
This has nothing to do with the SDK version but with Alloy. If you run from OSS CLI you need 1.7.25 of Alloy. If you run from AppC CLI then 5.1.0-63+ has the correct Alloy version.
Verified implemented, using: MacOS 10.11.3 (15D21) Studio 4.5.0.201601262138 Ti SDK 5.2.0.v20160202103508 Appc NPM 4.2.3-1 Appc CLI 5.2.0-239 Alloy 1.7.33 Xcode 7.2 (7C68) iPhone 6S PreviewContext element is now usable and behaves as expected. Tested using the app provided at: https://github.com/feons/alloy/tree/ALOY-1325-1/test/apps/testing/ALOY-1325, and simple modifications to the default sample app.