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.
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"
}
A few high level details included:
ns typings android --aar
(In addition to --jar
)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;
See full changelog here.
In 8.2, core received some new features, bug fixes and performance optimizations.
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,
},
}
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.
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.
This allowed us to support tailwind 3, that uses this format extensively.
Example: rgb(255, 255, 255 / 0.2)
For example:
getRootLayout()
.open(view, {
shadeCover: {
color: 'linear-gradient(to top, #fff, rgba(0, 0, 0, .7))',
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.
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.
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
In 8.2, the latest Android Studio tooling, SDK and build-tools are now officially supported. Additionally:
For a full list of changes, see the full changelog here
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.
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" />
--env.e2e
support to go along with the new testID
property in coreYou can catch notes of the release here.
We released @nativescript/[email protected]
to officially support Tailwind CSS 3.x. See instructions how to set it up in the @nativescript/tailwind docs
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.
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 are offered every month on the first Monday of each month (unless otherwise stated) at 11 AM PST via our community Discord.
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.
Contact any of our Partners for assistance.
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. ❤️