SlideShare a Scribd company logo
React Native
navigation
Contents
1. Introduction
2. Building first scenes
3. Navigation/Swiping
4. Performance/Animations
5. Sockets/Push notifications/Building application/Send to market
6. ?
What has been
changed since
previous lecture?
VirtualizedList
Scroll loading (onEndReached).
Pull to refresh (onRefresh / refreshing).
Horizontal mode (horizontal).
Intelligent item and section separators. (sticky items are buggy)
scrollToEnd, scrollToIndex, and scrollToItem
Flat List
<FlatList
data={[{title: 'Title Text', key: 'item1'}, ...]}
renderItem={({item}) => <ListItem title={item.title} />}
/>
SectionList
<SectionList
renderItem={({item}) => <ListItem title={item.title}}
renderSectionHeader={({section}) =>
<H1 title={section.key} />}
sections={[ // homogenous rendering between sections
{data: [...], key: ...},
{data: [...], key: ...},
{data: [...], key: ...},
]}
/>
Heterogeneous
<SectionList
sections={[ // heterogeneous rendering between sections
{data: [...], key: ..., renderItem: ...},
{data: [...], key: ..., renderItem: ...},
{data: [...], key: ..., renderItem: ...},
]}
/>
Caveats
Internal state is not preserved
In order to constrain memory and enable smooth scrolling, content is
rendered asynchronously offscreen.
By default, the list looks for a key prop on each item and uses that for the
React key
Project
structure
React + Redux
1.Component
2.Actions
3.Reducers
4.Store
General structure
Entry point
Router
Component
Component Actions
Store
Reducers
General structure
Entry point
Router
Component
Component Actions
Store
Reducers
Academy PRO: React native - navigation
index.android[ios].js
General structure
Entry point
Router
Component
Component Actions
Store
Reducers
Academy PRO: React native - navigation
Router
General structure
Entry point
Router
Component
Component Actions
Store
Reducers
Academy PRO: React native - navigation
Component
General structure
Entry point
Router
Component
Component Actions
Store
Reducers
Academy PRO: React native - navigation
Action creator
General structure
Entry point
Router
Component
Component Actions
Store
Reducers
Academy PRO: React native - navigation
Academy PRO: React native - navigation
General structure
Entry point
Router
Component
Component Actions
Store
Reducers
Academy PRO: React native - navigation
Store
Project structure
Micro intro to
Animations
API
1. Animated API
2. LayoutAnimation
What’s cool?
1. Non-blocking UI
2. Uses native driver
3. Old
What’s bad?
1. Not all things are a animated using driver (flex, position)
LayoutAnimation
1. Globally configured animations
2. Less control than Animated API
Navigation
Navigation
1. Native-navigation (https://github.com/airbnb/native-navigation/) [1200+]
2. React-Native-Redux-Router (https://github.com/aksonov/react-native-redux-
router) [~350]
3. React-Native-Router-Flux (https://github.com/aksonov/react-native-router-
flux) [~4000]
4. React-Native-Navigation (https://github.com/wix/react-native-navigation/)
[~2500]
5. Navigator API (https://facebook.github.io/react-native/docs/navigator.html)
6. React Navigation (https://github.com/react-community/react-navigation)
Includes
1. Routing
2. Drawer
3. Tabs
4. Navigation bar
Navigator API
Navigator API
Navigation Bar
Drawer
Actions
Pros
1. Quick
2. Old
3. Native drawer, easy to start
Cons
1. Old (before animated library)
2. Messy
3. Does not feel native (bad designed)
iOSNavigator
1. Looks native
2. Wrapper around native code
3. Fast and optimised
4. Old
NavigationExperimental (2016)
1. Uses Animated library
2. That’s all
Used in:
1. React-native-router-flux
2. Ex-navigation
3. react-router-native
Cons
1. Only views
2. Requires a lot of boilerplates
3. Will be deprecated
React Navigation
(community edition)
What’s cool?
1. Really fast
2. Supported by community
3. EEEEEAAASSSSSYYY
4. Native look-like components (Drawer, Tabs)
Router
Actions
const { navigate } = this.props.navigation;
<TouchableOpacity style={styles.row} onPress={() => {
navigate('KeyResult', {data: item}); }}>
Drawer
static navigationOptions = {
drawer: () => ({
label: 'Home'
}),
title:'Objectives',
header: ({ state, setParams, navigate }) => ({
// Render a button on the right side of the header
// When pressed switches the screen to edit mode.
left: (
<TouchableOpacity onPress={() => navigate('DrawerOpen') }>
<Image
source={require('../resources/ic_menu_white_24dp.png')}
style={[styles.icon, {tintColor: '#333'}]}
/>
</TouchableOpacity>
),
}),
}
React Native Redux Router
React native redux router
<Router>
<Schema name="modal" sceneConfig={Animations.FlatFloatFromBottom} navBar={NavBarModal}/>
<Schema name="default" sceneConfig={Animations.FlatFloatFromRight} navBar={NavBar}/>
<Schema name="withoutAnimation" navBar={NavBar}/>
<Schema name="tab" navBar={NavBar}/>
<Route name="launch" component={Launch} initial={true} hideNavBar={true} title="Launch"/>
<Route name="register" component={Register} title="Register"/>
<Route name="home" component={Home} title="Home" type="replace"/>
<Route name="login" component={Login} schema="modal"/>
<Route name="register2" component={Register} schema="withoutAnimation"/>
<Route name="error" component={Error} schema="popup"/>
</Router>
Actions
<Button onPress={Actions.register}>Go to Register page</Button>
<Button onPress={Actions.register2}>Go to Register page without
animation</Button>
<Button onPress={()=>Actions.error("Error message")}>Go to Error
page</Button>
React Native Router Flux
React Native Router Flux
1. Rely on NavigationExperimental (fork)
2. Drawer and tabs components
Router
<Scene
key="tab1"
title="Tab #1"
icon={TabIcon}
navigationBarStyle={{ backgroundColor: 'white' }}
titleStyle={{ color: 'white' }}
initial
>
<Scene
key="tab1_1"
component={Objectives}
title="Tab #1_1"
onRight={() => alert('Right button')}
rightTitle="Right"
/>
<Scene
key="tab1_2"
component={KeyResult}
title="Tab #1_2"
/>
</Scene>
Calling actions
<Button onPress={Actions.pop} title='Back'></Button>
<Button onPress={() => { drawer.close(); Actions.tab1(); }} title='Switch to tab1'></Button>
<Button onPress={() => { drawer.close(); Actions.tab2(); }} title='Switch to tab2'></Button>
<Button onPress={() => { drawer.close(); Actions.tab3(); }} title='Switch to tab3'></Button>
<Button onPress={() => { drawer.close(); Actions.tab4(); }} title='Switch to tab4'></Button>
<Button onPress={() => { drawer.close(); Actions.tab5(); }} title='Switch to tab5'></Button>
<Button onPress={() => { drawer.close(); Actions.echo(); }} title='push new scene'></Button>
{props.name === 'tab1_1' &&
<Button onPress={Actions.tab1_2}>next screen for tab1_1</Button>
}
Cons
1. Slow
2. Difficult to customize
3. Not good for production
React Native Navigation
However
Pros
1. Airbnb
Cons
1. Raw
2. V0.1
3. Not documented
Questions?
Sources
https://bitbucket.org/RusinkaBogdan/react-routing
Thanks!

More Related Content

PPTX
Academy PRO: React native - building first scenes
PPTX
Academy PRO: React native - miscellaneous
PPTX
Academy PRO: React native - publish
PDF
Sane Async Patterns
PDF
Workshop 17: EmberJS parte II
PPT
Creating the interfaces of the future with the APIs of today
PPTX
IndexedDB - Querying and Performance
PDF
Workshop 25: React Native - Components
Academy PRO: React native - building first scenes
Academy PRO: React native - miscellaneous
Academy PRO: React native - publish
Sane Async Patterns
Workshop 17: EmberJS parte II
Creating the interfaces of the future with the APIs of today
IndexedDB - Querying and Performance
Workshop 25: React Native - Components

What's hot (20)

PDF
Workshop 27: Isomorphic web apps with ReactJS
PDF
Workshop 26: React Native - The Native Side
PDF
Workshop 13: AngularJS Parte II
PDF
Workshop 24: React Native Introduction
PDF
Workshop 8: Templating: Handlebars, DustJS
PDF
Workshop 14: AngularJS Parte III
PDF
Workshop 12: AngularJS Parte I
PDF
Introducing Rendr: Run your Backbone.js apps on the client and server
PDF
Building scalable applications with angular js
PPTX
How to Build SPA with Vue Router 2.0
ODP
Session 2- day 3
PDF
Workshop 19: ReactJS Introduction
PDF
Angular 2 Component Communication - Talk by Rob McDiarmid
PDF
Workshop 3: JavaScript build tools
PDF
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and more
PDF
Using Renderless Components in Vue.js during your software development.
PDF
How to build to do app using vue composition api and vuex 4 with typescript
PPTX
Angular 2.0 Dependency injection
PDF
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
PDF
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...
Workshop 27: Isomorphic web apps with ReactJS
Workshop 26: React Native - The Native Side
Workshop 13: AngularJS Parte II
Workshop 24: React Native Introduction
Workshop 8: Templating: Handlebars, DustJS
Workshop 14: AngularJS Parte III
Workshop 12: AngularJS Parte I
Introducing Rendr: Run your Backbone.js apps on the client and server
Building scalable applications with angular js
How to Build SPA with Vue Router 2.0
Session 2- day 3
Workshop 19: ReactJS Introduction
Angular 2 Component Communication - Talk by Rob McDiarmid
Workshop 3: JavaScript build tools
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and more
Using Renderless Components in Vue.js during your software development.
How to build to do app using vue composition api and vuex 4 with typescript
Angular 2.0 Dependency injection
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...
Ad

Similar to Academy PRO: React native - navigation (20)

PPTX
Android 3
PDF
Connect.js - Exploring React.Native
PPTX
What's New in Android
PDF
Road to react hooks
PDF
Single Page Applications in Angular (italiano)
PPTX
Angular.js Directives for Interactive Web Applications
PDF
How to React Native
PPT
Headless drupal + react js Oleksandr Linyvyi
PPTX
Big Data for each one of us
PDF
React Native: JS MVC Meetup #15
PPTX
Adding powerful ext js components to react apps
PDF
Design for succcess with react and storybook.js
PPTX
Silverlight week2
PDF
ReactJS
PDF
Alpine.js: the outsider Javascript framework
PDF
Lean React - Patterns for High Performance [ploneconf2017]
PDF
jQuery in the [Aol.] Enterprise
PDF
Adopting 3D Touch in your apps
PPTX
JS Fest 2018. Илья Иванов. Введение в React-Native
PDF
React table tutorial project setup, use table, and usefilter
Android 3
Connect.js - Exploring React.Native
What's New in Android
Road to react hooks
Single Page Applications in Angular (italiano)
Angular.js Directives for Interactive Web Applications
How to React Native
Headless drupal + react js Oleksandr Linyvyi
Big Data for each one of us
React Native: JS MVC Meetup #15
Adding powerful ext js components to react apps
Design for succcess with react and storybook.js
Silverlight week2
ReactJS
Alpine.js: the outsider Javascript framework
Lean React - Patterns for High Performance [ploneconf2017]
jQuery in the [Aol.] Enterprise
Adopting 3D Touch in your apps
JS Fest 2018. Илья Иванов. Введение в React-Native
React table tutorial project setup, use table, and usefilter
Ad

More from Binary Studio (20)

PPTX
Academy PRO: D3, part 3
PPTX
Academy PRO: D3, part 1
PPTX
Academy PRO: Cryptography 3
PPTX
Academy PRO: Cryptography 1
PPTX
Academy PRO: Advanced React Ecosystem. MobX
PPTX
Academy PRO: Docker. Part 4
PPTX
Academy PRO: Docker. Part 2
PPTX
Academy PRO: Docker. Part 1
PPTX
Binary Studio Academy 2017: JS team project - Orderly
PPTX
Binary Studio Academy 2017: .NET team project - Unicorn
PPTX
Academy PRO: React Native - introduction
PPTX
Academy PRO: Push notifications. Denis Beketsky
PPTX
Academy PRO: Docker. Lecture 4
PPTX
Academy PRO: Docker. Lecture 3
PPTX
Academy PRO: Docker. Lecture 2
PPTX
Academy PRO: Docker. Lecture 1
PPTX
Academy PRO: Node.js - miscellaneous. Lecture 5
PPTX
Academy PRO: Node.js in production. lecture 4
PPTX
Academy PRO: Node.js alternative stacks. Lecture 3
PPTX
Academy PRO: Node.js default stack. Lecture 2
Academy PRO: D3, part 3
Academy PRO: D3, part 1
Academy PRO: Cryptography 3
Academy PRO: Cryptography 1
Academy PRO: Advanced React Ecosystem. MobX
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 1
Binary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: .NET team project - Unicorn
Academy PRO: React Native - introduction
Academy PRO: Push notifications. Denis Beketsky
Academy PRO: Docker. Lecture 4
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 1
Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js in production. lecture 4
Academy PRO: Node.js alternative stacks. Lecture 3
Academy PRO: Node.js default stack. Lecture 2

Recently uploaded (20)

PPTX
Spectroscopy.pptx food analysis technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Tartificialntelligence_presentation.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Spectroscopy.pptx food analysis technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars
Per capita expenditure prediction using model stacking based on satellite ima...
Univ-Connecticut-ChatGPT-Presentaion.pdf
A comparative study of natural language inference in Swahili using monolingua...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
A Presentation on Artificial Intelligence
Building Integrated photovoltaic BIPV_UPV.pdf
Network Security Unit 5.pdf for BCA BBA.
Group 1 Presentation -Planning and Decision Making .pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Heart disease approach using modified random forest and particle swarm optimi...
TLE Review Electricity (Electricity).pptx
Approach and Philosophy of On baking technology
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Tartificialntelligence_presentation.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...

Academy PRO: React native - navigation