Video or image attachment
| Name |
Description |
| component |
media |
| src |
url of the media (image of video) |
| attachmentId |
the dispatch attachment id (optional) |
| kind |
type of media (optional), image, video, audio, if not defined, will try to determine from the url |
| autoplay |
true/false value that would indicate if video is auto play |
| usePlaceHolder |
true/false |
| action |
action to perform when user tap/click on the button, this can be text such as close and platform will implement the action or an action object. Some valid actions are createDispatch, dispatch, etc, with each action provided proper params |
| child |
optional child that is added into the frame as a Positioned object |
| options |
if child is provided optional top, left, right, bottom positions |
| optimizeSize |
true/false - if true will use image caching and resize based on the device |
| fadeIn |
optional fade in duration in milliseconds, if not provided images will not fade |
Actions
| Name |
Description |
| close |
close the current screen |
| object |
if object is a json object that has target attribute, will invoke the target (see Actions targets below) |
Action targets
| Name |
Description |
| invokeScript |
invoke a script with options as jsonParams |
| moveToBucket |
Move item from one bucket to another, required fromBucketHandle and toBucketHandle in the options attribute |
styles.image
| Name |
Description |
| clipRadius |
double, radius of clipped container |
| alignment |
centerLeft, centerRight, etc, see alignment property of styles |
| fit |
contain, cover, fill, fitWidth, fitHeight, none, scaleDown |
| width |
width of container |
| height |
height of container |
| minHeight |
min height, usually this should be provided when height is defined |
| maxHeight |
max height, usually this should be provided when height is defined |
| backgroundOpacity |
background opacity of the image |
| backgroundColor |
background color for the image |
See BoxFit for more information about fit.
Examples
{
"component": "media",
"kind": "image",
"src": "{data.image}",
"styles": {
"image": {
"fit": "contain",
"alignment": "centerLeft",
"height": 35,
"minHeight": 35,
"maxHeight": 35,
"width": 60
}
}
}
{
"component": "media",
"src": "{dispatch.firstAttachmentUrl}",
"kind": "image",
"styles": {
"root": {
"width": "33vw",
"height": "33vw",
"padding": "2px"
},
"image": {
"fit": "cover",
"alignment": "center",
"width": "33vw",
"height": "33vw",
"clipRadius": "0"
}
},
"action": {
"target": "viewDispatch",
"options": {
"id": "{dispatch.id}"
}
}
}
Notes
- Should support attachment id