SlideShare a Scribd company logo
Building Native
Mobile Apps
with Javascript
Josh JEnsen ABOUT Me
mobile application consultant,
entrepreneur, Technology Addict,
OCR enthusiast, Beer Drinker.
@joshJ
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Additional Sessions
Exploring React.Native

15:30 (3:30pm) Today

Me
Expanding Your
Nativescript App with
Native Libraries 

16:30 (4:30pm) Today

Stephen Feather
State of Titanium

10:00am Tomorrow

Rick Blalock
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
What this session is Not
• A study in best practices
• a comprehensive look at each platform
• A time to bash one platform or another
What this session is
• A developers journey through 3 platforms
• Initial Impressions and results
• A tool for deciding what is right for you
Mobile LandScape
Native
Hybrid
Transpiled
Abstracted
‣ Objective c, Swift, Java
‣ PhoneGap/Cordova
‣ Xamarin
‣ NativeScript, React Native, Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Define ab·stract·ed
consider (something)
theoretically or separately
from something else
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Define: Abstracted Platform
A platform where an API is abstracted away from or
separated from the primary language by proxy and/or
runtime.
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
var	
  myView	
  =	
  Ti.UI.createView();
UIView	
  *	
  myView	
  =	
  [[UIView	
  alloc]	
  init];Obj c
Titanium
NativeScript
React Native
var	
  myView	
  =	
  UIView.alloc().init();
<View></View>
Abstracted platforms
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
NativeScript React Native Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
NativeScript React Native Titanium
Open Source: Free Open Source: Free Open Source: Free*
Seat: $39/mo Free Indie: $39/mo
Add-ons: vary FRee Team: $259/seat/mo
Enterprise: call FRee Enterprise: call
Platform Pricing
*Appcelerator’s distributed open source offering is one to two version behind their commercial offering.
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
NativeScript React Native Titanium
Open Source ○ ○ ○
Licence Apache BSD Apache / Proprietary
iOS ○ ○ ○
Android ○ ○ ○
Windows Coming Soon No Limited
Platform Quick Facts
Source: https://github.com/skypanther/mobileframeworks
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
platform Tooling
NativeScript React Native Titanium
Node.JS 0.12.x 4.x 0.12.x
Xcode Latest 6.3+ 6.4.x
Gradle Required N/A N/A
ANT N/A N/A REQUIRED
JDK Latest Latest Latest
HomeBrew Recommended Recommended N/A
platform Setup
‣ https://facebook.github.io/react-native/docs/getting-started.html
‣ https://docs.nativescript.org/getting-started#install-nativescript-and-configure-your-environment
‣ http://docs.appcelerator.com/platform/latest/#!/guide/Installation_and_Configuration
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Build
Times
Initial
0
17.5
35
52.5
70
Build Times
60.347
14.345
4.646
NativeScript React Native Titanium
Build
Times
Subsequent
0
1.25
2.5
3.75
5
Build Times
3.504
0.68
4.645
NativeScript React Native Titanium
Build Times: Live Reload
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
NativeScript:
React Native:
Titanium:
<1 second
Instant
1+ seconds (requires Subscription or 3rd party tooling)
Mobilejs.io Todo App
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
http://mobilejs.io - Source
Application Structure
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Application
Structure
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Inline Css,JS,XML
Base File
Build Files
Fonts
Resources
Application
Structure
React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Page
Base File
Build Files
Row Component
Application
Structure
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Controllers
Base File
Views
Styles
Build Files
Layout Methods
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Layouts
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<StackLayout	
  orientation="horizontal"	
  id="formWrapper">	
  
	
  	
  <Label	
  id=“selectAllIcon"	
  />	
  
	
  	
  <TextField	
  id=“textInput"	
  />	
  
</StackLayout>
#formWrapper	
  {	
  
	
  	
  margin-­‐right:	
  10;	
  	
  
	
  	
  margin-­‐top:	
  10;	
  
	
  	
  margin-­‐left:	
  10;	
  	
  	
  
}	
  
#textInput	
  {	
  
	
   height:	
  60;	
  
	
   padding:	
  10;	
  
}	
  
#selectAllIcon	
  {	
  
	
  	
  margin-­‐left:	
  18;	
  
	
  width:	
  30;	
  
	
  	
  height:	
  30;	
  
}
Layouts
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<AbsoluteLayout	
  />
<DockLayout	
  />
<GridLayout	
  />
<StackLayout	
  />
<WrapLayout	
  />
Layouts React NAtive
BUILDING NATIVE MOBILE APPS WITH
JAVASCRIPT
<View	
  style={styles.formWrapper}>	
  	
  
	
  	
  <Icon	
  
	
  	
  	
  	
  name='fontawesome|chevron-­‐down'	
  
	
  	
  	
  	
  style={styles.selectAllIcon}	
  
	
  	
  	
  	
  />	
  	
  	
  
	
  	
  <TextInput	
  
	
  	
  	
  	
  ref="textInput"	
  
	
  	
  	
  	
  style={styles.textInput}	
  
	
  	
  />	
  
</View>	
  
formWrapper:	
  {	
  
	
  	
  flexDirection:	
  'row'	
  
},	
  
selectAllIcon:	
  {	
  
	
  	
  alignSelf:	
  'center',	
  
	
  	
  width:	
  40,	
  
	
  	
  height:	
  40	
  
},	
  	
  
textInput:	
  {	
  
	
  	
  flex:	
  1,	
  
	
  	
  height:	
  60,	
  
	
  	
  padding:	
  10,	
  
}
<View	
  id="formWrapper">	
  
	
  	
  	
  	
  <Label	
  id="selectAllIcon"></Label>	
  
	
   	
   	
  <TextField	
  id="textInput"	
  />	
  
</View>	
  
Layouts
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
"#formWrapper":	
  {	
  
	
  	
  top:	
  0,	
  
	
  	
  height:	
  Ti.UI.SIZE,	
  
	
   layout:	
  "horizontal"	
  
}	
  
"#selectAllIcon":	
  {	
  
	
  	
  left:	
  10,	
  
	
  	
  height:	
  60,	
  
	
  	
  width:	
  30	
  
}	
  
"#textInput":	
  {	
  
	
  	
  width:	
  Ti.UI.FILL,	
  
	
  	
  height:	
  60	
  	
  
}	
  
Initializing an Application
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Initializing an
Application
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Base File
var	
  application	
  =	
  require('application');	
  
application.mainModule	
  =	
  'todo/list';	
  
application.cssFile	
  =	
  './app.css';	
  
application.start();
Initializing an
Application
React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
var	
  React	
  =	
  require('react-­‐native');	
  
var	
  ListPage	
  =	
  require('./app/pages/list');	
  
var	
  {AppRegistry,	
  StyleSheet,	
  	
  
NavigatorIOS}	
  =	
  React;	
  
var	
  todomjs	
  =	
  React.createClass({	
  
	
  	
  render:	
  function()	
  {	
  
	
  	
  	
  	
  return	
  (	
  
	
  	
  	
  	
  	
  	
  <NavigatorIOS	
  
	
  	
  	
  	
  	
  	
  	
  	
  style={styles.topLevelNavigator}	
  
	
  	
  	
  	
  	
  	
  	
  	
  navigationBarHidden={true}	
  
	
  	
  	
  	
  	
  	
  	
  	
  initialRoute={{	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  title:	
  '',	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  component:	
  ListPage	
  
	
  	
  	
  	
  	
  	
  	
  	
  }}	
  
	
  	
  	
  	
  	
  	
  />	
  	
  	
  	
  	
  	
  	
  
	
  	
  	
  	
  );	
  
	
  	
  }	
  
});	
  
AppRegistry.registerComponent('todomjs',	
  ()	
  =>	
  todomjs);	
  
Base File
Initializing an
Application
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Base Filevar	
  application	
  =	
  require('application');	
  
if	
  (OS_IOS)	
  {	
  
	
   application.navWindow	
  =	
  $.navWindow;	
  
}	
  
$.navWindow.open();	
  
application.init();
Getting to Hello World
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Getting to
Hello World
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Page	
  xmlns="http://www.nativescript.org/tns.xsd">	
  
	
  	
  <Label	
  text="Hello	
  World"/>	
  
</Page>
Getting to
Hello World
React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
var	
  React	
  =	
  require('react-­‐native');	
  
var	
  {	
  
	
  	
  AppRegistry,	
  
	
  	
  Text	
  
}	
  =	
  React;	
  
var	
  todomjs	
  =	
  React.createClass({	
  
	
  	
  render:	
  function()	
  {	
  
	
  	
  	
  	
  return	
  (	
  
	
  	
  	
  	
  	
  	
  <Text>Hello	
  World</Text>	
  
	
  	
  	
  	
  );	
  
	
  	
  }	
  
});	
  
AppRegistry.registerComponent('todomjs',	
  ()	
  =>	
  todomjs);
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Alloy>	
  
	
  	
  <Window>	
  
	
  	
  	
  	
  <Label>Hello	
  World</Label>	
  
	
  	
  </Window>	
  
</Alloy>
"Window":	
  {	
  
	
  	
  backgroundColor:	
  "#fff"	
  
}
$.getView().open();
Getting to
Hello World
Titanium
Adding Custom Fonts
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Adding
Custom Fonts
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Font File
if	
  (application.ios)	
  {	
  
	
  	
  var	
  fontModule	
  =	
  require('ui/styling/font');	
  
	
  	
  fontModule.ios.registerFont('fontawesome-­‐webfont.ttf');	
  
}
.fa	
  {	
  
	
   font-­‐family:	
  FontAwesome;	
  
}
Adding
Custom Fonts
React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
1. Add the font files to your resource files
2. Edit your Info.plist: Add a new entry with the key Fonts
provided by application.
3. For each of your files, add the file name to this array
Source: http://stackoverflow.com/questions/4969329/how-to-include-and-use-new-fonts-in-iphone-
sdk
Adding
Custom Fonts
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
1. Add the font files to App > assets
1. > iphone > fonts
2. > android > fonts
Label
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Label
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Label	
  text="Todo"	
  id=“header"	
  />
#header	
  {	
  
	
  	
  font-­‐family:	
  "HelveticaNeueThin";	
  
	
  	
  font-­‐size:	
  80;	
  
	
  	
  text-­‐align:	
  center;	
  
	
  	
  color:	
  #d2d2d2;	
  
	
  	
  right:	
  10;	
  
}
Label
React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Text	
  style={styles.header}>todos</Text>
header:	
  {	
  
	
  	
  fontFamily:	
  'Helvetica	
  Neue',	
  
	
  	
  fontWeight:	
  '100',	
  
	
  	
  fontSize:	
  80,	
  
	
  	
  textAlign:	
  'center',	
  
	
  	
  color:	
  '#e7e7e7',	
  
	
  	
  marginTop:	
  20	
  
}
Label
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Label	
  id="header">Todos</Label>
"#header":	
  {	
  
	
   top:	
  20,	
  
	
   color:	
  "#e7e7e7",	
  
	
   textAlign:	
  "center",	
  
	
  	
  font:	
  {	
  
	
  	
  	
  	
  	
  	
  fontFamily:	
  "HelveticaNeue-­‐Thin",	
  
	
  	
  	
  	
  	
  	
  fontSize:	
  80,	
  
	
  	
  }	
  
}
ListView / Table View
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
ListView
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Page	
  xmlns="http://www.nativescript.org/tns.xsd"	
  navigatedTo="navigatedTo">	
  
</Page>
exports.navigatedTo	
  =	
  function(args)	
  {	
  
	
  	
  var	
  pageData	
  =	
  new	
  observableModule.Observable();	
  
	
  	
  page.bindingContext	
  =	
  pageData;	
  
}
List.xml
List.JS
ListView
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
	
  	
  	
  	
  <ListView	
  items="{{	
  todoItems	
  }}"	
  id="listView"	
  itemTap="rowOnPress"	
  
separatorColor="#fff">	
  
	
  	
  	
  	
  	
  	
  	
  	
  <ListView.itemTemplate>	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <StackLayout	
  orientation="horizontal"	
  cssClass="todo-­‐row">	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <Label	
  text="{{	
  isChecked	
  ?	
  ''	
  :	
  ''	
  }}"	
  color="{{	
  iconColor	
  }}"	
  
tap="onPressCheckbox"	
  cssClass="fa	
  checkbox"	
  	
  />	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <Label	
  text="{{	
  text	
  }}"	
  />	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  </StackLayout>	
  
	
  	
  	
  	
  	
  	
  	
  	
  </ListView.itemTemplate>	
  
	
  	
  	
  	
  </ListView>	
  
List.xml
pageData.set("todoItems",	
  todoItems);
List.JS
ListView
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
todoItems.unshift(_.extend({	
  
	
  	
  text:	
  text,	
  
	
  	
  children:	
  new	
  observableArray.ObservableArray([])	
  
},	
  config.rowTypes.notDone));
	
  	
  	
  	
  <ListView	
  items="{{	
  todoItems	
  }}"	
  id="listView"	
  itemTap="rowOnPress"	
  
separatorColor="#fff">	
  
	
  	
  	
  	
  	
  	
  	
  	
  <ListView.itemTemplate>	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <StackLayout	
  orientation="horizontal"	
  cssClass="todo-­‐row">	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <Label	
  text="{{	
  isChecked	
  ?	
  ''	
  :	
  ''	
  }}"	
  color="{{	
  iconColor	
  }}"	
  
tap="onPressCheckbox"	
  cssClass="fa	
  checkbox"	
  	
  />	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <Label	
  text="{{	
  text	
  }}"	
  />	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  </StackLayout>	
  
	
  	
  	
  	
  	
  	
  	
  	
  </ListView.itemTemplate>	
  
	
  	
  	
  	
  </ListView>	
  
List.xml
List.JS
ListView React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
var	
  ListPage	
  =	
  React.createClass({	
  
	
  	
  getInitialState:	
  function()	
  {	
  
	
  	
  	
  	
  this.ds	
  =	
  new	
  ListView.DataSource({rowHasChanged:	
  (r1,	
  r2)	
  =>	
  
r1.rowID	
  !==	
  r2.rowID});	
  
	
  	
  	
  	
  return	
  {	
  
	
  	
  	
  	
  	
  	
  todoItems:	
  this.props.todoItems	
  ||	
  [],	
  
	
  	
  	
  	
  	
  	
  dataSource:	
  this.ds.cloneWithRows(this.props.todoItems	
  ||	
  []),	
  
	
  	
  	
  	
  };	
  
	
  	
  }	
  
}
ListView React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<ListView	
  
	
  	
  style={styles.todoListView}	
  
	
  	
  initialListSize={15}	
  
	
  	
  dataSource={this.state.dataSource}	
  
	
  	
  renderRow={(rowData,	
  sectionID,	
  rowID,	
  highlightRow)	
  =>	
  (	
  
	
  	
  	
  	
  <TodoRow	
  rowParams={{	
  
	
  	
  	
  	
  	
  	
  sectionID,	
  
	
  	
  	
  	
  	
  	
  rowID,	
  
	
  	
  	
  	
  	
  	
  highlightRow,	
  
	
  	
  	
  	
  	
  	
  updateRow:	
  this.updateRow,	
  
	
  	
  	
  	
  	
  	
  deleteRow:	
  this.deleteRow,	
  
	
  	
  	
  	
  	
  	
  rowOnPress:	
  this.rowOnPress	
  
	
  	
  	
  	
  }}	
  rowData={rowData}	
  />	
  
	
  	
  )}	
  
	
  automaticallyAdjustContentInsets={false}	
  
/>
ListView React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
this.state.todoItems.unshift(_.extend({	
  
	
  	
  rowID:	
  new	
  Date().getTime(),	
  
	
  	
  text:	
  e.nativeEvent.text,	
  
	
  	
  children:	
  []	
  
},	
  config.rowTypes.notDone));	
  
this.setState({	
  
	
  	
  dataSource:	
  this.ds.cloneWithRows(this.state.todoItems)	
  
},	
  function()	
  {	
  
	
  	
  this.clearTextInput();	
  
});	
  
TableView
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<TableView	
  id="todoTable"	
  />
List.xml
$.todoItems	
  =	
  args.todoItems	
  ||	
  [];	
  
function	
  createRow(e)	
  {	
  
	
  	
  $.todoItems.unshift(_.extend({	
  
	
  	
  	
  	
  text:	
  e.value,	
  
	
  	
  	
  	
  children:	
  []	
  
	
  	
  },	
  config.rowTypes.notDone));	
  
	
  	
  $.todoTable.setData(buildRows($.todoItems));	
  	
  	
  	
  
}	
  
List.js
Tap Event Handlers
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Tap Event Handlers
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Label	
  text="back"	
  tap="onBackTap"	
  />
exports.onBackTap	
  =	
  function()	
  {	
  
};
List.xml
List.JS
Tap Event Handlers
React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<TouchableOpacity	
  
	
  	
  onPress={()	
  =>	
  this.backOnPress()}	
  
	
  	
  activeOpacity={0.2}	
  
	
  	
  >	
  
	
  	
  <Text>back</Text>	
  
</TouchableOpacity>
List.JS
Tap Event Handlers
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Label	
  id="backButton"></Label>
$.backButton.addEventListener('click',	
  backOnPress);
List.xml
List.JS
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
NativeScript:
React Native:
Titanium:
Tap
Press
Click or singletap
Tap Event Handlers
Code Reuse
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Code Reuse
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Page	
  
	
  	
  	
  	
  xmlns:customOtherControls="xml-­‐declaration/mymodulewithxml">	
  
	
  	
  	
  	
  <customOtherControls:MyControl	
  />	
  
</Page>
Source: http://docs.nativescript.org/ui-with-xml#example-custom-xml-based-component-with-code-file
Var Name Folder
File Name
Code Reuse
React NAtive
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
renderBackButton:	
  function()	
  {	
  
	
  	
  if	
  (this.props.showBack)	
  {	
  
	
  	
  	
  	
  return	
  (	
  
	
  	
  	
  	
  	
  	
  <TouchableOpacity	
  
	
  	
  	
  	
  	
  	
  	
  	
  style={styles.touchableAreaBackIcon}	
  
	
  	
  	
  	
  	
  	
  	
  	
  onPress={()	
  =>	
  this.backOnPress()}	
  
	
  	
  	
  	
  	
  	
  	
  	
  activeOpacity={0.2}	
  
	
  	
  	
  	
  	
  	
  	
  	
  >	
  
	
  	
  	
  	
  	
  	
  	
  	
  <Icon	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  name='fontawesome|arrow-­‐circle-­‐o-­‐left'	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  size={30}	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  color='#ead7d7'	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  style={styles.backButtonIcon}	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  />	
  
	
  	
  	
  	
  	
  	
  </TouchableOpacity>	
  
	
  	
  	
  	
  );	
  
	
  	
  }	
  
}
{this.renderBackButton()}
Code Reuse
React NAtive
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<TodoRow	
  rowParams={{	
  
	
  	
  sectionID,	
  
	
  	
  rowID,	
  
	
  	
  highlightRow,	
  
	
  	
  updateRow:	
  this.updateRow,	
  
	
  	
  deleteRow:	
  this.deleteRow,	
  
	
  	
  rowOnPress:	
  this.rowOnPress	
  
}}	
  rowData={rowData}	
  />
var	
  TodoRow	
  =	
  require('./../components/todorow');
this.props
Code Reuse
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Alloy.createController('list',	
  {});
var	
  args	
  =	
  arguments[0]	
  ||	
  {};
Navigation
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
NAvigation
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
var	
  frameModule	
  =	
  require("ui/frame");	
  
frameModule.topmost().navigate({	
  
	
  	
  moduleName:	
  "todo/list",	
  
	
  	
  context:	
  {	
  
	
  	
  	
  	
  rowID:	
  args.index,	
  
	
  	
  	
  	
  updateRowChildren:	
  updateRowChildren,	
  
	
  	
  	
  	
  todoItems:	
  todoItems.getItem(args.index).children	
  
	
  	
  }	
  
});	
  
NAvigation / Code Reuse
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
<Page	
  xmlns="http://www.nativescript.org/tns.xsd"	
  navigatedTo="navigatedTo">	
  
</Page>
exports.navigatedTo	
  =	
  function(args)	
  {	
  
	
  	
  var	
  page	
  =	
  args.object;	
  
};
page.navigationContext
NAvigation
REact NAtive
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
	
  	
  	
  	
  this.props.navigator.push({	
  
	
  	
  	
  	
  	
  	
  title:	
  '',	
  
	
  	
  	
  	
  	
  	
  component:	
  require('./list'),	
  
	
  	
  	
  	
  	
  	
  passProps:	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  rowID:	
  rowID,	
  
	
  	
  	
  	
  	
  	
  	
  	
  showBack:	
  true,	
  
	
  	
  	
  	
  	
  	
  	
  	
  todoItems:	
  this.state.todoItems[rowID].children,	
  
	
  	
  	
  	
  	
  	
  	
  	
  updateRowChildren:	
  this.updateRowChildren	
  
	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  });	
  
NAvigation
Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
application.navWindow.openWindow(	
  
	
  	
  Alloy.createController('list',	
  {	
  
	
  	
  	
  	
  rowID:	
  e.index,	
  
	
  	
  	
  	
  todoItems:	
  rowData.children	
  ||	
  [],	
  
	
  	
  	
  	
  updateRowChildren:	
  updateRowChildren	
  
	
  	
  }).getView()	
  
);
var	
  application	
  =	
  require('application');	
  
if	
  (OS_IOS)	
  {	
  
	
   application.navWindow	
  =	
  $.navWindow;	
  
}
Extending Each Platform
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Extending
NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
var	
  device	
  =	
  AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);	
  
flashlight.on	
  =	
  function()	
  {	
  
	
   this._checkAvailability();	
  
	
   device.lockForConfiguration(null);	
  
	
   device.torchMode	
  =	
  AVCaptureTorchMode.AVCaptureTorchModeOn;	
  
	
   device.flashMode	
  =	
  AVCaptureFlashMode.AVCaptureFlashModeOn;	
  
	
   device.unlockForConfiguration();	
  
};
Source: https://github.com/tjvantoll/nativescript-flashlight
Extending React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
var	
  React	
  =	
  require('react-­‐native');	
  
var	
  {	
  NativeModules	
  }	
  =	
  React;	
  
var	
  {	
  RNControlFlashlight	
  }	
  =	
  NativeModules;	
  
RNControlFlashlight.turnFlashlight("flashlightOn",	
  function	
  
errorCallback(results)	
  {	
  
	
   	
  	
  	
  	
  console.log('JS	
  Error:	
  '	
  +	
  results['errMsg']);	
  
	
   },	
  function	
  successCallback(results)	
  {	
  
	
   	
  	
  	
  	
  console.log('JS	
  Success:	
  '	
  +	
  results['successMsg']);	
  
	
   }	
  
);
Source: https://github.com/rhaker/react-native-control-flashlight-ios
Extending Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
-­‐(void)turnFlashLightOn:(id)args	
  
{	
  
	
  	
  	
  	
  if	
  ([device	
  hasTorch])	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  [device	
  lockForConfiguration:nil];	
  
	
  	
  	
  	
  	
  	
  	
  	
  [device	
  setTorchMode:AVCaptureTorchModeOn];	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  [device	
  unlockForConfiguration];	
  
	
  	
  	
  	
  }	
  
}	
  
var	
  NappFlashLight	
  =	
  require('NappFlashLight');	
  
NappFlashLight.turnFlashLightOn()	
  
Source: https://github.com/viezel/NappFlashLight
Pros & Cons
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Pros & CONS NativeScript
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
‣ Best Feature: Direct API access
Pros Cons
Direct API Access No JS Encryption
Excellent Support and Response Time to Tickets Very Young
Open Source You really need to know typeScript
Cross-platform UI abstractions Limited Cross-platform UI abstractions
Difficult Documentation
Pros & CONS React Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
‣ Best Feature: Live Reload
Pros Cons
Live Reload / No compile Time No JS Encryption
Growing Community Very Young
Completely Open Source ES6 Fluency is almost required
Expressive Markup React Methodology Learning Curve
Component Modularity Limited Cross-platform Apis
Modules Required for Native API access
Pros & CONS Titanium
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
‣ Best Feature: Maturity
Pros Cons
JS Source EnCryption Technical Debt
very Mature Platform OSS version is behind
Largest Community Modules Required for Native API access
Extensive API docs Compile Time
Extensive Cross-platform APIs
Native Mobile Apps
with Javascript
THANK YOU
646.876.2777
Josh@pixelflavor.com
@joshJ
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Questions?
Connect.js 2015 - Building Native Mobile Applications with Javascript
Ad

More Related Content

What's hot (20)

React native by example by Vadim Ruban
React native by example by Vadim RubanReact native by example by Vadim Ruban
React native by example by Vadim Ruban
Lohika_Odessa_TechTalks
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Codemotion
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
Andres Almiray
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Ryan Weaver
 
Modern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsModern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on Rails
Jonathan Johnson
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
Andres Almiray
 
Mobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast dive
epamspb
 
Vuejs testing
Vuejs testingVuejs testing
Vuejs testing
Greg TAPPERO
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
dion
 
api-platform: the ultimate API platform
api-platform: the ultimate API platformapi-platform: the ultimate API platform
api-platform: the ultimate API platform
Stefan Adolf
 
React native
React nativeReact native
React native
Mohammed El Rafie Tarabay
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
Andres Almiray
 
Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]
Iakiv Kramarenko
 
JavaOne - The JavaFX Community and Ecosystem
JavaOne - The JavaFX Community and EcosystemJavaOne - The JavaFX Community and Ecosystem
JavaOne - The JavaFX Community and Ecosystem
Alexander Casall
 
The Road to Native Web Components
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web Components
Mike North
 
PhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesPhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device Capabilities
Ivano Malavolta
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
Iakiv Kramarenko
 
Boost your angular app with web workers
Boost your angular app with web workersBoost your angular app with web workers
Boost your angular app with web workers
Enrique Oriol Bermúdez
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
Addy Osmani
 
Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with Karma
ExoLeaders.com
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Codemotion
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Ryan Weaver
 
Modern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsModern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on Rails
Jonathan Johnson
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
Andres Almiray
 
Mobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast dive
epamspb
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
dion
 
api-platform: the ultimate API platform
api-platform: the ultimate API platformapi-platform: the ultimate API platform
api-platform: the ultimate API platform
Stefan Adolf
 
Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]
Iakiv Kramarenko
 
JavaOne - The JavaFX Community and Ecosystem
JavaOne - The JavaFX Community and EcosystemJavaOne - The JavaFX Community and Ecosystem
JavaOne - The JavaFX Community and Ecosystem
Alexander Casall
 
The Road to Native Web Components
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web Components
Mike North
 
PhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesPhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device Capabilities
Ivano Malavolta
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
Iakiv Kramarenko
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
Addy Osmani
 
Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with Karma
ExoLeaders.com
 

Similar to Connect.js 2015 - Building Native Mobile Applications with Javascript (20)

Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Applitools
 
Nativescript with angular 2
Nativescript with angular 2Nativescript with angular 2
Nativescript with angular 2
Christoffer Noring
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
Steven Cooper
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile Development
Software Infrastructure
 
React Native
React NativeReact Native
React Native
Craig Jolicoeur
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
Todd Anglin
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundry
rajdeep
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
Jen Looper
 
Getting Started With React Native Presntation
Getting Started With React Native PresntationGetting Started With React Native Presntation
Getting Started With React Native Presntation
Knoldus Inc.
 
Universal Applications with Universal JavaScript
Universal Applications with Universal JavaScriptUniversal Applications with Universal JavaScript
Universal Applications with Universal JavaScript
Thomas Joseph
 
Using Ruby in Android Development
Using Ruby in Android DevelopmentUsing Ruby in Android Development
Using Ruby in Android Development
Adam Blum
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
Future Processing
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QAFest
 
React Native - CirebonDev
React Native - CirebonDevReact Native - CirebonDev
React Native - CirebonDev
Ayat Maulana
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
dssprakash
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
Barak Cohen
 
Intro to appcelerator
Intro to appceleratorIntro to appcelerator
Intro to appcelerator
Mohab El-Shishtawy
 
"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap
Christian Rokitta
 
Understanding meteor
Understanding meteorUnderstanding meteor
Understanding meteor
M A Hossain Tonu
 
React Native: Introduction
React Native: IntroductionReact Native: Introduction
React Native: Introduction
InnerFood
 
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Applitools
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
Steven Cooper
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
Todd Anglin
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundry
rajdeep
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
Jen Looper
 
Getting Started With React Native Presntation
Getting Started With React Native PresntationGetting Started With React Native Presntation
Getting Started With React Native Presntation
Knoldus Inc.
 
Universal Applications with Universal JavaScript
Universal Applications with Universal JavaScriptUniversal Applications with Universal JavaScript
Universal Applications with Universal JavaScript
Thomas Joseph
 
Using Ruby in Android Development
Using Ruby in Android DevelopmentUsing Ruby in Android Development
Using Ruby in Android Development
Adam Blum
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
Future Processing
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QAFest
 
React Native - CirebonDev
React Native - CirebonDevReact Native - CirebonDev
React Native - CirebonDev
Ayat Maulana
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
dssprakash
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
Barak Cohen
 
"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap
Christian Rokitta
 
React Native: Introduction
React Native: IntroductionReact Native: Introduction
React Native: Introduction
InnerFood
 
Ad

Recently uploaded (20)

Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Ad

Connect.js 2015 - Building Native Mobile Applications with Javascript

  • 2. Josh JEnsen ABOUT Me mobile application consultant, entrepreneur, Technology Addict, OCR enthusiast, Beer Drinker. @joshJ BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 3. Additional Sessions Exploring React.Native 15:30 (3:30pm) Today Me Expanding Your Nativescript App with Native Libraries 16:30 (4:30pm) Today Stephen Feather State of Titanium 10:00am Tomorrow Rick Blalock BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 4. What this session is Not • A study in best practices • a comprehensive look at each platform • A time to bash one platform or another
  • 5. What this session is • A developers journey through 3 platforms • Initial Impressions and results • A tool for deciding what is right for you
  • 6. Mobile LandScape Native Hybrid Transpiled Abstracted ‣ Objective c, Swift, Java ‣ PhoneGap/Cordova ‣ Xamarin ‣ NativeScript, React Native, Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 7. Define ab·stract·ed consider (something) theoretically or separately from something else BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 8. Define: Abstracted Platform A platform where an API is abstracted away from or separated from the primary language by proxy and/or runtime. BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT var  myView  =  Ti.UI.createView(); UIView  *  myView  =  [[UIView  alloc]  init];Obj c Titanium NativeScript React Native var  myView  =  UIView.alloc().init(); <View></View>
  • 9. Abstracted platforms BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT NativeScript React Native Titanium
  • 10. BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT NativeScript React Native Titanium Open Source: Free Open Source: Free Open Source: Free* Seat: $39/mo Free Indie: $39/mo Add-ons: vary FRee Team: $259/seat/mo Enterprise: call FRee Enterprise: call Platform Pricing *Appcelerator’s distributed open source offering is one to two version behind their commercial offering.
  • 11. BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT NativeScript React Native Titanium Open Source ○ ○ ○ Licence Apache BSD Apache / Proprietary iOS ○ ○ ○ Android ○ ○ ○ Windows Coming Soon No Limited Platform Quick Facts Source: https://github.com/skypanther/mobileframeworks
  • 12. BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT platform Tooling NativeScript React Native Titanium Node.JS 0.12.x 4.x 0.12.x Xcode Latest 6.3+ 6.4.x Gradle Required N/A N/A ANT N/A N/A REQUIRED JDK Latest Latest Latest HomeBrew Recommended Recommended N/A
  • 13. platform Setup ‣ https://facebook.github.io/react-native/docs/getting-started.html ‣ https://docs.nativescript.org/getting-started#install-nativescript-and-configure-your-environment ‣ http://docs.appcelerator.com/platform/latest/#!/guide/Installation_and_Configuration BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 16. Build Times: Live Reload BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT NativeScript: React Native: Titanium: <1 second Instant 1+ seconds (requires Subscription or 3rd party tooling)
  • 17. Mobilejs.io Todo App BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT http://mobilejs.io - Source
  • 18. Application Structure BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 19. Application Structure NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT Inline Css,JS,XML Base File Build Files Fonts Resources
  • 20. Application Structure React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT Page Base File Build Files Row Component
  • 21. Application Structure Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT Controllers Base File Views Styles Build Files
  • 22. Layout Methods BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 23. Layouts NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <StackLayout  orientation="horizontal"  id="formWrapper">      <Label  id=“selectAllIcon"  />      <TextField  id=“textInput"  />   </StackLayout> #formWrapper  {      margin-­‐right:  10;        margin-­‐top:  10;      margin-­‐left:  10;       }   #textInput  {     height:  60;     padding:  10;   }   #selectAllIcon  {      margin-­‐left:  18;    width:  30;      height:  30;   }
  • 24. Layouts NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <AbsoluteLayout  /> <DockLayout  /> <GridLayout  /> <StackLayout  /> <WrapLayout  />
  • 25. Layouts React NAtive BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <View  style={styles.formWrapper}>        <Icon          name='fontawesome|chevron-­‐down'          style={styles.selectAllIcon}          />          <TextInput          ref="textInput"          style={styles.textInput}      />   </View>   formWrapper:  {      flexDirection:  'row'   },   selectAllIcon:  {      alignSelf:  'center',      width:  40,      height:  40   },     textInput:  {      flex:  1,      height:  60,      padding:  10,   }
  • 26. <View  id="formWrapper">          <Label  id="selectAllIcon"></Label>        <TextField  id="textInput"  />   </View>   Layouts Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT "#formWrapper":  {      top:  0,      height:  Ti.UI.SIZE,     layout:  "horizontal"   }   "#selectAllIcon":  {      left:  10,      height:  60,      width:  30   }   "#textInput":  {      width:  Ti.UI.FILL,      height:  60     }  
  • 27. Initializing an Application BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 28. Initializing an Application NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT Base File var  application  =  require('application');   application.mainModule  =  'todo/list';   application.cssFile  =  './app.css';   application.start();
  • 29. Initializing an Application React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT var  React  =  require('react-­‐native');   var  ListPage  =  require('./app/pages/list');   var  {AppRegistry,  StyleSheet,     NavigatorIOS}  =  React;   var  todomjs  =  React.createClass({      render:  function()  {          return  (              <NavigatorIOS                  style={styles.topLevelNavigator}                  navigationBarHidden={true}                  initialRoute={{                      title:  '',                      component:  ListPage                  }}              />                      );      }   });   AppRegistry.registerComponent('todomjs',  ()  =>  todomjs);   Base File
  • 30. Initializing an Application Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT Base Filevar  application  =  require('application');   if  (OS_IOS)  {     application.navWindow  =  $.navWindow;   }   $.navWindow.open();   application.init();
  • 31. Getting to Hello World BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 32. Getting to Hello World NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Page  xmlns="http://www.nativescript.org/tns.xsd">      <Label  text="Hello  World"/>   </Page>
  • 33. Getting to Hello World React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT var  React  =  require('react-­‐native');   var  {      AppRegistry,      Text   }  =  React;   var  todomjs  =  React.createClass({      render:  function()  {          return  (              <Text>Hello  World</Text>          );      }   });   AppRegistry.registerComponent('todomjs',  ()  =>  todomjs);
  • 34. BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Alloy>      <Window>          <Label>Hello  World</Label>      </Window>   </Alloy> "Window":  {      backgroundColor:  "#fff"   } $.getView().open(); Getting to Hello World Titanium
  • 35. Adding Custom Fonts BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 36. Adding Custom Fonts NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT Font File if  (application.ios)  {      var  fontModule  =  require('ui/styling/font');      fontModule.ios.registerFont('fontawesome-­‐webfont.ttf');   } .fa  {     font-­‐family:  FontAwesome;   }
  • 37. Adding Custom Fonts React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT 1. Add the font files to your resource files 2. Edit your Info.plist: Add a new entry with the key Fonts provided by application. 3. For each of your files, add the file name to this array Source: http://stackoverflow.com/questions/4969329/how-to-include-and-use-new-fonts-in-iphone- sdk
  • 38. Adding Custom Fonts Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT 1. Add the font files to App > assets 1. > iphone > fonts 2. > android > fonts
  • 39. Label BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 40. Label NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Label  text="Todo"  id=“header"  /> #header  {      font-­‐family:  "HelveticaNeueThin";      font-­‐size:  80;      text-­‐align:  center;      color:  #d2d2d2;      right:  10;   }
  • 41. Label React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Text  style={styles.header}>todos</Text> header:  {      fontFamily:  'Helvetica  Neue',      fontWeight:  '100',      fontSize:  80,      textAlign:  'center',      color:  '#e7e7e7',      marginTop:  20   }
  • 42. Label Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Label  id="header">Todos</Label> "#header":  {     top:  20,     color:  "#e7e7e7",     textAlign:  "center",      font:  {              fontFamily:  "HelveticaNeue-­‐Thin",              fontSize:  80,      }   }
  • 43. ListView / Table View BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 44. ListView NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Page  xmlns="http://www.nativescript.org/tns.xsd"  navigatedTo="navigatedTo">   </Page> exports.navigatedTo  =  function(args)  {      var  pageData  =  new  observableModule.Observable();      page.bindingContext  =  pageData;   } List.xml List.JS
  • 45. ListView NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT        <ListView  items="{{  todoItems  }}"  id="listView"  itemTap="rowOnPress"   separatorColor="#fff">                  <ListView.itemTemplate>                          <StackLayout  orientation="horizontal"  cssClass="todo-­‐row">                                  <Label  text="{{  isChecked  ?  ''  :  ''  }}"  color="{{  iconColor  }}"   tap="onPressCheckbox"  cssClass="fa  checkbox"    />                                  <Label  text="{{  text  }}"  />                          </StackLayout>                  </ListView.itemTemplate>          </ListView>   List.xml pageData.set("todoItems",  todoItems); List.JS
  • 46. ListView NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT todoItems.unshift(_.extend({      text:  text,      children:  new  observableArray.ObservableArray([])   },  config.rowTypes.notDone));        <ListView  items="{{  todoItems  }}"  id="listView"  itemTap="rowOnPress"   separatorColor="#fff">                  <ListView.itemTemplate>                          <StackLayout  orientation="horizontal"  cssClass="todo-­‐row">                                  <Label  text="{{  isChecked  ?  ''  :  ''  }}"  color="{{  iconColor  }}"   tap="onPressCheckbox"  cssClass="fa  checkbox"    />                                  <Label  text="{{  text  }}"  />                          </StackLayout>                  </ListView.itemTemplate>          </ListView>   List.xml List.JS
  • 47. ListView React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT var  ListPage  =  React.createClass({      getInitialState:  function()  {          this.ds  =  new  ListView.DataSource({rowHasChanged:  (r1,  r2)  =>   r1.rowID  !==  r2.rowID});          return  {              todoItems:  this.props.todoItems  ||  [],              dataSource:  this.ds.cloneWithRows(this.props.todoItems  ||  []),          };      }   }
  • 48. ListView React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <ListView      style={styles.todoListView}      initialListSize={15}      dataSource={this.state.dataSource}      renderRow={(rowData,  sectionID,  rowID,  highlightRow)  =>  (          <TodoRow  rowParams={{              sectionID,              rowID,              highlightRow,              updateRow:  this.updateRow,              deleteRow:  this.deleteRow,              rowOnPress:  this.rowOnPress          }}  rowData={rowData}  />      )}    automaticallyAdjustContentInsets={false}   />
  • 49. ListView React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT this.state.todoItems.unshift(_.extend({      rowID:  new  Date().getTime(),      text:  e.nativeEvent.text,      children:  []   },  config.rowTypes.notDone));   this.setState({      dataSource:  this.ds.cloneWithRows(this.state.todoItems)   },  function()  {      this.clearTextInput();   });  
  • 50. TableView Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <TableView  id="todoTable"  /> List.xml $.todoItems  =  args.todoItems  ||  [];   function  createRow(e)  {      $.todoItems.unshift(_.extend({          text:  e.value,          children:  []      },  config.rowTypes.notDone));      $.todoTable.setData(buildRows($.todoItems));         }   List.js
  • 51. Tap Event Handlers BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 52. Tap Event Handlers NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Label  text="back"  tap="onBackTap"  /> exports.onBackTap  =  function()  {   }; List.xml List.JS
  • 53. Tap Event Handlers React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <TouchableOpacity      onPress={()  =>  this.backOnPress()}      activeOpacity={0.2}      >      <Text>back</Text>   </TouchableOpacity> List.JS
  • 54. Tap Event Handlers Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Label  id="backButton"></Label> $.backButton.addEventListener('click',  backOnPress); List.xml List.JS
  • 55. BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT NativeScript: React Native: Titanium: Tap Press Click or singletap Tap Event Handlers
  • 56. Code Reuse BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 57. Code Reuse NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Page          xmlns:customOtherControls="xml-­‐declaration/mymodulewithxml">          <customOtherControls:MyControl  />   </Page> Source: http://docs.nativescript.org/ui-with-xml#example-custom-xml-based-component-with-code-file Var Name Folder File Name
  • 58. Code Reuse React NAtive BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT renderBackButton:  function()  {      if  (this.props.showBack)  {          return  (              <TouchableOpacity                  style={styles.touchableAreaBackIcon}                  onPress={()  =>  this.backOnPress()}                  activeOpacity={0.2}                  >                  <Icon                      name='fontawesome|arrow-­‐circle-­‐o-­‐left'                      size={30}                      color='#ead7d7'                      style={styles.backButtonIcon}                      />              </TouchableOpacity>          );      }   } {this.renderBackButton()}
  • 59. Code Reuse React NAtive BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <TodoRow  rowParams={{      sectionID,      rowID,      highlightRow,      updateRow:  this.updateRow,      deleteRow:  this.deleteRow,      rowOnPress:  this.rowOnPress   }}  rowData={rowData}  /> var  TodoRow  =  require('./../components/todorow'); this.props
  • 60. Code Reuse Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT Alloy.createController('list',  {}); var  args  =  arguments[0]  ||  {};
  • 61. Navigation BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 62. NAvigation NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT var  frameModule  =  require("ui/frame");   frameModule.topmost().navigate({      moduleName:  "todo/list",      context:  {          rowID:  args.index,          updateRowChildren:  updateRowChildren,          todoItems:  todoItems.getItem(args.index).children      }   });  
  • 63. NAvigation / Code Reuse NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT <Page  xmlns="http://www.nativescript.org/tns.xsd"  navigatedTo="navigatedTo">   </Page> exports.navigatedTo  =  function(args)  {      var  page  =  args.object;   }; page.navigationContext
  • 64. NAvigation REact NAtive BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT        this.props.navigator.push({              title:  '',              component:  require('./list'),              passProps:  {                  rowID:  rowID,                  showBack:  true,                  todoItems:  this.state.todoItems[rowID].children,                  updateRowChildren:  this.updateRowChildren              }          });  
  • 65. NAvigation Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT application.navWindow.openWindow(      Alloy.createController('list',  {          rowID:  e.index,          todoItems:  rowData.children  ||  [],          updateRowChildren:  updateRowChildren      }).getView()   ); var  application  =  require('application');   if  (OS_IOS)  {     application.navWindow  =  $.navWindow;   }
  • 66. Extending Each Platform BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 67. Extending NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT var  device  =  AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);   flashlight.on  =  function()  {     this._checkAvailability();     device.lockForConfiguration(null);     device.torchMode  =  AVCaptureTorchMode.AVCaptureTorchModeOn;     device.flashMode  =  AVCaptureFlashMode.AVCaptureFlashModeOn;     device.unlockForConfiguration();   }; Source: https://github.com/tjvantoll/nativescript-flashlight
  • 68. Extending React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT var  React  =  require('react-­‐native');   var  {  NativeModules  }  =  React;   var  {  RNControlFlashlight  }  =  NativeModules;   RNControlFlashlight.turnFlashlight("flashlightOn",  function   errorCallback(results)  {            console.log('JS  Error:  '  +  results['errMsg']);     },  function  successCallback(results)  {            console.log('JS  Success:  '  +  results['successMsg']);     }   ); Source: https://github.com/rhaker/react-native-control-flashlight-ios
  • 69. Extending Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT -­‐(void)turnFlashLightOn:(id)args   {          if  ([device  hasTorch])  {                  [device  lockForConfiguration:nil];                  [device  setTorchMode:AVCaptureTorchModeOn];                    [device  unlockForConfiguration];          }   }   var  NappFlashLight  =  require('NappFlashLight');   NappFlashLight.turnFlashLightOn()   Source: https://github.com/viezel/NappFlashLight
  • 70. Pros & Cons BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
  • 71. Pros & CONS NativeScript BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT ‣ Best Feature: Direct API access Pros Cons Direct API Access No JS Encryption Excellent Support and Response Time to Tickets Very Young Open Source You really need to know typeScript Cross-platform UI abstractions Limited Cross-platform UI abstractions Difficult Documentation
  • 72. Pros & CONS React Native BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT ‣ Best Feature: Live Reload Pros Cons Live Reload / No compile Time No JS Encryption Growing Community Very Young Completely Open Source ES6 Fluency is almost required Expressive Markup React Methodology Learning Curve Component Modularity Limited Cross-platform Apis Modules Required for Native API access
  • 73. Pros & CONS Titanium BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT ‣ Best Feature: Maturity Pros Cons JS Source EnCryption Technical Debt very Mature Platform OSS version is behind Largest Community Modules Required for Native API access Extensive API docs Compile Time Extensive Cross-platform APIs