/
Snackbar.yml
90 lines (77 loc) 路 2.18 KB
/
Snackbar.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
name: Titanium.UI.Android.Snackbar
summary: Snackbars provide brief messages about app processes at the bottom of the screen.
description: |
| Android |
| ------- |
| ![Android](./snackbar_android.png) |
For design guidelines, see
[Material design: Snackbars](https://material.io/components/snackbars)
since: "11.1.0"
platforms: [android]
methods:
- name: show
summary: Show the Snackbar
events:
- name: click
summary: Fired when the action button is clicked
properties:
- name: action
summary: The text of the action button.
type: String
properties:
- name: LENGTH_SHORT
summary: |
Use with `length` to specify the display time.
type: Number
permission: read-only
- name: LENGTH_LONG
summary: |
Use with `length` to specify the display time.
type: Number
permission: read-only
- name: LENGTH_INDEFINITE
summary: |
Use with `length` to specify the display time.
type: Number
permission: read-only
- name: length
summary: Display time of the Snackbar
description: |
Use with on of the constants: `Ti.UI.Android.Snackbar.LENGTH_SHORT`,
`Ti.UI.Android.Snackbar.LENGTH_LONG` or
`Ti.UI.Android.Snackbar.LENGTH_INDEFINITE`
type: Number
default: LENGTH_SHORT
since: "10.2.0"
- name: action
summary: Text of the right hand action button
type: String
since: "10.2.0"
- name: message
summary: Text of Snackbar
type: String
since: "10.2.0"
examples:
- title: Show a Snackbar
example: |
Display a Snackbar with an action button.
``` js
const win = Ti.UI.createWindow();
const btn = Ti.UI.createButton({
title: 'show message'
});
btn.addEventListener('click', function() {
snack.show();
});
const snack = Ti.UI.Android.createSnackbar({
message: 'Hello Snackbar!',
length: Ti.UI.Android.Snackbar.LENGTH_INDEFINITE,
action: 'click me'
});
snack.addEventListener('click', function(e) {
console.log(e.action);
});
win.add([btn, snack]);
win.open();
```