Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are your experiences with NativeScript?

Does anyone have experience with NativeScript and can compare it to developing native apps, especially for Android?

I have read all these articles:

  • FIRST THOUGHTS ON NATIVESCRIPT
  • SECOND THOUGHTS ON NATIVESCRIPT
  • Introduction to Native Script – Is It Worth Your Time?
  • My Experience Developing with Telerik NativeScript

I know especially three of them may be outdated. But I want to ask all of you developers:

  1. How is your experience with NativeScript?
  2. Are there any Android-Components you cannot use? Which are these ones?
  3. Is styling really so limited?
  4. Do apps really look so different at runtime as in the mockup as in the pictures of the first article referenced above?
  5. Does loading of native Android objects into JavaScript Code always work correctly?
  6. Does NativeScript generate Java-Code for Android-Platform out of the NativeScript code I write?
  7. Is it possible to modifiy this code if I want to use some native-only features? What if I want to make UI changes then? Do I have to regenerate the code and do I miss my native extensions then?
like image 245
unlimited101 Avatar asked Dec 18 '22 11:12

unlimited101


2 Answers

Very glad to see that you are evaluating NativeScript to eventually use it in present and future projects. I'll try to condense answers to a few of the questions into one, as they really are mostly related.

  1. Skipped.*
  2. That depends on what has already been exposed through a custom view/plugin or module. The core-modules that every NativeScript app comes with contains the most basic of wrappers for both Android and iOS under a common API. There are plugins (nativescript npm modules) that provide additional wrappers on native android views (nativescript-telerik-ui for one, nativescript-carousel), most of which are created by the NS community.
  3. As RexSplode mentioned before me - it's mostly the platform that imposes certain limitations. NS uses CSS to declare style, but you can also access the native components and manage their style and appearance programatically if what you need isn't readily available out of the box.
  4. First I'd like to note that the first 3 articles you've linked are over a year old now, and trust me, NativeScript has evolved a lot since then. With all the available components (remember the npm modules I mentioned earlier?) there's a good chance that you will get a close to 1:1 similarity to a well-styled native Android mockup.
  5. At build time metadata is generated for the Android/Java public API used in the project. When the JavaScript Engine (V8) fires up, that metadata is loaded into memory, prototype chains are constructed, and callbacks are attached, so that when you call new android.widget.Button(); in your JavaScript code, the proper virtual machine instructions will be called, and a native button will be created. Static methods are accessed similarly, check out the official docs to get a better understanding of how it all works.https://docs.nativescript.org/runtimes/android/advanced-topics/execution-flow
  6. and 7., and a cont. of 2. Java code, or rather compiled Java code is generated whenever you wish to extend a native Android class that isn't available already in a module or in the native Framework. Extending classes is very similar to how you would do it in Java - you extend a class, and create new implementations of interfaces. That means that you won't have to open Android Studio to create a new class, build it into a native plugin and then add it to your project, since you can do it all in your NativeScript code using JavaScript/TypeScript. https://docs.nativescript.org/runtimes/android/generator/extend-class-interface

Disclaimer: I am on the NativeScript Engineering team

like image 142
pkanev Avatar answered Dec 28 '22 06:12

pkanev


I investigated the Native Script a little and my colleague at work writes an app with it, so I can offer you a bit of information that I have. 1. skipped

  1. There are limited amount of components you can use with native script out of the box. However, if you have a native-java developer who can write a wrapper for you - you can use everything.
  2. It is limited to the platform you are using. Android itself has a lot of style limitations which cannot be easily overwhelmed.
  3. don't know
  4. It works a little different. Your JS object, or rather widgets are translated to java code. So with the items from the box - yes, they are okey. If you write a wrapper for your custom component, then all is up to you.
  5. Yes it does.
  6. No, the code is generated, how are you going to modify it? Changes will be undone on the next build. However, you can write a native module for your application and use any features you want. It is like defining an interface, which you can use in JS code afterwards.
like image 41
RexSplode Avatar answered Dec 28 '22 06:12

RexSplode