Back to Blog Home
← all posts

NativeScript 8.2 Released

March 8, 2022 — by Technical Steering Committee (TSC)

NativeScript 8.2 brings some new features, broad memory optimizations throughout core and runtimes, some bug fixes, as well as support for the latest iOS (Xcode 13.3/iOS 15.4 release) and Android tooling (Android API 32 as well as gradle 7).

This release received excellent community engagement over the past several months during pre-release phase which helped the team greatly, thank you.

tl;dr — Updating to NativeScript 8.2

Updating to any minor or major version of NativeScript starts with installing the latest cli:

npm install -g nativescript

You can then confirm the latest installed with:

ns -v

You should see at least 8.2.0 or higher. If you do not see the latest installed, check your node, npm or yarn global setup.

You can now run the following in your projects:

ns migrate

Various project dependencies should now be updated.

Finally ensure your project is clean:

ns clean

Note: the CLI works with older projects, so it's always recommended to run the latest CLI regardless of your particular project versions.

Here are the dependencies you can expect to be using after a successful migration:

"dependencies": {
  "@nativescript/core": "~8.2.0"
},
"devDependencies": {
  "@nativescript/android": "~8.2.0",
  "@nativescript/ios": "~8.2.0",
  "@nativescript/types": "~8.2.0",
  "@nativescript/webpack": "~5.0.6"
}

CLI updates

A few high level details included:

  • Support for latest Android tooling, SDK 32 and gradle 7
  • Support for latest Xcode 13.3 and iOS 15.4 release
  • Support for building transient native dependencies (previously if one plugin depended on another, the native classes may fail to build)
  • Support for passing aar's to ns typings android --aar (In addition to --jar)
  • Fix for an occasional race condition with iOS simulators and debug output terminal
  • Optimizations with third party plugins
  • Allow overriding folders that ns clean deletes via (pathsToClean) and/or include additional folders via (additionalPathsToClean), for example:
import { NativeScriptConfig } from '@nativescript/core';

export default {
  // ...
  cli: {
    /**
      * Optional - Override the files or paths to clean when running the `ns clean` command
      */
    pathsToClean: ['node_modules', 'package-lock.json', 'yarn.lock'],

    /**
      * Optional - Additional files or paths to clean when running the `ns clean` command, the paths are appended to the default list of paths.
      */
    additionalPathsToClean: ['dist']
  },
} as NativeScriptConfig;

And more...

See full changelog here.

@nativescript/core 8.2

In 8.2, core received some new features, bug fixes and performance optimizations.

TouchManager

Introducing the new TouchManager which provides the ability to quickly and easily add a nice polishing touch to your apps with good UX feedback on touch down/up.

For example, you can easily and quickly enable consistent touch down/up animations on every view which has a tap event binding throughout your entire app by enabling TouchManager.enableGlobalTapAnimations before your app bootstraps (typically in app.ts or main.ts):

import { TouchManager, CoreTypes } from '@nativescript/core'

// define prior to your app bootstrap call (typically `app.ts` or `main.ts`):

TouchManager.enableGlobalTapAnimations = true;
TouchManager.animations = {
  down: {
    scale: { x: 0.95, y: 0.95 },
    duration: 120,
    curve: CoreTypes.AnimationCurve.easeInOut
  },
  up: {
    scale: { x: 1, y: 1 },
    duration: 120,
    curve: CoreTypes.AnimationCurve.easeInOut
  }
};

// bootstrap the app...

This would auto animate any view with a tap binding with those specific animations on touch down and up.

If you have a few "tappable" views that need to be ignored:

<Button text="Global tap animations simply ignored" ignoreTouchAnimation="true" />

You can also declaratively define custom touch animations on any specific view (which overrides any global TouchManager settings) by specifying it's own touchAnimation property:

<Button touchAnimation="{{ touchAnimation }}" />

This would animate touch down and up with the following view binding settings:

touchAnimation = {
  down: {
    scale: { x: 0.95, y: 0.95 },
    backgroundColor: new Color('yellow'),
    duration: 250,
    curve: CoreTypes.AnimationCurve.easeInOut,
  },
  up: {
    scale: { x: 1, y: 1 },
    backgroundColor: new Color('#63cdff'),
    duration: 250,
    curve: CoreTypes.AnimationCurve.easeInOut,
  },
}

testID

A new property testID has been added for use with e2e (end-to-end) integration tests. Previously automationText was often used, however it could interfere with a11y properties added in 8.0 so testID helps standardize all e2e testing as well as avoid common pitfalls. You can begin using testID with 8.2 and beyond for all e2e view identification. This property is only activated when running integration tests therefore never interferes with normal operation of the app.

To enable testID you can pass --env.e2e to the build command, and it will be enabled.

Memory optimizations

Several key areas were identified around font and text attribution handling as well as Image handling which were optimized to result in several nice memory optimization enhancements. This also included a fix for memory recollection on closing of modals.

Support for rgb alpha notation in CSS

This allowed us to support tailwind 3, that uses this format extensively.

Example: rgb(255, 255, 255 / 0.2)

RootLayout shadeCover supports gradients now

For example:

getRootLayout()
  .open(view, {
    shadeCover: {
      color: 'linear-gradient(to top, #fff, rgba(0, 0, 0, .7))',

Android 11+ file handling

If you had been targeting newer Android SDK's or devices you may have run into trouble with content:// uri's. 8.2 now properly handles those under the hood with the same existing file APIs.

Vanilla XML parser and binding improvements

Several improvements around those using vanilla NativeScript have been made regarding binding expressions - see these PR descriptions for details:

Here's a glimpse of a few other highlights:

This is just a glimpse of the changes that went into core — see full changelog here.

@nativescript/ios 8.2

In 8.2, additional memory optimizations have been included, as well as modifications to allow the runtime to begin being used in other diverse project developments.

This version supports Xcode 13.3 and iOS 15.4 (as well as prior versions).

For a full list of changes, see the full changelog here

@nativescript/android 8.2

In 8.2, the latest Android Studio tooling, SDK and build-tools are now officially supported. Additionally:

  • Gradle 7 support
  • API31 fixes
  • Updated all androidX libraries
  • exposed __drainMicrotaskQueue global
  • console.time to use 3 digit precision
  • direct TypedArray marshalling

For a full list of changes, see the full changelog here

Issues you may see after upgrading

app/src/main/AndroidManifest.xml:24:3-36:14 Error:
  android:exported needs to be explicitly specified for element . Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

Execution failed for task ':app:processDebugMainManifest'.
Manifest merger failed : android:exported needs to be explicitly specified for element . Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

Update your App_Resources/Android/src/main/AndroidManifest.xml and add android:exported="true" to the <activity> tag.

@nativescript/types 8.2

In preparation for iOS 15.4 and Android 12+ (also more androidx), you will find both new API's included in the latest types:

⚡⚡⚡

Furthermore we went a step further to optimize the iOS types by more than 50% from >20,000 declarations to ~8,000 lightening up your TypeScript editors greatly - nothing you need to do other than upgrade to 8.2 to receive this improvement. We will continue to optimize these over time.

If you are a plugin developer and/or just need the entire full set you can include all >20,000 with the following:

/// <reference path="@nativescript/types-ios/src/complete.d.ts" />

@nativescript/webpack 5.0.5

Bug Fixes

  • webpack: exclude other platforms from require.context (#9686) (cb7bd2a), closes #9682
  • webpack: xml-namespace-loader incorrect dependency mapping (#9780) (151d6e8)

Features

  • --env.e2e support to go along with the new testID property in core
  • support webpack profiling (#9804) (af4b7e3)
  • webpack: add support for .mjs files (#9747) (4fa51b6)
  • webpack: allow watching node_modules (#9781) (9c9c831)

You can catch notes of the release here.

@nativescript/tailwind 2.0

We released @nativescript/[email protected] to officially support Tailwind CSS 3.x. See instructions how to set it up in the @nativescript/tailwind docs

What's next? 8.3 and beyond?

In addition to the continual addressing of bugs as well as optimization passes we'll mention two broader goals with some upcoming releases:

For 8.3, we are planning to rollout node's fs API as fully supported to bring NativeScript's file handling as close to a mirror of node's file APIs. This is part of an effort to celebrate a standard file API across the node/JS ecosystem in general (no matter the platform).

For 9.0 we will be splitting the ui section of @nativescript/core into it's own package to prepare for broader platform UI adaptability/usage as well as continue to optimize the core libraries.


Become the next NativeScript Release Copilot

Ever wondered what was involved in creating a major or minor version release of NativeScript?

For every major or minor release starting with the next 8.3 release the TSC will select an entry at random each release cycle for someone to work alongside us to create the next major or minor release. We find the process insightful and fascinating everytime and want to give others the opportunity to gain insights into OSS maintenance and sustainability as well.

Whether you are starting out or a veteran, add your name by filling out this form and we will select at random within 3 month windows throughout the year. Each selection will receive a handful of swag goodies and can be sure will have a great time working with the international TSC to prepare the next release.

NativeScript Office Hours

NativeScript Office Hours are offered every month on the first Monday of each month (unless otherwise stated) at 11 AM PST via our community Discord.

Mentoring to beginning Developers

If you are beginning in the field of programming, we invite you to an open minded casual chat with open source maintainers whom are passionate, caring and easy to talk to.

These will be casual AMA (Ask Me Anything) sessions with an opportunity to speak with open source maintainers and professionals covering everything from writing the first line of code to managing open source projects to building in depth user experiences for employers and clients.

Resources:

Thank you for investing in a sustainable open source future.

Join our Discord Community

📣 Join us and say Hello!

Need Professional Help with your projects?

Contact any of our Partners for assistance.

Thank you

We would like to thank our wonderful community for their continuous input, contributions and support. Thanks to those who helped shape the 8.2 release by testing our pre-releases, reporting issues and contributing fixes. ❤️