MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / toggle

Function toggle

apps/ui/src/issues/issue-3714-page.ts:6–18  ·  view source on GitHub ↗
(args: EventData)

Source from the content-addressed store, hash-verified

4import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
5
6export function toggle(args: EventData) {
7 const page = <Page>(<any>args.object).page;
8
9 const getElementById = (id) => page.getViewById(id);
10
11 const toggleBtn = <Button>getElementById('toggleUserInteraction');
12 const isEnabled = toggleBtn.text === 'disable' ? true : false;
13 toggleBtn.text = !isEnabled ? 'disable' : 'enable';
14
15 (<Button>getElementById('testBtn')).isUserInteractionEnabled = !isEnabled;
16 (<Button>getElementById('testLabel')).isUserInteractionEnabled = !isEnabled;
17 (<StackLayout>getElementById('testStackLayout')).isUserInteractionEnabled = !isEnabled;
18}
19
20export function test() {
21 console.log('onTap');

Callers

nothing calls this directly

Calls 1

getElementByIdFunction · 0.85

Tested by

no test coverage detected