Error creating custom component with Telerik RadSideDrawer


#1

I’m using Telerik RadSideDrawer in a Typescript project. I already built the menu, and it works fine. Now I want to make it a custom component, so I don’t duplicate xml in all my views.
But I get
> Building UI from XML. @file:///app/common/side-menu/sidemenu.xml:1:1 > undefined is not an object (evaluating 'parent.exports')
when I try to run the app.
I’m guessing it’s a different approach when making custom components from custom components. :slight_smile:

my codes:
common/side-menu/sidemenu.xml:

<dpg:DrawerPage.sideDrawer> <drawer:RadSideDrawer id="sideDrawer"> <drawer:RadSideDrawer.drawerContent> <!--some content here--> </drawer:RadSideDrawer.drawerContent> </drawer:RadSideDrawer> </dpg:DrawerPage.sideDrawer>

home.xml:

`<dpg:DrawerPage id="homePage"
xmlns=“http://schemas.nativescript.org/tns.xsd” navigatingTo="navigatingTo"
xmlns:dpg="nativescript-telerik-ui/sidedrawer/drawerpage"
xmlns:drawer="nativescript-telerik-ui/sidedrawer"
xmlns:sideMenu=“common/side-menu”>
<sideMenu:sidemenu />

</dpg:DrawerPage>
`


#2

Hi,

I also ran into this. :pensive:

You shouldn’t get this error message, when you just put the drawer-content in your sidemenu.xml and not the whole drawer.
That means you need to include the following to your home.xml (and every other page where you want to use the SideDrawer):

<dpg:DrawerPage.sideDrawer>
    <drawer:RadSideDrawer id="sideDrawer">
        <drawer:RadSideDrawer.drawerContent>
            <sidemenu:sidemenu/>
        </drawer:RadSideDrawer.drawerContent>
    </drawer:RadSideDrawer>
</dpg:DrawerPage.sideDrawer>

I also would prefer just to include the SideDrawer with <sidemenu:sidemenu/> and not this code block, but I couln’t find a solution yet.

Regards,
Felix


#3

I was afraid it’ll come to this. :slight_smile: Anyway, I’ll use this solution pending when someone suggests something different. Thanks a lot Felix.