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

Function setNativeValue

apps/automated/src/ui/switch/switch-tests.ts:148–158  ·  view source on GitHub ↗
(mySwitch: Switch, value: boolean)

Source from the content-addressed store, hash-verified

146}
147
148function setNativeValue(mySwitch: Switch, value: boolean) {
149 if (__ANDROID__) {
150 const nativeView: android.widget.Switch = mySwitch.nativeViewProtected;
151 nativeView.setChecked(value);
152 } else if (mySwitch.ios) {
153 mySwitch.ios.on = value;
154
155 // setting value trough code does not send notification, so simulate that manually.
156 mySwitch.ios.sendActionsForControlEvents(UIControlEvents.ValueChanged);
157 }
158}

Callers 1

testActionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected