nativescript-ui-sidedrawer - 无法启动 Activity ComponentInfob 调用 js 方法 onCreate 失败

问题描述 投票:0回答:1

我做错了什么?这是我的顶级 html:

<RadSideDrawer>
  <Button ... ></Button>
    <StackLayout MainContent>
    <page-router-outlet></page-router-outlet>
  </StackLayout>

我已将此模块添加到 app.module.ts

...
import { NativeScriptUISideDrawerModule } from 'nativescript-ui-sidedrawer/angular'
@NgModule({
  imports: [
     NativeScriptUISideDrawerModule,

...

并在 app.component.ts 上实现 3 种与驱动程序一起使用的方法

...
import { RadSideDrawerComponent } from "nativescript-ui-sidedrawer/angular";
import { RadSideDrawer } from "nativescript-ui-sidedrawer";

export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
    @ViewChild(RadSideDrawerComponent) drawerComponent: RadSideDrawerComponent;
    private drawerSub: Subscription;
    private drawer: RadSideDrawer;

    constructor(
      private uiService: UIService,
      private changeDetectionRef: ChangeDetectorRef,
      private vcRef: ViewContainerRef
    ) {}
...

所有软件版本都是当前最新的。但是我收到错误:

 Project successfully built.
 Build time: 23.937 s.
 The build result is located at: ...\platforms\android\app\build\outputs\apk\debug\app-debug.apk
 Installing on device emulator-5554...
 Successfully installed on device with identifier 'emulator-5554'.
 Restarting application on device emulator-5554...
 ...
 AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.MyX/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
 AndroidRuntime: TypeError: Cannot read properties of undefined (reading 'nativeView')
 ...
 System.err: An uncaught Exception occurred on "main" thread.
 System.err: Unable to start activity ComponentInfo{org.nativescript.MyX/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
 System.err: TypeError: Cannot read properties of undefined (reading 'nativeView')
android angular nativescript-angular nativescript-plugin
1个回答
0
投票

我发现了另一个抽屉https://github.com/nativescript-community/ui-drawer 并且工作正常

© www.soinside.com 2019 - 2024. All rights reserved.