MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / getViewById

Function getViewById

packages/core/ui/core/view-base/index.ts:134–158  ·  view source on GitHub ↗
(view: ViewBase, id: string)

Source from the content-addressed store, hash-verified

132 * Returns an instance of a view (if found), otherwise undefined.
133 */
134export function getViewById(view: ViewBase, id: string): ViewBase {
135 if (!view) {
136 return undefined;
137 }
138
139 if (view.id === id) {
140 return view;
141 }
142
143 let retVal: ViewBase;
144 const descendantsCallback = function (child: ViewBase): boolean {
145 if (child.id === id) {
146 retVal = child;
147
148 // break the iteration by returning false
149 return false;
150 }
151
152 return true;
153 };
154
155 eachDescendant(view, descendantsCallback);
156
157 return retVal;
158}
159
160/**
161 * Gets a child view by domId.

Callers 9

getChildByIdMethod · 0.90
testFunction · 0.90
onLoadedFunction · 0.90
easeAnimateFunction · 0.90
theFinalFrontierFunction · 0.90
easeAnimateFunction · 0.90
theFinalFrontierFunction · 0.90
pageLoadedFunction · 0.90
setBtnTextFunction · 0.90

Calls 1

eachDescendantFunction · 0.85

Tested by 1

testFunction · 0.72