| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,17 +81,13 @@ const loadModule = profile("loadModule", (moduleNamePath: string, entry: ViewEnt | |||
| 81 | 81 | const viewFromBuilder = profile("viewFromBuilder", (moduleNamePath: string, moduleExports: any): View => { | |
| 82 | 82 | // Possible XML file path. | |
| 83 | 83 | const fileName = resolveFileName(moduleNamePath, "xml"); | |
| 84 | - if (fileName) { | ||
| 85 | - // Or check if the file exists in the app modules and load the page from XML. | ||
| 86 | - return loadPage(moduleNamePath, fileName, moduleExports); | ||
| 87 | - } | ||
| 88 | 84 | ||
| 89 | 85 | // Attempts to implement https://github.com/NativeScript/NativeScript/issues/1311 | |
| 90 | 86 | // if (page && fileName === `${moduleNamePath}.port.xml` || fileName === `${moduleNamePath}.land.xml`){ | |
| 91 | 87 | // page["isBiOrientational"] = true; | |
| 92 | - // } | ||
| 88 | + // }; | ||
| 93 | 89 | ||
| 94 | - return null; | ||
| 90 | + return loadPage(moduleNamePath, fileName, moduleExports); | ||
| 95 | 91 | }) | |
| 96 | 92 | ||
| 97 | 93 | export const createViewFromEntry = profile("createViewFromEntry", (entry: ViewEntry): View => { | |
@@ -143,8 +139,13 @@ const moduleCreateView = profile("module.createView", (moduleNamePath: string, m | |||
| 143 | 139 | function loadInternal(fileName: string, context?: any, moduleNamePath?: string): ComponentModule { | |
| 144 | 140 | let componentModule: ComponentModule; | |
| 145 | 141 | ||
| 146 | - // Check if the XML file exists. | ||
| 147 | - if (File.exists(fileName)) { | ||
| 142 | + const appPath = knownFolders.currentApp().path; | ||
| 143 | + const filePathRelativeToApp = (moduleNamePath && moduleNamePath.startsWith(appPath) ? "./" + moduleNamePath.substr(appPath.length + 1) : moduleNamePath) + ".xml"; | ||
| 144 | + | ||
| 145 | + if (global.moduleExists(filePathRelativeToApp)) { | ||
| 146 | + var text = global.loadModule(filePathRelativeToApp); | ||
| 147 | + componentModule = parseInternal(text, context, fileName, moduleNamePath); | ||
| 148 | + } else if (fileName && File.exists(fileName)) { | ||
| 148 | 149 | const file = File.fromPath(fileName); | |
| 149 | 150 | const text = file.readTextSync((error) => { throw new Error("Error loading file " + fileName + " :" + error.message) }); | |
| 150 | 151 | componentModule = parseInternal(text, context, fileName, moduleNamePath); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments