How to use the svelte-native/dom.SvelteKeyedTemplate function in svelte-native

To help you get started, we’ve selected a few svelte-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github halfnelson / svelte-native-nativescript-ui / src / listview / index.ts View on Github external
onInsertedChild(childNode: ViewNode, index: number) {
        super.onInsertedChild(childNode, index);
        if (childNode instanceof TemplateElement) {
            let type = childNode.getAttribute('type') || ListViewViewType.ItemView
            if (type.toLowerCase() != ListViewViewType.ItemView.toLowerCase()) return;

            let key = childNode.getAttribute('key') || "default"
            logger.debug(`Adding template for key ${key}`);
            if (!this.nativeView.itemTemplates || typeof this.nativeView.itemTemplates == "string") {
                this.nativeView.itemTemplates = []
            }
            this.nativeView.itemTemplates = this.nativeView.itemTemplates.concat(new SvelteKeyedTemplate(key, childNode))
        }
    }