MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / actionsFor

Function actionsFor

packages/nativescript-inspector/src/index.ts:2158–2191  ·  view source on GitHub ↗
(target: any)

Source from the content-addressed store, hash-verified

2156}
2157
2158function actionsFor(target: any): string[] {
2159 const native = nativeTarget(target);
2160 const actions = new Set(["describe", "getProperties", "setProperty"]);
2161 if (
2162 isKindOf(native, "UIControl") ||
2163 Boolean(read(native, "isAccessibilityElement"))
2164 ) {
2165 actions.add("tap");
2166 }
2167 if (Boolean(read(native, "canBecomeFirstResponder"))) {
2168 actions.add("focus");
2169 }
2170 if (Boolean(read(native, "isFirstResponder"))) {
2171 actions.add("resignFirstResponder");
2172 }
2173 if (isKindOf(native, "UITextField") || isKindOf(native, "UITextView")) {
2174 actions.add("setText");
2175 }
2176 if (isKindOf(native, "UISwitch")) {
2177 actions.add("toggle");
2178 actions.add("setValue");
2179 }
2180 if (isKindOf(native, "UISlider") || isKindOf(native, "UISegmentedControl")) {
2181 actions.add("setValue");
2182 }
2183 if (isKindOf(native, "UIScrollView")) {
2184 actions.add("scrollBy");
2185 actions.add("scrollTo");
2186 }
2187 if (Boolean(read(native, "isAccessibilityElement"))) {
2188 actions.add("accessibilityActivate");
2189 }
2190 return [...actions].sort();
2191}
2192
2193function editablePropertiesFor(target: any): string[] {
2194 const properties = new Set(defaultEditableProperties);

Callers 5

listActionsMethod · 0.85
performMethod · 0.85
nativeScriptNodeMethod · 0.85
controlInfoFunction · 0.85

Calls 3

nativeTargetFunction · 0.85
isKindOfFunction · 0.85
readFunction · 0.85

Tested by

no test coverage detected