Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to import plugin from https://market.nativescript.org/ #20

Closed
igorvujovic opened this issue Apr 12, 2019 · 4 comments
Closed

how to import plugin from https://market.nativescript.org/ #20

igorvujovic opened this issue Apr 12, 2019 · 4 comments

Comments

@igorvujovic
Copy link

Svelte + native rocks ... :)

Is there easy way to import UI plugin (MaskedTextField for example ) from https://market.nativescript.org/
and use it in svelte markup as component?

Thanks

@halfnelson
Copy link
Owner

Hi,
Yes there is a way to install plugins. Looks like I forgot to document it.

Install the plugin as normal

tns plugin install nativescript-masked-text-field

then you need to register the new field as a tag:

import { NativeElementNode, registerElement } from "svelte-native/dom"
import { MaskedTextField } from 'nativescript-masked-text-field'

registerElement('maskedTextField', () => new NativeElementNode('maskedTextField', MaskedTextField as any))

you can then use it in your components

 <maskedTextField class="input input-border" mask="(999) 999-9999" text="{maskedValue}"  keyboardType="phone"></maskedTextField>

@igorvujovic
Copy link
Author

Nice, thank you 👍

@igorvujovic
Copy link
Author

igorvujovic commented Apr 15, 2019

MaskedEdit works like a charm.
How can I import RadListView from https://docs.nativescript.org/ui/professional-ui-components/ListView/getting-started ?
I tried it with component like in listview example from https://svelte-native.technology/docs#template-component but with no success :(

<radListView items="{{ dataItems }}" >
	<Template let:item={i}>
	  <label text="{i}" />
	</Template>
</radListView>

@halfnelson
Copy link
Owner

Elements requiring templates are a bit harder. You need to create a custom element for it, and register that instead https://github.com/halfnelson/svelte-native-grocery/blob/master/app/RadListViewElement.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants