Move styleScope from Page to View

Fix image-source test for API 27
setupAsRootView now makes the component styleScope
set css, addCss & addCssFile makes view to be styleScopeHost which cannot be overriden later from parent
Android modals now call setupAsRootView
Small fixes on ios layouts
launch event fired in andriod too
Moved some requestLayout calls to ios files where they belongs
This commit is contained in:
Hristo Hristov
2017-12-19 16:35:15 +02:00
parent 63ab46eb2a
commit 058a216ac9
19 changed files with 185 additions and 268 deletions

View File

@@ -174,13 +174,16 @@ const applyComponentAttributes = profile("applyComponentAttributes", (instance:
}
});
export function getComponentModule(elementName: string, namespace: string, attributes: Object, moduleExports: Object, moduleNamePath?: string): ComponentModule {
export function getComponentModule(elementName: string, namespace: string, attributes: Object, moduleExports: Object, moduleNamePath?: string, isRootComponent?: boolean): ComponentModule {
// Support lower-case-dashed component declaration in the XML (https://github.com/NativeScript/NativeScript/issues/309).
elementName = elementName.split("-").map(s => { return s[0].toUpperCase() + s.substring(1) }).join("");
const { instance, instanceModule } = createComponentInstance(elementName, namespace);
moduleExports = getComponentModuleExports(instance, moduleExports, attributes);
applyComponentCss(instance, moduleNamePath, attributes);
if (isRootComponent) {
applyComponentCss(instance, moduleNamePath, attributes);
}
applyComponentAttributes(instance, instanceModule, moduleExports, attributes);
var componentModule;