SlideShare a Scribd company logo
Panagiotis Vourtsis
Front-End Developer @orfium
AN EMOJI INTRO
TO REACT NATIVE
#RNISAWESOME
WHAT I WILL TRY TO COVER
▸ What is RN anyway?
▸ RN API
▸ Examples
▸ Daily tools
▸ Native Modules
▸ Other alternatives
VUE
REACT
ANGULAR
BACKBONE METEOR.JS
EMBER.JS
POLYMER
MITHRIL
FIRST THOUGHTS
#RNISAWESOME
NATIVE APPS ? REALLY ??
▸ Faster
▸ Responsive
▸ Complex gestures
▸ Mobile functionalities usage
▸ Different market for users
but how to stay up with the scale etc?
WHAT IS RN ANYWAY?
#RNISAWESOME
REACT AND REACT NATIVE
ReactJS is a JavaScript library where you can use it to build user
interfaces for the web either standalone or being served from a
server.
What you will need?
‣ A bundler - Webpack setup
‣ Testing environment
‣ jest maybe
‣ enzyme maybe
‣ …etc
#RNISAWESOME
REACT AND REACT NATIVE
React Native is a mobile framework that uses ReactJS and compiles
to native app components.
This way it allowing you to build native mobile applications for
different platforms (iOS, Android, and Windows Mobile) in
JavaScript. In order to do so you will may need Xcode or Android
Studio
It comes out of the box with:
‣ packager (bundler) called metro
‣ jest environment for testing
‣ flow for typing
#RNISAWESOME
RN API
DIV
SPAN
IMG
VIEW
TEXT
IMAGE
TOUCHABLE OPACITY
SCROLLVIEW
…
SOME EXAMPLES
#RNISAWESOME
import React from 'react';
const Welcome = () => (
<div>
Welcome GreeceJS
</div>
);
export default Welcome;
import React from 'react';
import { Text, View } from ΄react-native΄;
const Welcome = () => (
<View>
<Text>Welcome GreeceJS </Text>
</View>
);
export default Welcome;
SIMPLE TRANSFORMATION
#RNISAWESOME
import React from 'react';
const Welcome = () => (
<div>
<span>Welcome GreeceJS </span>
<span style={{ marginTop: 100 }}>
Hey i am right here!
</span>
</div>
);
export default Welcome;
import React from 'react';
import { Text, ScrollView } from ΄react-
native΄;
const Welcome = () => (
<ScrollView>
<Text>Welcome GreeceJS </Text>
<Text style={{ marginTop: 100 }}>
Hey i am right here !!
</Text>
</ScrollView>
);
export default Welcome;
SCROLL CONTENT
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End Developer at Orfium)
#RNISAWESOME
import React from 'react';
const data = {[
{id: '11', key: 'Devin'},
{id: '12', key: 'Jackson'},
{id: '13', key: 'James'},
{id: '14', key: 'Joel'},
]}
const Rankings = () => (
<ul>
{data.map(({ key, id }) => (
<li key={id}>{key}</span>
)}
</ul>
);
export default Rankings;
import React from 'react';
import { Text, View, FlatList } from ΄react-native΄;
const Rankings = () => (
<View>
<FlatList
data={[
{id: '11', key: 'Devin'},
{id: '12', key: 'Jackson'},
{id: '13', key: ‘James'},
]}
keyExtractor={(item) => item.id}
renderItem={({ item }) => <Text>{item.key}
</Text>}
/>
</View>
);
export default Rankings;
LIST
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End Developer at Orfium)
#RNISAWESOME
{
container: {
width: 100%;
position: relative;
margin-top: 10px;
}
}
StyleSheet.create({
container: {
width: ‘100%’,
position: ‘relative’,
marginTop: 10
}
})
STYLING
Native App
MAIN THREAD
JAVASCRIPT
BRIDGE - NATIVE MODULES API
ASYNC
BATCHED
SERIALISABLE
SYNC
%Memorypercore
0
15
30
45
60
PROFILE TO DO LIST PAGE VIEW MAPS
56,02%
24,29%
44,2%
26,52%
42,34%
18%
45,73%
28,38%
Swift RN
CPU USAGE
#RNISAWESOME
DAILY TOOLS
This is the regular hot reload of react, on every change you can
see the changes on your simulator
HOT RELOADING
Reloads the app on every change
LIVE RELOAD
DEBUGGING - PERFORMANCE
Enables the debugging inspector
REMOTE JS DEBUGGING
Shows the frames per screen in order to see which screens
underperform
SHOW PERF MONITOR
#RNISAWESOME
DAILY TOOLS
RN debugging tools
‣ react-devtools (npm)
‣ react-native debugger (redux)
de-
‣ Inspect network requests like in web
‣ Redux inspect for state
‣ React profiling
#RNISAWESOME
REACT NATIVE CHALLENGES
Not very stable modules, event official ones (react-navigation)
iOS / android behave differently in some cases
Although is react doesn’t behave like a web app
Need to understand native renders differently
Keep in mind of performance when dealing with lists
Dealing with emulators vs physical devices
Error logging for production is often difficult to debug
#RNISAWESOME
REACT NATIVE PROS & CONS
✓ Hot reloading
✓ Multiple platforms
✓ Faster build for smaller apps
✓ On the fly JS Bundle
✓ Bigger pool of devs
- Lack of modules
- Native developers still needed
- Immaturity on tools
#RNISAWESOME
CURRENTLY
Facebook
FB Ads Skype Discord Pinterest
WalmartInstagramFB Analytics
TURNED AWAY
Udacity
Airbnb
REACT NATIVE APPS
WHAT IF THERE ARE NO READY
MODULES ??
NATIVE MODULES
#RNISAWESOME
MODULE PACKAGE
APPLICATION
VIEW
MANAGER
VIEW
REACT EXPOSURE
#RNISAWESOME
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MeetupPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
#RNISAWESOME
public class JSMeetupPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new JSMeetupModule(reactContext));
return modules;
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
List<ViewManager> modules = new ArrayList<>();
modules.add(new JSMeetupViewManager(reactContext));
return modules; // if we have a view else return Collections.emptyList();
}
}
#RNISAWESOME
class JSMeetupModule extends ReactContextBaseJavaModule {
private static String mPremium = "";
public JSMeetupModule(ReactApplicationContext reactContext) {
super(reactContext);
...
}
@Override
public String getName() {
return "JSMeetup";
}
   @ReactMethod
public void setPremium(String premium) {
mPremium = premium;
}
}
#RNISAWESOME
MODULE PACKAGE
APPLICATION
VIEW
MANAGER
VIEW
REACT EXPOSURE
#RNISAWESOME
class JSMeetupReactView extends Component {
setPremium(str) {
NativeModules.JSMeetup.setPremium(str);
}
render() {
return <JSMeetupView
{...this.props}
ref="JSMeetupReactView"
/>;
};
}
const JSMeetupView = requireNativeComponent(
'JSMeetupView',
JSMeetupReactView,
{
nativeOnly: { onChange: true }
}
);
module.exports = JSMeetupReactView;
#RNISAWESOME
public class JSMeetupViewManager extends SimpleViewManager<JSMeetupView> {
private JSMeetupView view;
public JSMeetupViewManager(ReactApplicationContext reactContext) {
view = new JSMeetupView(reactContext);
}
…
@ReactProp(name = "inputUrl")
public void setInputUrl(JSMeetupView view, @Nullable String inputUrl) {
view.setInputUrl(inputUrl);
}
@Override
public void receiveCommand(JSMeetupView root, int commandId, @Nullable
ReadableArray args) {
switch (commandId) {
case "blah":
root.blah();
break;
}
}
}
#RNISAWESOME
public class JSMeetupView extends AnyComponent implements LifecycleEventListener {
public JSMeetupView(ReactApplicationContext context) {
super(context);
context.addLifecycleEventListener(this);
}
public void setInputUrl(String inputUrl) {
...
}
public void blah() {
...
}
}
#RNISAWESOME
MODULE PACKAGE
APPLICATION
VIEW
MANAGER
VIEW
REACT EXPOSURE
#RNISAWESOME
class JSMeetupReactView extends Component {
setPremium(str) {
NativeModules.JSMeetup.setPremium(str);
}
setInputUrl(url) {
NativeModules.JSMeetup.setInputUrl(url);
}
blah() {
UIManager.dispatchViewManagerCommand(
findNodeHandle(this.refs.JSMeetupReactView),
UIManager.JSMeetupView.Commands.blah,
null
);
}
render() {
return <JSMeetupView
{...this.props}
ref="JSMeetupReactView"
/>;
};
}
const JSMeetupView = requireNativeComponent(
'JSMeetupView',
JSMeetupReactView,
{
nativeOnly: { onChange: true }
}
);
module.exports = JSMeetupReactView;
EXPO VS RN INIT
#RNISAWESOME
Expo is the easiest way to start building a new React Native
application. It allows to start a project without installing or
configuring any tools to build native code
#RNISAWESOME
EXPONENTRN INIT
ios/
android/
index.js
App.js
index.js
App.js
it's not possible to include custom native modules beyond the React
Native APIs and components that are available in the Expo client app
#RNISAWESOME
▸ Will I need access to the Native portion of the codebase?
▸ Will I need any third party packages in my app that are not
supported by Expo?
▸ Will my app need to play audio while it is not in the foreground?
▸ Will my app need location services while it is not in the
foreground?
▸ Will I need push notification support?
▸ Am I comfortable working in Xcode and Android Studio?
OTHER ALTERNATIVES
#RNISAWESOME
▸ Ionic
▸ Run on a “webview” with cordova - performance issues
▸ Write once run everywhere
▸ Mimic the platform’s widgets to make your application look native
▸ Angular (lately you can write with VUE as well)
▸ Xamarin
▸ a complete set of tools (diagnostics, debugging)
▸ Just in time & Ahead of time compilation = faster application
startup
▸ You need to write on C#
THANK YOU !
Panagiotis Vourtsis
Front-End Developer @orfium
#RNISAWESOME
https://www.youtube.com/watch?v=hDviGU-57lU
https://medium.com/the-react-native-log/comparing-the-performance-
between-native-ios-swift-and-react-native-7b5490d363e2
https://gist.github.com/panvourtsis/
714155aa2325b7b3b35bdb91f53fe2d3
LINKS

More Related Content

What's hot (20)

PDF
Vuejs testing
Greg TAPPERO
 
PDF
Adventures In JavaScript Testing
Thomas Fuchs
 
PDF
Angular2 & ngrx/store: Game of States
Oren Farhi
 
PDF
KISS Automation.py
Iakiv Kramarenko
 
KEY
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
KEY
Testing JS with Jasmine
Evgeny Gurin
 
PDF
Understanding JavaScript Testing
jeresig
 
PDF
Web ui tests examples with selenide, nselene, selene & capybara
Iakiv Kramarenko
 
PDF
Under the Hood: Using Spring in Grails
GR8Conf
 
PPTX
How Reactive do we need to be
Jana Karceska
 
PDF
Testing JavaScript Applications
The Rolling Scopes
 
PPTX
Angularjs Performance
Steven Lambert
 
PPSX
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JSFestUA
 
PDF
Under the Hood: Using Spring in Grails
Burt Beckwith
 
PDF
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Iakiv Kramarenko
 
PDF
Ember and containers
Matthew Beale
 
PPTX
Making React Native UI Components with Swift
Ray Deck
 
PPTX
Good karma: UX Patterns and Unit Testing in Angular with Karma
ExoLeaders.com
 
PDF
PL/SQL Unit Testing Can Be Fun!
Raimonds Simanovskis
 
PDF
Workshop 26: React Native - The Native Side
Visual Engineering
 
Vuejs testing
Greg TAPPERO
 
Adventures In JavaScript Testing
Thomas Fuchs
 
Angular2 & ngrx/store: Game of States
Oren Farhi
 
KISS Automation.py
Iakiv Kramarenko
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
Testing JS with Jasmine
Evgeny Gurin
 
Understanding JavaScript Testing
jeresig
 
Web ui tests examples with selenide, nselene, selene & capybara
Iakiv Kramarenko
 
Under the Hood: Using Spring in Grails
GR8Conf
 
How Reactive do we need to be
Jana Karceska
 
Testing JavaScript Applications
The Rolling Scopes
 
Angularjs Performance
Steven Lambert
 
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JSFestUA
 
Under the Hood: Using Spring in Grails
Burt Beckwith
 
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Iakiv Kramarenko
 
Ember and containers
Matthew Beale
 
Making React Native UI Components with Swift
Ray Deck
 
Good karma: UX Patterns and Unit Testing in Angular with Karma
ExoLeaders.com
 
PL/SQL Unit Testing Can Be Fun!
Raimonds Simanovskis
 
Workshop 26: React Native - The Native Side
Visual Engineering
 

Similar to An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End Developer at Orfium) (20)

PDF
Connect.js - Exploring React.Native
joshcjensen
 
PPTX
React native by example by Vadim Ruban
Lohika_Odessa_TechTalks
 
PDF
React Native Androidはなぜ動くのか
Yukiya Nakagawa
 
PDF
How to React Native
Dmitry Ulyanov
 
PDF
Crossing platforms with JavaScript & React
Robert DeLuca
 
PDF
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
Guy Royse
 
PDF
Having Fun with Play
Clinton Dreisbach
 
PPTX
Let's react - Meetup
RAJNISH KATHAROTIYA
 
PDF
Improving android experience for both users and developers
Pavel Lahoda
 
PDF
Droidcon2013 android experience lahoda
Droidcon Berlin
 
PPTX
React & Redux for noobs
[T]echdencias
 
PDF
Android Best Practices
Yekmer Simsek
 
PDF
React Native
Craig Jolicoeur
 
PDF
N Things You Don't Want to Repeat in React Native
Anton Kulyk
 
PDF
Reliable Javascript
Glenn Stovall
 
PDF
How To Integrate Native Android App With React Native.
Techugo
 
PPTX
Adding a modern twist to legacy web applications
Jeff Durta
 
PDF
React lecture
Christoffer Noring
 
PDF
JSAnkara Swift v React Native
Muhammed Demirci
 
PDF
End to end todo list app with NestJs - Angular - Redux & Redux Saga
Babacar NIANG
 
Connect.js - Exploring React.Native
joshcjensen
 
React native by example by Vadim Ruban
Lohika_Odessa_TechTalks
 
React Native Androidはなぜ動くのか
Yukiya Nakagawa
 
How to React Native
Dmitry Ulyanov
 
Crossing platforms with JavaScript & React
Robert DeLuca
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
Guy Royse
 
Having Fun with Play
Clinton Dreisbach
 
Let's react - Meetup
RAJNISH KATHAROTIYA
 
Improving android experience for both users and developers
Pavel Lahoda
 
Droidcon2013 android experience lahoda
Droidcon Berlin
 
React & Redux for noobs
[T]echdencias
 
Android Best Practices
Yekmer Simsek
 
React Native
Craig Jolicoeur
 
N Things You Don't Want to Repeat in React Native
Anton Kulyk
 
Reliable Javascript
Glenn Stovall
 
How To Integrate Native Android App With React Native.
Techugo
 
Adding a modern twist to legacy web applications
Jeff Durta
 
React lecture
Christoffer Noring
 
JSAnkara Swift v React Native
Muhammed Demirci
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
Babacar NIANG
 
Ad

More from GreeceJS (19)

PDF
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...
GreeceJS
 
PDF
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
GreeceJS
 
PDF
Under the hood of RxJS (Dimitris Livas) - GreeceJS #27
GreeceJS
 
PDF
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
GreeceJS
 
PDF
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
GreeceJS
 
PDF
TypeScript: JavaScript that scales (Kostas Stergiou) - GreeceJS #22
GreeceJS
 
PDF
Migrating from Monolithic to Serverless (Kostas Katsikas) - GreeceJS #22
GreeceJS
 
PDF
Taming forms with React
GreeceJS
 
PDF
The JavaScript toolset for development on Ethereum
GreeceJS
 
PDF
Modern web development and accessibility (Christina Papadimitriou, Nadia Mark...
GreeceJS
 
PDF
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
GreeceJS
 
PDF
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
GreeceJS
 
PPTX
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
GreeceJS
 
PPTX
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
GreeceJS
 
PDF
The case for HTTP/2
GreeceJS
 
PDF
GraphQL vs REST
GreeceJS
 
PPTX
Ellak JavaScript Day
GreeceJS
 
PPTX
The history of asynchronous JavaScript
GreeceJS
 
PDF
The tools & technologies behind Resin.io
GreeceJS
 
Introduction to react-query. A Redux alternative? (Nikos Kleidis, Front End D...
GreeceJS
 
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
GreeceJS
 
Under the hood of RxJS (Dimitris Livas) - GreeceJS #27
GreeceJS
 
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
GreeceJS
 
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
GreeceJS
 
TypeScript: JavaScript that scales (Kostas Stergiou) - GreeceJS #22
GreeceJS
 
Migrating from Monolithic to Serverless (Kostas Katsikas) - GreeceJS #22
GreeceJS
 
Taming forms with React
GreeceJS
 
The JavaScript toolset for development on Ethereum
GreeceJS
 
Modern web development and accessibility (Christina Papadimitriou, Nadia Mark...
GreeceJS
 
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
GreeceJS
 
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
GreeceJS
 
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
GreeceJS
 
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
GreeceJS
 
The case for HTTP/2
GreeceJS
 
GraphQL vs REST
GreeceJS
 
Ellak JavaScript Day
GreeceJS
 
The history of asynchronous JavaScript
GreeceJS
 
The tools & technologies behind Resin.io
GreeceJS
 
Ad

Recently uploaded (20)

PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
The Future of Artificial Intelligence (AI)
Mukul
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 

An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End Developer at Orfium)

  • 1. Panagiotis Vourtsis Front-End Developer @orfium AN EMOJI INTRO TO REACT NATIVE
  • 2. #RNISAWESOME WHAT I WILL TRY TO COVER ▸ What is RN anyway? ▸ RN API ▸ Examples ▸ Daily tools ▸ Native Modules ▸ Other alternatives
  • 5. #RNISAWESOME NATIVE APPS ? REALLY ?? ▸ Faster ▸ Responsive ▸ Complex gestures ▸ Mobile functionalities usage ▸ Different market for users but how to stay up with the scale etc?
  • 6. WHAT IS RN ANYWAY?
  • 7. #RNISAWESOME REACT AND REACT NATIVE ReactJS is a JavaScript library where you can use it to build user interfaces for the web either standalone or being served from a server. What you will need? ‣ A bundler - Webpack setup ‣ Testing environment ‣ jest maybe ‣ enzyme maybe ‣ …etc
  • 8. #RNISAWESOME REACT AND REACT NATIVE React Native is a mobile framework that uses ReactJS and compiles to native app components. This way it allowing you to build native mobile applications for different platforms (iOS, Android, and Windows Mobile) in JavaScript. In order to do so you will may need Xcode or Android Studio It comes out of the box with: ‣ packager (bundler) called metro ‣ jest environment for testing ‣ flow for typing
  • 11. #RNISAWESOME import React from 'react'; const Welcome = () => ( <div> Welcome GreeceJS </div> ); export default Welcome; import React from 'react'; import { Text, View } from ΄react-native΄; const Welcome = () => ( <View> <Text>Welcome GreeceJS </Text> </View> ); export default Welcome; SIMPLE TRANSFORMATION
  • 12. #RNISAWESOME import React from 'react'; const Welcome = () => ( <div> <span>Welcome GreeceJS </span> <span style={{ marginTop: 100 }}> Hey i am right here! </span> </div> ); export default Welcome; import React from 'react'; import { Text, ScrollView } from ΄react- native΄; const Welcome = () => ( <ScrollView> <Text>Welcome GreeceJS </Text> <Text style={{ marginTop: 100 }}> Hey i am right here !! </Text> </ScrollView> ); export default Welcome; SCROLL CONTENT
  • 14. #RNISAWESOME import React from 'react'; const data = {[ {id: '11', key: 'Devin'}, {id: '12', key: 'Jackson'}, {id: '13', key: 'James'}, {id: '14', key: 'Joel'}, ]} const Rankings = () => ( <ul> {data.map(({ key, id }) => ( <li key={id}>{key}</span> )} </ul> ); export default Rankings; import React from 'react'; import { Text, View, FlatList } from ΄react-native΄; const Rankings = () => ( <View> <FlatList data={[ {id: '11', key: 'Devin'}, {id: '12', key: 'Jackson'}, {id: '13', key: ‘James'}, ]} keyExtractor={(item) => item.id} renderItem={({ item }) => <Text>{item.key} </Text>} /> </View> ); export default Rankings; LIST
  • 16. #RNISAWESOME { container: { width: 100%; position: relative; margin-top: 10px; } } StyleSheet.create({ container: { width: ‘100%’, position: ‘relative’, marginTop: 10 } }) STYLING
  • 17. Native App MAIN THREAD JAVASCRIPT BRIDGE - NATIVE MODULES API ASYNC BATCHED SERIALISABLE SYNC
  • 18. %Memorypercore 0 15 30 45 60 PROFILE TO DO LIST PAGE VIEW MAPS 56,02% 24,29% 44,2% 26,52% 42,34% 18% 45,73% 28,38% Swift RN CPU USAGE
  • 19. #RNISAWESOME DAILY TOOLS This is the regular hot reload of react, on every change you can see the changes on your simulator HOT RELOADING Reloads the app on every change LIVE RELOAD DEBUGGING - PERFORMANCE Enables the debugging inspector REMOTE JS DEBUGGING Shows the frames per screen in order to see which screens underperform SHOW PERF MONITOR
  • 20. #RNISAWESOME DAILY TOOLS RN debugging tools ‣ react-devtools (npm) ‣ react-native debugger (redux) de- ‣ Inspect network requests like in web ‣ Redux inspect for state ‣ React profiling
  • 21. #RNISAWESOME REACT NATIVE CHALLENGES Not very stable modules, event official ones (react-navigation) iOS / android behave differently in some cases Although is react doesn’t behave like a web app Need to understand native renders differently Keep in mind of performance when dealing with lists Dealing with emulators vs physical devices Error logging for production is often difficult to debug
  • 22. #RNISAWESOME REACT NATIVE PROS & CONS ✓ Hot reloading ✓ Multiple platforms ✓ Faster build for smaller apps ✓ On the fly JS Bundle ✓ Bigger pool of devs - Lack of modules - Native developers still needed - Immaturity on tools
  • 23. #RNISAWESOME CURRENTLY Facebook FB Ads Skype Discord Pinterest WalmartInstagramFB Analytics TURNED AWAY Udacity Airbnb REACT NATIVE APPS
  • 24. WHAT IF THERE ARE NO READY MODULES ??
  • 27. #RNISAWESOME public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new MeetupPackage() ); } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } }
  • 28. #RNISAWESOME public class JSMeetupPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { List<NativeModule> modules = new ArrayList<>(); modules.add(new JSMeetupModule(reactContext)); return modules; } @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { List<ViewManager> modules = new ArrayList<>(); modules.add(new JSMeetupViewManager(reactContext)); return modules; // if we have a view else return Collections.emptyList(); } }
  • 29. #RNISAWESOME class JSMeetupModule extends ReactContextBaseJavaModule { private static String mPremium = ""; public JSMeetupModule(ReactApplicationContext reactContext) { super(reactContext); ... } @Override public String getName() { return "JSMeetup"; }    @ReactMethod public void setPremium(String premium) { mPremium = premium; } }
  • 31. #RNISAWESOME class JSMeetupReactView extends Component { setPremium(str) { NativeModules.JSMeetup.setPremium(str); } render() { return <JSMeetupView {...this.props} ref="JSMeetupReactView" />; }; } const JSMeetupView = requireNativeComponent( 'JSMeetupView', JSMeetupReactView, { nativeOnly: { onChange: true } } ); module.exports = JSMeetupReactView;
  • 32. #RNISAWESOME public class JSMeetupViewManager extends SimpleViewManager<JSMeetupView> { private JSMeetupView view; public JSMeetupViewManager(ReactApplicationContext reactContext) { view = new JSMeetupView(reactContext); } … @ReactProp(name = "inputUrl") public void setInputUrl(JSMeetupView view, @Nullable String inputUrl) { view.setInputUrl(inputUrl); } @Override public void receiveCommand(JSMeetupView root, int commandId, @Nullable ReadableArray args) { switch (commandId) { case "blah": root.blah(); break; } } }
  • 33. #RNISAWESOME public class JSMeetupView extends AnyComponent implements LifecycleEventListener { public JSMeetupView(ReactApplicationContext context) { super(context); context.addLifecycleEventListener(this); } public void setInputUrl(String inputUrl) { ... } public void blah() { ... } }
  • 35. #RNISAWESOME class JSMeetupReactView extends Component { setPremium(str) { NativeModules.JSMeetup.setPremium(str); } setInputUrl(url) { NativeModules.JSMeetup.setInputUrl(url); } blah() { UIManager.dispatchViewManagerCommand( findNodeHandle(this.refs.JSMeetupReactView), UIManager.JSMeetupView.Commands.blah, null ); } render() { return <JSMeetupView {...this.props} ref="JSMeetupReactView" />; }; } const JSMeetupView = requireNativeComponent( 'JSMeetupView', JSMeetupReactView, { nativeOnly: { onChange: true } } ); module.exports = JSMeetupReactView;
  • 36. EXPO VS RN INIT
  • 37. #RNISAWESOME Expo is the easiest way to start building a new React Native application. It allows to start a project without installing or configuring any tools to build native code
  • 38. #RNISAWESOME EXPONENTRN INIT ios/ android/ index.js App.js index.js App.js it's not possible to include custom native modules beyond the React Native APIs and components that are available in the Expo client app
  • 39. #RNISAWESOME ▸ Will I need access to the Native portion of the codebase? ▸ Will I need any third party packages in my app that are not supported by Expo? ▸ Will my app need to play audio while it is not in the foreground? ▸ Will my app need location services while it is not in the foreground? ▸ Will I need push notification support? ▸ Am I comfortable working in Xcode and Android Studio?
  • 41. #RNISAWESOME ▸ Ionic ▸ Run on a “webview” with cordova - performance issues ▸ Write once run everywhere ▸ Mimic the platform’s widgets to make your application look native ▸ Angular (lately you can write with VUE as well) ▸ Xamarin ▸ a complete set of tools (diagnostics, debugging) ▸ Just in time & Ahead of time compilation = faster application startup ▸ You need to write on C#
  • 42. THANK YOU ! Panagiotis Vourtsis Front-End Developer @orfium #RNISAWESOME https://www.youtube.com/watch?v=hDviGU-57lU https://medium.com/the-react-native-log/comparing-the-performance- between-native-ios-swift-and-react-native-7b5490d363e2 https://gist.github.com/panvourtsis/ 714155aa2325b7b3b35bdb91f53fe2d3 LINKS