nativescript-angular icon indicating copy to clipboard operation
nativescript-angular copied to clipboard

RadSideDrawer integration

Open NathanWalker opened this issue 10 years ago • 32 comments

Anyone succeeded in integrating RadSideDrawer with nativescript-angular, (I’ve tried everything here in terms of general setup: https://github.com/tjvantoll/nativescript-template-drawer)… just doesn’t display anything.

component:

import {Component} from 'angular2/core';
import {registerElement} from 'nativescript-angular/element-registry';

registerElement('Drawer', () => require('nativescript-telerik-ui/sidedrawer'));

@Component({
  selector: 'app',
  templateUrl: './app.component.html'
})
export class AppComponent {}

app.component.html:

<Drawer:RadSideDrawer>
  <Drawer:RadSideDrawer.mainContent>
    <StackLayout>
      <Label text="Test"></Label>
    </StackLayout>
  </Drawer:RadSideDrawer.mainContent>
  <Drawer:RadSideDrawer.drawerContent>
    <StackLayout class="container">
      <Label text="Drawer Test"></Label>
    </StackLayout>
  </Drawer:RadSideDrawer.drawerContent>
</Drawer:RadSideDrawer>

No errors in console at all. App launches just fine. (no exceptions. nothing. normal log) Displays absolutely nothing. Just a white screen app. Very puzzling.

NathanWalker avatar Feb 26 '16 21:02 NathanWalker

@srnaik You can accomplish what you want to do by using a container element instead of a label element, you can use a StackLayout for example, create the "Primary" label inside the StackLayout and then add the other two labels, if you want to make them look different you can create a style (CSS class) for the "Primary" label and then another style for the "nested" labels by applying a margin-right (as example).

viniciodeltoro avatar Jan 22 '17 06:01 viniciodeltoro

Thanks @viniciodeltoro , that was helpful !

srnaik avatar Jan 23 '17 23:01 srnaik

Hi @viniciodeltoro,

I have another question related to wrapping the long text in the Label field. I am trying to wrap a long text in the side-drawer, but it is getting truncated, I tried using style = "word-wrap: break-word;width:125px" css property for label, but even then I am not able to wrap the text to the next line.

Please let me know your thoughts on wrapping the text in sidedrawer

srnaik avatar Apr 21 '17 17:04 srnaik

Hi @srnaik. You have to use the 'textWrap' property in the label, I believe it doesn't work if you try to add it in your CSS class. Your label code will be something like this.

<Label text="This is a very very very long text" textWrap="true"></Label>

viniciodeltoro avatar Apr 21 '17 18:04 viniciodeltoro

Thank you @viniciodeltoro , That worked :-)

srnaik avatar Apr 21 '17 19:04 srnaik

I'm also having the same issue as @sarvagayatri using "zone.js": "~0.8.2", any way to resolve this?

chrillewoodz avatar Apr 22 '17 08:04 chrillewoodz

@chrillewoodz Our NativeScript UI sdk examples are currently using the ^0.6.21 version of zonejs without any issues, you can check out all of the package.json dependencies here. Is there a particular reason for using the ~0.8.2 version over ^0.6.21 in your project?

VladimirAmiorkov avatar Apr 22 '17 08:04 VladimirAmiorkov

@VladimirAmiorkov That's what the cli created. Seems odd that after 6 months the bug still remains in zonejs..

chrillewoodz avatar Apr 22 '17 08:04 chrillewoodz

@chrillewoodz You can track the status of the zonejs issue here. Could you share with me which version of NativeScript (tns --version) are you using?

VladimirAmiorkov avatar Apr 22 '17 08:04 VladimirAmiorkov

@VladimirAmiorkov I'm using 2.5.3.

chrillewoodz avatar Apr 22 '17 08:04 chrillewoodz

Im getting this error TypeError: Cannot read property 'sideDrawer' of undefined JS: at ItemsComponent.ngAfterViewInit (file:///data/data/org.nativescript.MyAppTest/files/app/item/items.component.js:34:43) JS: at callProviderLifecycles (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/core/bundles/core.umd.js:11110:18) JS: at callElementProvidersLifecycles (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/core/bundles/core.umd.js:11085:13) JS: at callLifecycleHooksChildrenFirst (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/core/bundles/core.umd.js:11069:17) JS: at checkAndUpdateView (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/core/bundles/core.umd.js:12087:5) JS: at callWithDebugContext (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/core/bundles/core.umd.js:13067:42) JS: at Object.debugCheckAndUpdateView [as checkAndUpdateView] (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/core/bundles/core.umd.js:12607:12) JS: at ViewRef_.detectChanges (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/core/bundles/core.umd.js:10177:63) JS: at PageRouterOutlet.activateOnGoForward (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/nativescript-angular/router/page-router-outlet.js:150:57) JS: at PageRouterOutlet.activateWith (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/nativescript-angular/router/page-router-outlet.js:139:18) JS: at ActivateRoutes.placeComponentIntoOutlet (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/router/bundles/router.umd.js:4584:16) JS: at ActivateRoutes.activateRoutes (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/router/bundles/router.umd.js:4565:26) JS: at file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/router/bundles/router.umd.js:4501:58 JS: at Array.forEach (native) JS: at ActivateRoutes.activateChildRoutes (file:///data/data/org.nativescript.MyAppTest/files/app/tns_modules/@angular/router/bundles/router.umd.js:4501:29)

any idea? thanks

brunohenriquesk1 avatar May 17 '17 12:05 brunohenriquesk1

I have tested this and it works fine with this in package.json:

'@angular/animations': '~4.1.0',
'@angular/common': '~4.1.0',
'@angular/compiler': '~4.1.0',
'@angular/core': '~4.1.0',
'@angular/forms': '~4.1.0',
'@angular/http': '~4.1.0',
'@angular/platform-browser': '~4.1.0',
'@angular/router': '~4.1.0',
'nativescript-angular': '~3.0.0',
'nativescript-ng2-fonticon': '^1.3.4',
'nativescript-telerik-ui': '^2.0.1',
'nativescript-theme-core': '~1.0.2',
'reflect-metadata': '~0.1.8',
'rxjs': '~5.3.0',
'tns-core-modules': '~3.0.0',
'zone.js': '~0.8.2',
'email-validator': '^1.0.7',
'nativescript-iqkeyboardmanager': '1.0.1',
'nativescript-social-share': '~1.3.2',
'nativescript-unit-test-runner': '^0.3.3'

But when I set this versions...

'@angular/animations': '~4.2.3',
'@angular/common': '~4.2.3',
'@angular/compiler': '~4.2.3',
'@angular/core': '~4.2.3',
'@angular/forms': '~4.2.3',
'@angular/http': '~4.2.3',
'@angular/platform-browser': '~4.2.3',
'@angular/router': '~4.2.3',
'nativescript-angular': 'next',
'nativescript-ng2-fonticon': '^1.3.4',
'nativescript-telerik-ui': '^2.0.1',
'nativescript-theme-core': '^1.0.4',
'reflect-metadata': '^0.1.8',
'rxjs': '^5.4.0',
'tns-core-modules': 'next',
'zone.js': '^0.8.11',
'email-validator': '^1.0.7',
'nativescript-iqkeyboardmanager': '1.0.1',
'nativescript-social-share': '~1.3.2',
'nativescript-unit-test-runner': '^0.3.3'

It doesn't show the drawer. Thanks

ecopenhex avatar Aug 18 '17 12:08 ecopenhex