mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix(dev-tools): use app root in getDocument() (#8071)
This commit is contained in:

committed by
Martin Yankov

parent
7fa997865b
commit
f68647233f
@ -4,6 +4,9 @@ import { getNodeById } from "./dom-node";
|
||||
import { ViewBase } from "../ui/core/view-base";
|
||||
import { mainThreadify } from "../utils/utils";
|
||||
|
||||
// Use lazy requires for core modules
|
||||
const getAppRootView = () => require("../application").getRootView();
|
||||
|
||||
let unsetValue;
|
||||
function unsetViewValue(view, name) {
|
||||
if (!unsetValue) {
|
||||
@ -24,19 +27,19 @@ function getViewById(nodeId: number): ViewBase {
|
||||
}
|
||||
|
||||
export function getDocument() {
|
||||
const topMostFrame = require("../ui/frame").Frame.topmost();
|
||||
if (!topMostFrame) {
|
||||
const appRoot = getAppRootView();
|
||||
if (!appRoot) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
topMostFrame.ensureDomNode();
|
||||
appRoot.ensureDomNode();
|
||||
|
||||
} catch (e) {
|
||||
console.log("ERROR in getDocument(): " + e);
|
||||
}
|
||||
|
||||
return topMostFrame.domNode.toObject();
|
||||
return appRoot.domNode.toObject();
|
||||
}
|
||||
|
||||
export function getComputedStylesForNode(nodeId): Array<{ name: string, value: string }> {
|
||||
|
Reference in New Issue
Block a user