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

Function getViewByDomId

packages/core/ui/core/view-base/index.ts:166–190  ·  view source on GitHub ↗
(view: ViewBase, domId: number)

Source from the content-addressed store, hash-verified

164 * Returns an instance of a view (if found), otherwise undefined.
165 */
166export function getViewByDomId(view: ViewBase, domId: number): ViewBase {
167 if (!view) {
168 return undefined;
169 }
170
171 if (view._domId === domId) {
172 return view;
173 }
174
175 let retVal: ViewBase;
176 const descendantsCallback = function (child: ViewBase): boolean {
177 if (view._domId === domId) {
178 retVal = child;
179
180 // break the iteration by returning false
181 return false;
182 }
183
184 return true;
185 };
186
187 eachDescendant(view, descendantsCallback);
188
189 return retVal;
190}
191
192// TODO: allow all selector types (just using attributes now)
193/**

Callers

nothing calls this directly

Calls 1

eachDescendantFunction · 0.85

Tested by

no test coverage detected