Back to Blog Home
← all posts

NativeScript Preview 2.0 with StackBlitz Available Now

August 17, 2022 — by Technical Steering Committee (TSC)

NativeScript Preview 2.0 is a complete top to bottom revamp of the classic Playground which had been available for several years. This release brings support for modern NativeScript v8 and beyond.

tl;dr 👉 https://preview.nativescript.org

First demonstrated live in Austin, TX during OpenJS World 2022 where it was shared that several of our professional partners collaborated with the StackBlitz team to completely reenvision the NativeScript experience for users with the incredible capabilities of your web browser today.

You can now learn, explore and experiment with native platform APIs to prototype rich mobile platform apps from the comfort of StackBlitz for any flavor you love:

If you're new to NativeScript and want to try it out before you setup your local environment or just want to spin up a demo app quicky then StackBlitz with Preview can help you.

How does it work?

  1. You can use the StackBlitz Web IDE to start a new Preview session, once booted, a QR code appears on the right.
  2. Scan the QR with your phone camera.
  3. Your source code in StackBlitz will begin building and the Preview app will open on your device ready for you to develop with.

Cool things about StackBlitz + Preview

  • Test your app on iOS from a Windows machine. With the Preview iOS app installed your iPhone, you can scan the QR code to try your app on iOS from a Windows or Linux machine.

  • More space on your machine: You can avoid your demo apps occupying extraneous space on your hard drive.

  • Share & embed: You can easily share your project with as many people as you want just by sending them the project's link (you can even live develop with them).

  • Ability to edit even if you go offline.

  • Import existing files & folders: You can upload your local project by simply dragging & dropping them into the StackBlitz IDE editor.

  • If you want to continue with your project locally, StackBlitz allows you to export your project.

How to start?

Using with StackBlitz

Pick a starter, scan the QR & start developing!

Using locally on your machine

You can preview your local NativeScript projects using the following steps:

cd /path/to/existing-project
# or
ns create

# then
ns preview

You should see a QR code printed in your console. If you are having trouble scanning the QR from the console, you can press o and open the Web UI with the QR code and a list of connected devices with a few helpful actions.

Known issues

On iOS, if your iPhone default browser is not Safari, then the app does not start immediately. After scanning the code, you will be taken to a page mentioning the session id where you can tap on "Open via scheme" to continue to open in Preview.

Limitations

  1. Plugins that have native dependencies have to be pre-installed into the Preview app which comes pre-loaded with a range of plugins. We'll be shipping the most popular plugins pre-installed in future updates.

One of the requirements for distributing Preview is that plugins providing features from native libraries (written in Java, Kotlin, Objective C or Swift), such as @nativescript/canvas have to be built into the app before it is uploaded to the App Store.

The included plugins can be used from StackBlitz.

If there's a plugin you'd like to see included, drop in our Community Discord and mention in the #preview channel. We may do community votes from time-to-time to poll which plugins others would like to see included in Preview updates.

  1. You can't change native resources

Similar to above, native resources such as the App_Resources/Android/src, App_Resources/Android/libs and App_Resources/iOS/src folders, have to be built into the Preview app beforehand. Basically that means you cannot add App_Resources from any project you want to preview. They will just simply be ignored.

  1. StackBlitz Free does not allow binary assets such as images and fonts to be uploaded - these work on a membership plan.

Check out StackBlitz Membership options here.

Included Plugins

"@nativescript-community/ui-label": "^1.2.9",
"@nativescript-community/ui-lottie": "^4.4.4",
"@nativescript-community/ui-material-bottom-navigation": "^7.0.25",
"@nativescript/camera": "^5.0.11",
"@nativescript/canvas": "^1.0.0",
"@nativescript/canvas-media": "^1.0.0",
"@nativescript/canvas-phaser-ce": "^1.0.0",
"@nativescript/canvas-polyfill": "^1.0.0",
"@nativescript/canvas-three": "^1.0.0",
"@nativescript/core": "~8.3.0",
"@nativescript/datetimepicker": "^2.1.10",
"@nativescript/email": "^2.0.5",
"@nativescript/geolocation": "^8.0.2",
"@nativescript/google-maps": "^1.2.0",
"@nativescript/imagepicker": "^1.0.0",
"@nativescript/mlkit-barcode-scanning": "^1.0.4",
"@nativescript/mlkit-core": "^1.0.4",
"@nativescript/social-share": "^2.0.4",
"@nativescript/tailwind": "^2.0.0",
"@nstudio/nativescript-loading-indicator": "^4.1.2",
"@triniwiz/nativescript-image-cache-it": "^7.1.0",
"@triniwiz/nativescript-image-zoom": "^4.1.3",
"@triniwiz/nativescript-toasty": "^4.1.3",
"nativescript-audio": "^6.2.6",
"nativescript-inappbrowser": "^3.2.0",
"nativescript-ui-autocomplete": "^8.0.1",
"nativescript-ui-calendar": "^8.0.0",
"nativescript-ui-chart": "^9.0.0",
"nativescript-ui-dataform": "^8.0.1",
"nativescript-ui-gauge": "^8.0.1",
"nativescript-ui-listview": "^10.2.0",
"nativescript-ui-sidedrawer": "^10.0.0",
"nativescript-videoplayer": "^5.0.1",
"tailwindcss": "^3.0.24",
"three": "^0.141.0"

Understanding NativeScript's Potential

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 thoughtful and inspiring community for their continuous input, contributions and support. A very special thanks to the StackBlitz team for incredible collaboration and to those who helped participate to provide early feedback on Preview 2.0 Private Beta throughout the 2022 summer. ❤️