NativeScript 6.20 has several fixes, and finally added the long awaited Scoped packages. UPDATE Scoped packages apparently breaks some things. See here for more info on how to deal with it.
Scoped packages; are where you can now do
const label = require("@nativescript/core/ui/label"
rather than the older const label = require("tns-core-modules/ui/label");
This makes things a lot cleaner and over time more times should end up in the @nativescript namespace. Currently in the @nativescript
namespace is:
- Core Modules
- Theme
- Angular
Core Modules
Since they added the ns-root
, ns-landscape
, ns-phone
, etc; in the prior version of NativeScript they have added even more css functionality in this version. ns-light
and ns-dark
are now added values which you can use to select specific theme color rules. They are added depending on the devices theme. Along with that change, more css optimizations, including hsla color support were added. A long awaited and very welcome fix to allow values to be reset to default when css rules are disabled was also finally done. Overall just the CSS fixes are worth the price.
Another cool change is they updated they revampled the android transition code. Should be better and more customizable. In addition Android also got ContentInset
properties on the ActionBar
. And iOS got selectedSegmentTintColor
on the Segment bar.
Finally, the awesome community PR that was snuck into this release is Peter Staev's async read/write addition. readAsync
and writeAsync
allow async access to the file system.
CLI
The CLI team has fixed several outstanding bugs; things like Asset generation, several webpack issues, cocoapod fixes.
V8
I'm going to create this new v8 Section, because Android and soon iOS will both be using the same v8 engine. v8 was upgraded to v7.7 which adds:
- Lazy feedback allocation - this reduces the memory load of the v8 engine, which is always good to have on mobile devices
Android
The Android team kept busy this month;
- They improved the error logging.
- Added Kotlin extension function support
- Added JSONObject support
- Upgraded to V8 7.7 (See v8 section)
IOS
Fixed a Mashalling issue from "unsigned char *"
Fixed losing some exceptions in TS from runtime
A lot of changes to the new v8 version of the iOS runtime that is still in alpha testing to eventually replace the JSCore version... This new runtime has pretty close to the same feature parity as the Android versoon. I'm sure the iOS team would LOVE you all to test out this runtime on your apps to verify they work properly -- you can do so by using tns platform add ios@alpha-v8
to tell it to use the v8 runtime.
Updating NativeScript
To get updated; you first need to do:
npm i -g nativescript@latest
To update a project; you need to do the following:
Latest Runtimes:
tns platform remove android && tns platform add android@latest
tns platform remove ios && tns platform add ios@latest
Latest Core modules:
npm r tns-core-modules --save
npm i tns-core-modules@latest --save
To install Webpack support:
npm i nativescript-dev-webpack@latest --save-dev
To install latest NativeScript Angular plugin
npm i nativescript-angular@latest --save
You will then need to install the actual angular bits; which as of this post v6 is currently supported.
The addition of t additional analytics/tracking to the CLI reminded me; you can disable it permanently; if you value your privacy by doing:
tns usage-reporting disable && tns error-reporting disable