Clipboard
API Reference: Device.System
Clipboard is used to send a text to the clipboard of the device or get a text from the clipboard.
TypeScript
1
import PageSampleDesign from 'generated/pages/pageSample';
2
import FlexLayout from '@smartface/native/ui/flexlayout';
3
import Application from '@smartface/native/application';
4
import System from '@smartface/native/device/system';
5
6
7
//You should create new Page from UI-Editor and extend with it.
8
export default class Sample extends PageSampleDesign {
9
10
constructor() {
11
super();
12
// Overrides super.onShow method
13
this.onShow = onShow.bind(this, this.onShow.bind(this));
14
// Overrides super.onLoad method
15
this.onLoad = onLoad.bind(this, this.onLoad.bind(this));
16
17
this.layout.flexDirection = FlexLayout.FlexDirection.COLUMN;
18
this.layout.justifyContent = FlexLayout.JustifyContent.CENTER;
19
this.layout.alignItems = FlexLayout.AlignItems.CENTER;
20
}
21
}
22
23
/**
24
* @event onShow
25
* This event is called when a page appears on the screen (everytime).
26
* @param {function} superOnShow super onShow function
27
* @param {Object} parameters passed from Router.go function
28
*/
29
function onShow(superOnShow: () => void) {
30
const { headerBar } = this;
31
superOnShow();
32
Application.statusBar.visible = false;
33
headerBar.visible = false;
34
}
35
36
/**
37
* @event onLoad
38
* This event is called once when page is created.
39
* @param {function} superOnLoad super onLoad function
40
*/
41
function onLoad(superOnLoad: () => void) {
42
superOnLoad();
43
44
System.clipboard = System.OS;
45
console.log(System.clipboard);
46
}
47
Copied!
Last modified 2mo ago
Copy link