Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1325] Add PreviewContext element to XML views

GitHub Issuen/a
TypeNew Feature
Resolution Date2015-11-12T18:22:38.000+0000
Affected Version/salloy 1.7.24
Fix Version/sRelease 5.2.0, alloy 1.7.25
ReporterFokke Zandbergen
AssigneeFeon Sua Xin Miao


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.
		<PreviewContext onPeek="fn1" onPop="fn2" contentHeight="300">
		<PreviewContext onPeek="fn">
				<Action title="Email" onClick="fn" />
				<ActionGroup title="Delete">
					<Action title="Confirm" onClick="fn" />
					<Action title="Cancel" onClick="fn" />
			<ListItem title="Hello" />


  1. Feon Sua Xin Miao 2015-11-06

    How about something like this:
       				<PreviewAction title='Preview Action' style='Ti.UI.iOS.PREVIEW_ACTION_STYLE_DESTRUCTIVE'/>
       					<PreviewAction id='action1' />
       					<PreviewAction id='action2' />
       					<PreviewAction id='action3' />
  2. Hans Knöchel 2015-11-06

    [~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.
  3. Feon Sua Xin Miao 2015-11-06

    Sure, that's fine with me.
  4. Fokke Zandbergen 2015-11-06

    I also recommend wrapping the contextpreview preview view in a contentview or maybe better preview element. Just like the popover.
  5. Hans Knöchel 2015-11-06

    Semantically right would be the <Preview> tag to have parity with the API.
  6. Feon Sua Xin Miao 2015-11-06

    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 of Ti.UI.iOS.PreviewContext. [~fokkezb]'s initial proposal looks good to me,
  7. Feon Sua Xin Miao 2015-11-10

    PR: https://github.com/appcelerator/alloy/pull/739 Test app: https://github.com/feons/alloy/tree/ALOY-1325-1/test/apps/testing/ALOY-1325
  8. Fokke Zandbergen 2015-11-11

    Found 2 more typos but with those fixed in my local version it works.
  9. Feon Sua Xin Miao 2015-11-12

    PR merged.
  10. Fokke Zandbergen 2015-11-21

    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.
  11. Eric Wieber 2016-02-02

    Verified implemented, using: MacOS 10.11.3 (15D21) Studio 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.

JSON Source