Unleash your web skills on native!

A presentation at JSConf Belgium in May 2018 in Bruges, Belgium by Rowdy Rabouw

Slide 1

Slide 1

Slide 2

Slide 2

Unleash your web skills on native!

Slide 3

Slide 3

Slide 4

Slide 4

Web developer mood coaster

Slide 5

Slide 5

web developer in natural habitat

Slide 6

Slide 6

Slide 7

Slide 7

web developer • HTML • CSS • JavaScript • Sass • Node Package Manager Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 7/124

Slide 8

Slide 8

web developer on native iOS / Android

Slide 9

Slide 9

Slide 10

Slide 10

web developer & native • App stores • Provisioning files • Java or Kotlin for Android • Objective-C or Swift for iOS Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 10/124

Slide 11

Slide 11

web developer with nativescript

Slide 12

Slide 12

Slide 13

Slide 13

web developer & nativescript • App stores • Provisioning files • NativeScript • HTML • CSS • JavaScript • Sass • Node Package Manager Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 13/124

Slide 14

Slide 14

web developer ❤ nativescript

Slide 15

Slide 15

Slide 16

Slide 16

who?

Slide 17

Slide 17

Rowdy Rabouw @rowdyrabouw Gouda, The Netherlands I ❤ superhero movies Freelance web and app developer Lead developer Nationale-Nederlanden Pension App Progress Developer Expert for Nativescript Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 17/124

Slide 18

Slide 18

Slide 19

Slide 19

Mobile App framework decision guide

Slide 20

Slide 20

Mobile App framework decision guide Do you want/need a native User Interface and native performance? No Yes Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 20/124

Slide 21

Slide 21

Mobile App framework decision guide Do you want/need a native User Interface and native performance? No Yes Phonegap / Cordova with Ionic • WebView • DOM to manipulate • HTML styled like native Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 21/124

Slide 22

Slide 22

Mobile App framework decision guide Do you want/need a native User Interface and native performance? No Yes Phonegap / Cordova with Ionic • WebView • DOM to manipulate • HTML styled like native continue Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 22/124

Slide 23

Slide 23

Mobile App framework decision guide Do you have too much money and time? Yes No Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 23/124

Slide 24

Slide 24

Mobile App framework decision guide Do you have too much money and time? Yes No Native iOS and Android • Twice the work Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 24/124

Slide 25

Slide 25

Mobile App framework decision guide Do you have too much money and time? Yes No Native iOS and Android • Twice the work continue Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 25/124

Slide 26

Slide 26

Mobile App framework decision guide Do you potentially want/need to share code with the web? Or do you want/need to use web technologies? No Yes Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 26/124

Slide 27

Slide 27

Mobile App framework decision guide Do you potentially want/need to share code with the web? Or do you want/need to use web technologies? No Yes Xamarin • .NET or C# • Cross compiling • Bindings to access native APIs Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 27/124

Slide 28

Slide 28

Mobile App framework decision guide Do you potentially want/need to share code with the web? Or do you want/need to use web technologies? No Yes Flutter • Dart • Cross compiling • Beta Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 28/124

Slide 29

Slide 29

Mobile App framework decision guide Do you potentially want/need to share code with the web? Or do you want/need to use web technologies? No Yes Flutter • Dart • Cross compiling • Beta continue Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 29/124

Slide 30

Slide 30

Mobile App framework decision guide Do you want to use modern JavaScript? No Yes Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 30/124

Slide 31

Slide 31

Mobile App framework decision guide Do you want to use modern JavaScript? No Yes Titanium • No ES6/ES2015 support • Can't use NPM • Old MVC framework (Alloy) Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 31/124

Slide 32

Slide 32

Mobile App framework decision guide Do you want to use modern JavaScript? No Yes Titanium • No ES6/ES2015 support • Can't use NPM • Old MVC framework (Alloy) continue Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 32/124

Slide 33

Slide 33

Mobile App framework decision guide Do you know and like React? Yes No Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 33/124

Slide 34

Slide 34

Mobile App framework decision guide Do you know and like React? Yes No React Native • React • Native code to access APIs • Version 0.55 Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 34/124

Slide 35

Slide 35

Mobile App framework decision guide Do you know and like React? Yes No React Native • React • Native code to access APIs • Version 0.55 continue Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 35/124

Slide 36

Slide 36

Slide 37

Slide 37

NATIVESCRIPT

Slide 38

Slide 38

NATIVESCRIPT

Slide 39

Slide 39

What is NativeScript? • Open source framework for building truly native mobile apps • JavaScript, markup (XML/HTML) and CSS • Native code inside your JavaScript if you want and dare • Cross Platform: one codebase for iOS and Android • Backed by software company Progress • Android 4.2 or a later stable official release • iOS 7.0 or later stable official release Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 39/124

Slide 40

Slide 40

Slide 41

Slide 41

How to start?

Slide 42

Slide 42

docs.nativescript.org

Slide 43

Slide 43

nativescript.org/get-the-nativescript-book

Slide 44

Slide 44

forum.nativescript.org

Slide 45

Slide 45

nativescriptcommunity.slack.com

Slide 46

Slide 46

nativescript.org/nativescript-sidekick

Slide 47

Slide 47

play.nativescript.org

Slide 48

Slide 48

nativescripting.com

Slide 49

Slide 49

Slide 50

Slide 50

markup like on the web

Slide 51

Slide 51

Markup http://2xr.nl/markup https://docs.nativescript.org/ui/components < ActionBar

title ="Native elements"/> < StackLayout

< Button

text ="Button" tap ="{{ onButtonTap }}"/>

< Switch

checked ="false"/>

< SegmentedBar

items ="{{ segmentedBarItems }}"/>

< Progress

value ="0" maxValue ="100"/>

< Slider

value ="0" minValue ="0" maxValue ="100"/>

< DatePicker

year ="2018" month ="1" day ="1"

minDate ="1970-01-01" maxDate ="2100-12-31"/> </ StackLayout

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 51/124

Slide 52

Slide 52

Slide 53

Slide 53

TextField https://docs.nativescript.org/api-reference/modules/ui_text_field.textfield < TextField /> < TextField

text =""/> < TextField

hint ="Enter your name"/> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 53/124

Slide 54

Slide 54

TextField: autocapitalization https://docs.nativescript.org/api-reference/modules/ui_text_field.textfield < TextField

autocapitalizationType ="allCharacters"/> < TextField

autocapitalizationType ="sentences"/> < TextField

autocapitalizationType ="words"/> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 54/124

Slide 55

Slide 55

TextField: autocapitalization https://docs.nativescript.org/api-reference/modules/ui_text_field.textfield < TextField

autocapitalizationType ="allCharacters"/> < TextField

autocapitalizationType ="sentences"/> < TextField

autocapitalizationType ="words"/> < TextField

autocapitalizationType ="none"/> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 55/124

Slide 56

Slide 56

TextField: autocorrect https://docs.nativescript.org/api-reference/modules/ui_text_field.textfield < TextField

autocorrect ="true"/> < TextField

autocorrect ="false"/> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 56/124

Slide 57

Slide 57

TextField: keyboardType http://2xr.nl/keyboardType https://docs.nativescript.org/api-reference/modules/ui_enums.keyboardtype < TextField

keyboardType ="number"/> < TextField

keyboardType ="datetime"/> < TextField

keyboardType ="phone"/> < TextField

keyboardType ="email"/> < TextField

keyboardType ="url"/> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 57/124

Slide 58

Slide 58

Slide 59

Slide 59

TextField: more attributes https://docs.nativescript.org/api-reference/modules/ui_text_field.textfield < TextField

textAlignment =""/> < TextField

visibility =""/> < TextField

width =""/> < TextField

maxLength =""/> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 59/124

Slide 60

Slide 60

Layouts https://docs.nativescript.org/ui/layouts Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 60/124

Slide 61

Slide 61

Layouts https://docs.nativescript.org/ui/layouts Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 61/124

Slide 62

Slide 62

DockLayout https://docs.nativescript.org/ui/layouts < DockLayout

height ="100%"

stretchLastChild ="true">

< Label

text ="1" dock ="top"/>

< Label

text ="2" dock ="bottom"/>

< Label

text ="3" dock ="right"/>

< Label

text ="4" dock ="left"/> </ DockLayout

<!-- 1 + 2 have fixed height 3 has fixed width 4 will get all remaining space -->

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 62/124

Slide 63

Slide 63

GridLayout https://docs.nativescript.org/ui/layouts < GridLayout

rows ="100, auto, *"

columns ="100, auto, *">

< Label

text ="1" row ="0" col ="0">

< Label

text ="2" row ="0" col ="1"

colSpan ="2"/>

< Label

text ="3" row ="1" col ="0"

rowSpan ="2"/>

< Label

text ="4" row ="1" col ="1"/>

< Label

text ="5" row ="1" col ="2"/>

< Label

text ="6" row ="2" col ="1"/>

< Label

text ="7" row ="2" col ="2"/> </ GridLayout

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 63/124

Slide 64

Slide 64

Slide 65

Slide 65

Cascading Style Sheets

Slide 66

Slide 66

Cascading Style Sheets https://docs.nativescript.org/ui/styling • a large subset of CSS properties is supported • device-independent pixels • application-wide, page-specific or inline • platform-specific possible • animations • SASS Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 66/124

Slide 67

Slide 67

{N} Core Themes https://docs.nativescript.org/ui/theme • ready to use color schemes • tailored for iOS and Android Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw

Slide 68

Slide 68

NativeScript Theme Builder https://www.nativescriptthemebuilder.com Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 68/124

Slide 69

Slide 69

TabView < TabView

height ="100%">

< StackLayout * tabItem ="{title: 'Rocket Raccoon'}" class ="full rocket"/>

< StackLayout * tabItem ="{title: 'Harley Quinn'}" class ="full harley"/>

< StackLayout * tabItem ="{title: 'Hulk'}" class ="full hulk"/> </ TabView

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 69/124

Slide 70

Slide 70

TabView .full {

background-size : cover;

background-position : center;

background-repeat : no-repeat; } .rocket { background-image : url ( "~/images/rocket-raccoon.jpg" ); } .harley { background-image : url ( "~/images/harley-quinn.jpg" ); } .hulk { background-image : url ( "~/images/hulk.jpg" ); } Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 70/124

Slide 71

Slide 71

Slide 72

Slide 72

Slide 73

Slide 73

4 Fantastic Choices

Slide 74

Slide 74

JavaScript

Slide 75

Slide 75

TypeScript

Slide 76

Slide 76

Vue.js

Slide 77

Slide 77

Angular

Slide 78

Slide 78

Slide 79

Slide 79

Native Code

Slide 80

Slide 80

{N} Angular directory structure app/components/slider/ slider.component.html slider.component.ts slider.component.css slider-routing.module.ts slider-module.ts Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 80/124

Slide 81

Slide 81

slider.component.html < ActionBar

title ="Slider"></ ActionBar

< StackLayout

< Slider

value ="70"></ Slider

</ StackLayout

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 81/124

Slide 82

Slide 82

slider.component.ts import { Component } from

"@angular/core" ; @Component({

selector : "app-slider" ,

moduleId : module .id,

templateUrl : "slider.component.html" ,

styleUrls : [ "slider.component.css" ] }) export

class SliderComponent {

constructor () {} } Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 82/124

Slide 83

Slide 83

slider.component.css ActionBar {

color : white;

background-color : red; } StackLayout {

padding : 50 ; } Slider {

background-color : red; } Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 83/124

Slide 84

Slide 84

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 84/124

Slide 85

Slide 85

slider.component.html < ActionBar

title ="Slider"></ ActionBar

< StackLayout

< Slider

slider-icon

value ="70"></ Slider

</ StackLayout

• attribute directive • changes the appearance or behavior of an element Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 85/124

Slide 86

Slide 86

slider.directive.ts import { Directive, ElementRef } from

"@angular/core" ; import { isIOS } from

"platform" ; @Directive({

selector : "[slider-icon]" }) export

class SliderIconDirective {

constructor (private el: ElementRef) {

if (isIOS) {

let uiSlider = this .el.nativeElement.ios; uiSlider.setThumbImageForState( UIImage.imageNamed( "image.png" ), UIControlState.Normal); } } } Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 86/124

Slide 87

Slide 87

slider.directive.ts import { Directive, ElementRef } from

"@angular/core" ; import { isIOS } from

"platform" ; @Directive({

selector : "[slider-icon]" }) export

class SliderIconDirective {

constructor (private el: ElementRef) {

if (isIOS) {

let uiSlider = this .el.nativeElement.ios; uiSlider.setThumbImageForState( UIImage.imageNamed( "image.png" ), UIControlState.Normal); } } } Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 87/124

Slide 88

Slide 88

slider.directive.ts import { Directive, ElementRef } from

"@angular/core" ; import { isIOS } from

"platform" ; @Directive({

selector : "[slider-icon]" }) export

class SliderIconDirective {

constructor (private el: ElementRef) {

if (isIOS) {

let uiSlider = this .el.nativeElement.ios; uiSlider.setThumbImageForState( UIImage.imageNamed( "image.png" ), UIControlState.Normal); } } } Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 88/124

Slide 89

Slide 89

slider.module.ts import { NgModule, NO_ERRORS_SCHEMA } from

"@angular/core" ; import { NativeScriptModule } from

"nativescript-angular/nativescript.module" ; import { SliderIconDirective } from

"./slider.directive" ; import { SliderRoutingModule } from

"./slider-routing.module" ; import { SliderComponent } from

"./slider.component" ; @NgModule({

imports : [NativeScriptModule, SliderRoutingModule],

declarations : [SliderComponent, SliderIconDirective],

schemas : [NO_ERRORS_SCHEMA] }) export

class SliderModule {} Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 89/124

Slide 90

Slide 90

Slide 91

Slide 91

91/124

Slide 92

Slide 92

Slide 93

Slide 93

Packages & Libraries

Slide 94

Slide 94

Node Package Manager • commonly known as npm • ready to use JavaScript modules • about 650.000 packages of free, reusable code • npm install packagename --save • package.json Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 94/124

Slide 95

Slide 95

Node Package Manager crypto-js Cryptography standards (AES-256) accounting.js Number, money and currency formatting email-validator Email syntax validator Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 95/124

Slide 96

Slide 96

Android Arsenal • libraries for Android (Java / Kotlin) Cocoapods • libraries for iOS (Objective-C / Swift) Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 96/124

Slide 97

Slide 97

Slide 98

Slide 98

Multilingual: ngx-translate

Slide 99

Slide 99

Multilingual: ngx-translate • internationalization library for Angular 2+ • define translations in different languages • switch between them easily • no hardcoded text/labels, all in one place • start directly, even with one language Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 99/124

Slide 100

Slide 100

Multilingual: ngx-translate {

"HOME" : {

"TITLE" : "Hello JSConf Belgium!" ,

"TEXT" : "It's great to introduce NativeScript to you." ,

"SLIDER" : "Slider" ,

"ENGLISH" : "English" ,

"FOREIGN" : "Dutch" ,

"MIP" : "WowWee MiP" ,

"MACHINE_LEARNING" : "Machine Learning" ,

"SPEECH_RECOGNITION" : "Speech Recognition" } } Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 100/124

Slide 101

Slide 101

Multilingual: ngx-translate < ActionBar

[ title ]="'HOME.TITLE' | translate"> </ ActionBar

< Button

[ text ]="'HOME.ENGLISH' | translate" ( tap )="changeLanguage('en')"> </ Button

[] = one way data binding in Angular | = display-value transformations Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 101/124

Slide 102

Slide 102

102/124

Slide 103

Slide 103

Slide 104

Slide 104

NativeScript Plugins

Slide 105

Slide 105

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 105/124

Slide 106

Slide 106

Nativescript cli npm install nativescript -g Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 106/124

Slide 107

Slide 107

Nativescript cli tns create <app-name> tns create <app-name> --tsc tns create <app-name> --ng vue init nativescript-vue/vue-cli-template <app-name> tns create <app-name> --template <template-url> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 107/124

Slide 108

Slide 108

Nativescript cli tns platform add ios tns platform add android tns build ios tns build android tns run ios tns run android Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 108/124

Slide 109

Slide 109

Nativescript cli tns plugin add <plugin-name> Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 109/124

Slide 110

Slide 110

Slide 111

Slide 111

{N} Plugins live demo

Slide 112

Slide 112

Nativescript plugins • nativescript-bluetooth • nativescript-camera • nativescript-social-share • nativescript-speech-recognition • nativescript-texttospeech • nativescript-videoplayer Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 112/124

Slide 113

Slide 113

nativescript-bluetooth import * as bluetooth from

"nativescript-bluetooth" ; bluetooth.isBluetoothEnabled() .then( function ( enabled ) { alert( "Enabled? "

  • enabled); }); Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 113/124

Slide 114

Slide 114

nativescript-bluetooth private uuid = "CA9F644C-1920-4572-8833-1D137A6T2A05" ; bluetooth.startScanning({

seconds : 4 ,

onDiscovered : peripheral => {

if (peripheral.UUID == this .uuid) { bluetooth.connect({

UUID : peripheral.UUID,

onConnected : peripheral => { bluetooth.stopScanning();

// do stuff } }); } } }); Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 114/124

Slide 115

Slide 115

nativescript-camera import * as camera from

"nativescript-camera" ; import { ImageSource } from

"tns-core-modules/image-source" ; camera.requestPermissions(); camera.takePicture({

width : 1000 ,

height : 1000 }) .then( imageAsset => {

new ImageSource().fromAsset(imageAsset).then( imageSource => {

// do something with the image }); }); Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 115/124

Slide 116

Slide 116

nativescript-social-share import * as camera from

"nativescript-camera" ; import { ImageSource } from

"tns-core-modules/image-source" ; import * as SocialShare from

"nativescript-social-share" ; camera.requestPermissions(); camera.takePicture({

width : 1000 ,

height : 1000 }) .then( imageAsset => {

new ImageSource().fromAsset(imageAsset).then( imageSource => { SocialShare.shareImage(imageSource); }); }); Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 116/124

Slide 117

Slide 117

nativescript-speech-recognition import { SpeechRecognition, SpeechRecognitionTranscription }

from

"nativescript-speech-recognition" ; private speechRecognition = new SpeechRecognition(); this .speechRecognition.available().then(

( available: boolean ) =>

console .log(available ? "YES!" : "NO" ), (err: string) => console .log(err) ); this .speechRecognition.requestPermission().then( ( granted: boolean ) => {

console .log( "Granted? "

  • granted); }); Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 117/124

Slide 118

Slide 118

nativescript-speech-recognition this .speechRecognition.startListening({

locale : "en-US" ,

returnPartialResults : true ,

onResult : ( transcription: SpeechRecognitionTranscription ) => {

console .log( User said: ${transcription.text} ); } }); this .speechRecognition.stopListening().then( () => {

// do something with the recognized text }); Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 118/124

Slide 119

Slide 119

nativescript-texttospeech import { TNSTextToSpeech, SpeakOptions }

from

"nativescript-texttospeech" ; let textToSpeech = new TNSTextToSpeech(); let speakOptions: SpeakOptions = {

text : "Hello world!" ,

locale : "en-GB" ,

speakRate : 0.5 ,

pitch : 0.8 }; textToSpeech.speak(speakOptions); Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 119/124

Slide 120

Slide 120

nativescript-videoplayer < VideoPlayer

src ="video.mp4"

controls ="true"

loop ="true"

autoplay ="false"> </ VideoPlayer

Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 120/124

Slide 121

Slide 121

Win {N} Socks!

Slide 122

Slide 122

Slide 123

Slide 123

Merciekes! 2xr.nl/JSConfBE

Slide 124

Slide 124

Links Native elements playground: http://2xr.nl/markup keyboardType playground: http://2xr.nl/keyboardType TabView playground: http://2xr.nl/TabView Plugin demo app: http://2xr.nl/JSConfBE2018code Unleash your web skills on native! - Rowdy Rabouw - JSConf BE 2018 - @rowdyrabouw 124/124