Skip to main content
Version: 7.3.0

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
import PageSampleDesign from "generated/pages/pageSample";
import { Route, Router } from "@smartface/router";
import Application from "@smartface/native/application";
import System from "@smartface/native/device/system";

//You should create new Page from UI-Editor and extend with it.
export default class Sample extends PageSampleDesign {
constructor(private router?: Router, private route?: Route) {
super({});
}

// The page design has been made from the code for better
// showcase purposes. As a best practice, remove this and
// use WYSIWYG editor to style your pages.
centerizeTheChildrenLayout() {
this.dispatch({
type: "updateUserStyle",
userStyle: {
flexProps: {
flexDirection: 'ROW',
justifyContent: 'CENTER',
alignItems: 'CENTER'
}
}
})
}

onShow() {
super.onShow();
const { headerBar } = this;
Application.statusBar.visible = false;
headerBar.visible = false;

}

onLoad() {
super.onLoad();
this.centerizeTheChildrenLayout();

System.setClipboard({ text: System.OS, android: { isSensitive: false } });
console.log(System.getClipboard());
}
}
caution

API Level 33 (Android 13) and above shows the clipboard contents on the screen when the clipboard has set or copied a text. We must use isSensitive parameter when copying sensitive information (password, credit card information, etc.) to the clipboard.