Function
setNativeValue
(mySwitch: Switch, value: boolean)
Source from the content-addressed store, hash-verified
| 146 | } |
| 147 | |
| 148 | function 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 | } |
Tested by
no test coverage detected