NativeScript / capacitor

NativeScript for Capacitor

Home Page:https://capacitor.nativescript.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cant import @nativescript/core/profiling

matadorhernan opened this issue · comments

esm5 issues when importing into dialog example

i tried to create a dialog with Profiling.time()

Reproduction steps
install in root and/or in nativescript tns-core-modules (i tried both)
replace the dialog code for the generated example in src/nativescript/examples/modal

import {
  iosRootViewController,
  androidCreateDialog,
} from '@nativescript/capacitor/bridge';
import { time } from 'tns-core-modules/profiling';
// import { time } from '@nativescript/core/profiling';
/**
 * Try calling from Ionic with:
 *
 * import { native } from '@nativescript/capacitor';
 * 
 *
 * native.openNativeModalView();
 *
 * Reference:
 * iOS: https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/index.html
 * Android: https://developer.android.com/reference/android/widget/LinearLayout
 */

native.openNativeModalView = () => {
  if (native.isAndroid) {
    androidCreateDialog(() => {
      const activity = native.androidCapacitorActivity;

      const layout = new android.widget.LinearLayout(activity);
      layout.setGravity(android.view.Gravity.CENTER);
      layout.setOrientation(android.widget.LinearLayout.VERTICAL);

      const btn = new android.widget.Button(activity);
      btn.setText('Ionic');
      layout.addView(btn);

      const btn1 = new android.widget.Button(activity);
      btn1.setText('Capacitor');
      layout.addView(btn1);

      return layout;
    });
  } else {
    const vc = UIViewController.alloc().init();
    vc.view.backgroundColor = UIColor.blueColor;
    const label = UILabel.alloc().initWithFrame(
      CGRectMake(0, 30, UIScreen.mainScreen.bounds.size.width, 50)
    );
    label.text = `Well this is fun. ${time()}`;
    label.textColor = UIColor.orangeColor;
    label.textAlignment = NSTextAlignment.Center;
    label.font = UIFont.systemFontOfSize(35);
    vc.view.addSubview(label);
    iosRootViewController().presentModalViewControllerAnimated(vc, true);
  }
};

Thank you @matadorhernan for report - will check this out this week as we’re also trying to get another update out for improved livesync with it.

Thank you @matadorhernan for report - will check this out this week as we’re also trying to get another update out for improved livesync with it.

any luck?

We're adding support for this in v2 at moment while also updating the engine to v8 which will clear the integration for arm64 arch (Mac M1). Targeting v2 release Q1 2022.

Resolved in v2+