nativescript-community / ui-drawer

NativeScript plugin that allows you to easily add a side drawer (side menu) to your projects.
https://nativescript-community.github.io/ui-drawer/
Apache License 2.0
24 stars 12 forks source link

does this support nativescript core (js, ts)? #13

Closed csaggo closed 1 year ago

csaggo commented 3 years ago

sorry this might be a stupid question, but i am only seeing examples for vue, angular, svelte but not the usual core demo.

trevortos commented 2 years ago

I too would like to see a JS demo.

farfromrefug commented 2 years ago

@csaggo @trevortos yes it should. Try to use it like any other component/plugin Namespace being @nativescript-community/ui-drawer. And the component name being drawer

keerl commented 2 years ago

If someone gets it working could you send me a link to the code? I could add a vanilla js/ts demo to the repo since it seems there is interest in that.

Whip commented 2 years ago

Seriously, do you despise vanilla js so much that you didn't even take its name in the readme? Vue and svelte people should understand a js demo but the opposite is not true.

farfromrefug commented 2 years ago

@Whip That is not a nice way to comment on an Open Source projet. Every contributor here work on this on its free time to help the community. If you really think vanilla is missing, why dont you contribute ? Makes me sad to see people like you...

Whip commented 2 years ago

I didn't mean to hurt your feelings. Unfortunately I can't contribute, I'm a web developer and I picked up Nativescript few years ago (around NS4) exactly because they claimed you wouldn't have to learn a new language to develop apps. So I feel bad when I see an important plugin from nativescript has no vanilla js support. I'm sorry.

Fabiyo-90 commented 2 years ago

farfromrefug, really we must apologize, far from our intention to cause you any harm. I am currently entering to test https://github.com/rigor789/nativescript-vue-next, and would like to load your plugin. It would have been easier if there was a way to do it via typescript or vanillaJs. Anyway, I think I need some help from you or some direction I can follow.

And thank you again for this work

farfromrefug commented 2 years ago

@Fabiyo-90 look at the vue index file. should show you how to do it

Fabiyo-90 commented 2 years ago

If I don't succeed, I will come back to you, I would like to become a contributor too

Fabiyo-90 commented 2 years ago

In my file main.ts `import { createApp, h, registerElement } from 'nativescript-vue'; import { createPinia } from 'pinia'; import { install as InstallUIDrawer } from '@nativescript-community/ui-drawer';

// Components import AppComponent from './components/App.vue';

// All init InstallUIDrawer();

// Register new elements registerElement('RootLayout', () => require('@nativescript/core').RootLayout, { NSVViewFlags: 4 / LAYOUT_VIEW / }); registerElement('Drawer', () => require('@nativescript-community/ui-drawer').Drawer, { component: require('@nativescript-community/ui-drawer/vue/component') });

const App = createApp({ render: () => h('frame', [h(AppComponent)]), });

App.use(createPinia());

App.start()`

And in my file App.vue `

` The result, I have nothing, what is not correct ?

ns_drawer
farfromrefug commented 2 years ago

@Fabiyo-90 you are using ref for mainContent which I don't think is what we want. we want ~mainContent

Fabiyo-90 commented 2 years ago

OK ! I'll try to see and test if this is supported in nativescript-vue-next... there isn't any supporting documentation yet so I'm trying quite a few things. I'll see what fits best for it

farfromrefug commented 2 years ago

@Fabiyo-90 I understand. wondering if there are N components which need ~ and thus that Igor would have implemented. (never looked at vue 3)

Fabiyo-90 commented 2 years ago

@farfromrefug The ~ is not working into nativescript-vue-next, I try to recreate the component, it's necessary replace the "~" with "ref", I'll try to see if it works correctly.

Also I wanna know about "NativeDrawer", there is a component of Nativescript like "Label" or "StackLayout", or I must register a new element ?

farfromrefug commented 2 years ago

@Fabiyo-90 you don't care about nativedrawer. it is a pattern we use in NVue. now don't think you ll be able to do it using ref. the thing is that main content needs to be passed to the drawer as a property. this is what ~ is for. did you ask Igor?

Fabiyo-90 commented 2 years ago

I wrote in the discord (https://discord.com/channels/603595811204366337/606457523574407178/989857337680494602) sending the link hoping he will see this. I understand why I had an error where "NativeDrawer" was not recognized, I was going to see how to easily integrate it by recreating a "Drawer" component

Fabiyo-90 commented 2 years ago

I wanted to try otherwise by wanting to integrate it but I'm blocked. There are a lot of things that are not yet supported with nativescript-vue-next, I wanted to work around that with nativescript-vue-next's own methods but hey, I haven't progressed. I believe an example with Vanilla would have been great so in some cases, users of frontend frameworks would have known how to integrate it themselves. I will continue to search in the meantime to learn the inner workings of the nativescript framework as well as its integration with vuejs 3