SlideShare a Scribd company logo
Kobkrit Viriyayudhakorn, Ph.D.
CEO of iApp Technology Limited.
kobkrit@gmail.com
http://www.kobkrit.com
Thai Travel Directory App
React-Native-Maps
• https://github.com/airbnb/react-
native-maps
• React Native Map Components
for iOS + Android
• Made by Airbnb
• iOS => Choose either
• Google Map
• Apple Map
• Android => Only Google Map
Installation
1. $ react-native init --version=ā€œ0.35.0ā€ l9_map
2. $ npm install react-native-maps --save
3. $ react-native link
4. Write some code
5. $ react-native run-ios
6. For Android, we have extra steps.
Android Installation Extra
Steps.
1. Google Map need an API key
2. You can get your own at https://
console.developers.google.com or using my API
key. >> 

AIzaSyCKspSGmpYn3GxZfIc_Sccu7x-8qXQcZkI
3. Add the Google Map’s API key at
androidappsrcmainAndroidManifest.xml
4. $ react-native run-android
Adding Google API key
Add meta-data tag as shown below, between <application>
tag in AndroidManifest.xml
Adding Basic Map Code
l9_map_1
You can see full l9_map_1 source code at the end of lecture note (A4)
First try!
1. $ react-native run-ios
2. Empty screen come up!?
why!?
3. Map need the width,
height. Can not use flex:1
here… :(
l9_map_1
Adding Width,Height to Map
l9_map_2Full l9_map_2 source code at the end of lecture note
• Dimensions return current screen’s 

width and height.
• Dimensions.get(ā€˜windows’).width
• Dimensions.get(ā€˜windows’).height
• Thus, the map will be full screen.
1. Welcome to San Francisco, the
home of tech companies in the world.
2. At the center point of the screen is
<37.78825, -122.4324>
3. The zoom of the map is specify by
*Delta.
4. At the Equator

1 LatitudeDelta => 110.57 KM

1 LongitudeDelta => 111.32 KM
0.0922 latDelta
0.0421 longDelta
(37.78825, -122.4324)
l9_map_2
Make it controllable by State
l9_map_3
Instead of, the fixed regions, we make it as a state.
Make it controllable by State #2
l9_map_3
• onRegionChange props will be called when the location/zoom
are changed, with the value of new location/zoom (region)
• Region props defined the current location/zoom in the map.
1. Drag on map view to move
the map.
2. Once drag, this.state.region
was updated by
onRegionChanged().
3. Text at the lower third of the
screen is updated according
to the this.state.region
4.Try two fingers pinch, to
zoom, to rotate the map. In
simulator, press alt(option)
button to two fingers pinch.
l9_map_3
Configure the MapView
And much more..
https://github.com/airbnb/react-native-maps/blob/master/docs/mapview.md
MapEvents are also catchable
And much more..
https://github.com/airbnb/react-native-maps/blob/master/docs/mapview.md
Let configure some MapView
l9_map_4
Let’s change the mapType
mapType=ā€œhybridā€ mapType=ā€œsatelliteā€ mapType=ā€œterrainā€
l9_map_4
Android only
Adding Map Markerl9_map_5
Let move the location to the Victory
Monument, Bangkok, Thailand.
MapView.Marker
coordinate => LatLng Object of that
marker
title => Title of Information popup

description => Description of popup
1. MapView.Marker creates a red-
pin marker on the map (for Apple
map), and droplet shape pin on
Google map. Place it as children
of the MapView.
2.Touch the pin to show up the
popup windows, touch elsewhere
to hide it.
3. The map is draggable.
4.You can add many markers you
want.
Google Map
Apple Map l9_map_5
Add More Markers!
l9_map_6
l9_map_6
Don’t forget to add ā€œkeyā€
We found that there are warnings below…
It will occur every time, when we use JSX under loop.

To remove it, Add key props. 

To distinguish each MapView.Marker

from others.
l9_map_6
Adding custom images to
markers
images/shopping.png images/music.png images/attention.png
W=56px / H=56px / Transparent Background
l9_map_7
Adding custom images to
markers l9_map_7
• Load image into state,
and display it on map
using ā€œimageā€ prop.
• Image shall be around

56px X 56px
l9_map_7
Nah,.. Change my mind

I want custom view to represent

markers instead… l9_map_8
Place Name
Normal Picture Group of View
Marker as Custom View
• Add View as the children of MapView.Marker
l9_map_8
l9_map_8
That such a boring 

Popup… I want to have 

a photo in it. (Custom Popup)
l9_map_9
Custom Popup
• Add MapView.Callout as the children of the MapView.Marker
l9_map_9
l9_map_9
Drawing Circle on Map
…
https://github.com/airbnb/react-native-maps/blob/master/docs/circle.md l9_map_10
Drawing Polyline on Map
…
https://github.com/airbnb/react-native-maps/blob/master/docs/polyline.md l9_map_10
Drawing Polygon on Map
…
https://github.com/airbnb/react-native-maps/blob/master/docs/polygon.md l9_map_10
Drawing Something on Map
(Code) l9_map_10
[React-Native Tutorial] Map
Travel Directory App
• Center map at the Victory
Monument
• Map can be moved.
• Tap on icon, show Title and
Description
• Push buttons to move the map
to that specific location and
zoom in and open the call out.
• Starting to modify the app from
l9_map_7
App Requirements
l9_map_travel
moveMapToLocation method
Once called,
moveMaptoLocation
method change the
state of region to
assigned latlng, and
zoom in by setting

latitudeDelta, and
longitudeDelta
l9_map_travel
Location Button Component
l9_map_travel_locationButton
Tap!
l9_map_travel
Tap!
l9_map_travel
Tap!
l9_map_travel
Tap!
l9_map_travel
The Change is so sudden!
• I want to make it smoothly animate to the new location!
• MapView have a method for that called ā€œanimateToRegionā€
• They accept 2 arguments, i.e., Region to move to, and, How long
does the animation will need (in ms).
l9_map_travel_smooth
How to reference to the
MapView (Ref)
• How we can reference to our UI in react?
• Luckily, we have Ref System!
• We can have ref props in any component, e.g., 

<MapView ref=ā€œmapā€ … >
• We can reference to the MapView Component by
accessing this.ref.map
l9_map_travel_smooth
l9_map_travel_smooth
• We move to the new location as specified in latlng.
• And zoom in,
• smoothly in 3 seconds (3000 ms)
Smoothly Move Map

Demo
l9_map_travel_smooth
HW: How to automatically open
call out when pressing a button?
• There is a method call ā€œshowCallout()ā€ in MapView.Marker
• Use Ref!
• This is your homework!
https://github.com/airbnb/react-native-maps/blob/master/docs/marker.md
Q/A

More Related Content

PDF
MonotaROćŒå‘ć‹ć†ć‚Æćƒ©ć‚¦ćƒ‰ę“»ē”Øć®ä»Šå¾Œ 2016-04-21 é–¢č„æć‚¹ć‚æćƒ¼ćƒˆć‚¢ćƒƒćƒ—AWS勉強会
ę Ŗå¼ä¼šē¤¾MonotaRO Tech Team
Ā 
PPTX
Azure AD ć®ę–°ć—ć„ćƒ‡ćƒć‚¤ć‚¹ē®”ē†ćƒ‘ć‚æćƒ¼ćƒ³ć‚’ē†č§£ć—ć‚ˆć†
Yusuke Kodama
Ā 
PDF
Ninja Testing at Toteka03
Nakajima Shigeru
Ā 
PDF
PWA Beginners 勉強会 #4 A2HSのごょっと深い話v2
Masahiko Jinno
Ā 
PDF
会社にGitHub Enterpriseć‚’å°Žå…„ć—ć¦ćæćŸč©±
Shuji Yamada
Ā 
PDF
ćƒ•ćƒŖćƒ¼ć§ć§ćć‚‹ć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£ćƒć‚§ćƒƒć‚Æ OpenVAS CLIē·Ø
abend_cve_9999_0001
Ā 
PPTX
Microsoft Endpoint Configuration Manager ꦂ要
Yutaro Tamai
Ā 
PPTX
TeamséƒØē½²ć«ę ¹ä»˜ćć¾ć§
SoshiYoshida
Ā 
MonotaROćŒå‘ć‹ć†ć‚Æćƒ©ć‚¦ćƒ‰ę“»ē”Øć®ä»Šå¾Œ 2016-04-21 é–¢č„æć‚¹ć‚æćƒ¼ćƒˆć‚¢ćƒƒćƒ—AWS勉強会
ę Ŗå¼ä¼šē¤¾MonotaRO Tech Team
Ā 
Azure AD ć®ę–°ć—ć„ćƒ‡ćƒć‚¤ć‚¹ē®”ē†ćƒ‘ć‚æćƒ¼ćƒ³ć‚’ē†č§£ć—ć‚ˆć†
Yusuke Kodama
Ā 
Ninja Testing at Toteka03
Nakajima Shigeru
Ā 
PWA Beginners 勉強会 #4 A2HSのごょっと深い話v2
Masahiko Jinno
Ā 
会社にGitHub Enterpriseć‚’å°Žå…„ć—ć¦ćæćŸč©±
Shuji Yamada
Ā 
ćƒ•ćƒŖćƒ¼ć§ć§ćć‚‹ć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£ćƒć‚§ćƒƒć‚Æ OpenVAS CLIē·Ø
abend_cve_9999_0001
Ā 
Microsoft Endpoint Configuration Manager ꦂ要
Yutaro Tamai
Ā 
TeamséƒØē½²ć«ę ¹ä»˜ćć¾ć§
SoshiYoshida
Ā 

What's hot (20)

PDF
ć‚³ćƒ³ćƒ”ćƒ„ćƒ¼ć‚æćƒ“ć‚øćƒ§ćƒ³ęœ€å…ˆē«Æć‚¬ć‚¤ćƒ‰6 第2ē« :4~4.2節
nonane
Ā 
PDF
Adaptive Cardsへの招待
Nagao Hiroaki
Ā 
PDF
[ģ·Øģ—…ķŠ¹ź°•] ITė¶„ģ•¼ģ—ģ„œ ķ–‰ė³µķ•˜ź²Œ ģ¼ķ•˜źø° - SW ź°œė°œģžė„¼ ģ¤‘ģ‹¬ģœ¼ė”œ
Sungwoo Park
Ā 
PDF
OSSć§å‡ŗę„ć‚‹ć‚¤ćƒ³ć‚·ćƒ‡ćƒ³ćƒˆē®”ē†ćØć‚µćƒ¼ćƒ“ć‚¹č³‡ē”£ē®”ē†åŠć³ę§‹ęˆē®”ē†ć®č‡Ŗå‹•åŒ–
IO Architect Inc.
Ā 
PDF
DX時代のITć‚Øćƒ³ć‚øćƒ‹ć‚¢ć«é€ć‚‹ć€ć‚¢ć‚øćƒ£ć‚¤ćƒ«å¼ć€Œć„ćć„ćć€ćƒ˜ćƒ«ć‚¹ćƒžćƒć‚øćƒ”ćƒ³ćƒˆ
Takeshi Kakeda
Ā 
PDF
Jbatchå®Ÿč·µå…„é–€ #jdt2015
Norito Agetsuma
Ā 
PPTX
é«˜äæ”é ¼ę€§ć‚’ē¢ŗäæć™ć‚‹ć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢é–‹ē™ŗę‰‹ę³•ćØå®Ÿč·µ ļ¼ēµ„č¾¼ćæč£½å“ć®ę½œåœØēš„ä¾”å€¤ć‚’ä»Šä»„äøŠć«é«˜ć‚ć‚‹ćŸć‚ć«ļ¼
Yoshio SAKAI
Ā 
PDF
SharePointćƒŖć‚¹ćƒˆć®ćƒ•ć‚©ćƒ¼ćƒ ć®ć‚«ć‚¹ć‚æćƒžć‚¤ć‚ŗć‚’åˆ©ē”Øć—ćŸćØćć«ćƒćƒžć‚‹ć“ćØ
た な
Ā 
PDF
ć€Œé¾ćŒå¦‚ć7 å…‰ćØé—‡ć®č”Œę–¹ć€ć®č‡Ŗå‹•ćƒ†ć‚¹ćƒˆę“»ē”Øäŗ‹ä¾‹ćØćƒ†ć‚¹ćƒˆč‡Ŗå‹•åŒ–ćƒćƒ¼ćƒ ļ¼ˆä»®ļ¼‰ć«ć‚ˆć‚‹č‹„ę‰‹č‚²ęˆć®å–ć‚Šēµ„ćæć«ć¤ć„ć¦
SEGADevTech
Ā 
PDF
GUIč‡Ŗå‹•ćƒ†ć‚¹ćƒˆć®äæå®ˆę€§ć‚’é«˜ć‚ć‚‹ć«ćÆ
Nozomi Ito
Ā 
PPTX
Office365 ćŠć‚ˆć³ Azure AD ē®”ē†č€…ćŒåæ…ćšć‚„ć£ć¦ćŠćć¹ćć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£åÆ¾ē­–
Yusuke Kodama
Ā 
PDF
LibreOffice API 恫恤恄恦
Kenichi Tatsuhama
Ā 
PDF
äø–ē•Œęœ€å¼·ć®ć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢ć‚¢ćƒ¼ć‚­ćƒ†ć‚Æćƒˆ
Yahoo!ćƒ‡ćƒ™ćƒ­ćƒƒćƒ‘ćƒ¼ćƒćƒƒćƒˆćƒÆćƒ¼ć‚Æ
Ā 
PDF
DX ćØē¤¾ä¼šå•é”Œč§£ę±ŗ
Osaka University
Ā 
PPTX
ć‚¤ćƒ³ćƒ•ćƒ©ć‚Øćƒ³ć‚øćƒ‹ć‚¢ćŖć‚‰ć€Žć•ćć‚‰ć®ć‚Æćƒ©ć‚¦ćƒ‰ć€ć‚’APIć§ć„ć˜ć‚ć†ć€å…„é–€ē·Øć€‘
Eisaku Terao
Ā 
PDF
ćƒ”ćƒ«ć‚«ćƒŖ_ć‚µćƒ¼ćƒ“ć‚¹čŖ¬ę˜Žč³‡ę–™
Find Job Startup
Ā 
PPTX
ć‚Ŗćƒ¼ćƒˆćƒ¢ćƒ¼ćƒ†ć‚£ćƒ–é ˜åŸŸć«ćŠć‘ć‚‹ ä½ē½®ęƒ…å ±é–¢é€£ć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ć‚ć‚Œć“ć‚Œ
DeNA
Ā 
PPTX
GHEå°Žå…„ć‹ć‚‰ē¤¾å†…ę™®åŠć¾ć§ć®č»Œč·” - ć‚Øćƒćƒ³ć‚øć‚§ćƒŖć‚¹ćƒˆćØć—ć¦ć®å–ć‚Šēµ„ćæć«ć¤ć„ć¦ -
ShionITO1
Ā 
PDF
AAD authentication for azure app v0.1.20.0317
Ayumu Inaba
Ā 
PDF
OpenID Connectå…„é–€
土岐 孝平
Ā 
ć‚³ćƒ³ćƒ”ćƒ„ćƒ¼ć‚æćƒ“ć‚øćƒ§ćƒ³ęœ€å…ˆē«Æć‚¬ć‚¤ćƒ‰6 第2ē« :4~4.2節
nonane
Ā 
Adaptive Cardsへの招待
Nagao Hiroaki
Ā 
[ģ·Øģ—…ķŠ¹ź°•] ITė¶„ģ•¼ģ—ģ„œ ķ–‰ė³µķ•˜ź²Œ ģ¼ķ•˜źø° - SW ź°œė°œģžė„¼ ģ¤‘ģ‹¬ģœ¼ė”œ
Sungwoo Park
Ā 
OSSć§å‡ŗę„ć‚‹ć‚¤ćƒ³ć‚·ćƒ‡ćƒ³ćƒˆē®”ē†ćØć‚µćƒ¼ćƒ“ć‚¹č³‡ē”£ē®”ē†åŠć³ę§‹ęˆē®”ē†ć®č‡Ŗå‹•åŒ–
IO Architect Inc.
Ā 
DX時代のITć‚Øćƒ³ć‚øćƒ‹ć‚¢ć«é€ć‚‹ć€ć‚¢ć‚øćƒ£ć‚¤ćƒ«å¼ć€Œć„ćć„ćć€ćƒ˜ćƒ«ć‚¹ćƒžćƒć‚øćƒ”ćƒ³ćƒˆ
Takeshi Kakeda
Ā 
Jbatchå®Ÿč·µå…„é–€ #jdt2015
Norito Agetsuma
Ā 
é«˜äæ”é ¼ę€§ć‚’ē¢ŗäæć™ć‚‹ć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢é–‹ē™ŗę‰‹ę³•ćØå®Ÿč·µ ļ¼ēµ„č¾¼ćæč£½å“ć®ę½œåœØēš„ä¾”å€¤ć‚’ä»Šä»„äøŠć«é«˜ć‚ć‚‹ćŸć‚ć«ļ¼
Yoshio SAKAI
Ā 
SharePointćƒŖć‚¹ćƒˆć®ćƒ•ć‚©ćƒ¼ćƒ ć®ć‚«ć‚¹ć‚æćƒžć‚¤ć‚ŗć‚’åˆ©ē”Øć—ćŸćØćć«ćƒćƒžć‚‹ć“ćØ
た な
Ā 
ć€Œé¾ćŒå¦‚ć7 å…‰ćØé—‡ć®č”Œę–¹ć€ć®č‡Ŗå‹•ćƒ†ć‚¹ćƒˆę“»ē”Øäŗ‹ä¾‹ćØćƒ†ć‚¹ćƒˆč‡Ŗå‹•åŒ–ćƒćƒ¼ćƒ ļ¼ˆä»®ļ¼‰ć«ć‚ˆć‚‹č‹„ę‰‹č‚²ęˆć®å–ć‚Šēµ„ćæć«ć¤ć„ć¦
SEGADevTech
Ā 
GUIč‡Ŗå‹•ćƒ†ć‚¹ćƒˆć®äæå®ˆę€§ć‚’é«˜ć‚ć‚‹ć«ćÆ
Nozomi Ito
Ā 
Office365 ćŠć‚ˆć³ Azure AD ē®”ē†č€…ćŒåæ…ćšć‚„ć£ć¦ćŠćć¹ćć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£åÆ¾ē­–
Yusuke Kodama
Ā 
LibreOffice API 恫恤恄恦
Kenichi Tatsuhama
Ā 
äø–ē•Œęœ€å¼·ć®ć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢ć‚¢ćƒ¼ć‚­ćƒ†ć‚Æćƒˆ
Yahoo!ćƒ‡ćƒ™ćƒ­ćƒƒćƒ‘ćƒ¼ćƒćƒƒćƒˆćƒÆćƒ¼ć‚Æ
Ā 
DX ćØē¤¾ä¼šå•é”Œč§£ę±ŗ
Osaka University
Ā 
ć‚¤ćƒ³ćƒ•ćƒ©ć‚Øćƒ³ć‚øćƒ‹ć‚¢ćŖć‚‰ć€Žć•ćć‚‰ć®ć‚Æćƒ©ć‚¦ćƒ‰ć€ć‚’APIć§ć„ć˜ć‚ć†ć€å…„é–€ē·Øć€‘
Eisaku Terao
Ā 
ćƒ”ćƒ«ć‚«ćƒŖ_ć‚µćƒ¼ćƒ“ć‚¹čŖ¬ę˜Žč³‡ę–™
Find Job Startup
Ā 
ć‚Ŗćƒ¼ćƒˆćƒ¢ćƒ¼ćƒ†ć‚£ćƒ–é ˜åŸŸć«ćŠć‘ć‚‹ ä½ē½®ęƒ…å ±é–¢é€£ć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ć‚ć‚Œć“ć‚Œ
DeNA
Ā 
GHEå°Žå…„ć‹ć‚‰ē¤¾å†…ę™®åŠć¾ć§ć®č»Œč·” - ć‚Øćƒćƒ³ć‚øć‚§ćƒŖć‚¹ćƒˆćØć—ć¦ć®å–ć‚Šēµ„ćæć«ć¤ć„ć¦ -
ShionITO1
Ā 
AAD authentication for azure app v0.1.20.0317
Ayumu Inaba
Ā 
OpenID Connectå…„é–€
土岐 孝平
Ā 
Ad

Similar to [React-Native Tutorial] Map (20)

PPT
Map
Training Guide
Ā 
PPT
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Ossama Alami
Ā 
KEY
SmartphoneKanto#10
Yukiya Nakagawa
Ā 
PPTX
How to build a Pokemon Go App
Charles Ramos
Ā 
PDF
Maperitive
Calvin Ng
Ā 
PDF
@Ionic native/google-maps
Masashi Katsumata
Ā 
PDF
GIS - google earth -placemark - image overlay - screen overlay
anjali s
Ā 
PDF
CKEditor Widgets with Drupal
Ranel Padon
Ā 
PPTX
Android MapView and MapActivity
Ahsanul Karim
Ā 
PDF
Intro To Google Maps
Eric ShangKuan
Ā 
PDF
Global mapperhelp
sami horchani
Ā 
PDF
Maps API on_mobile_dev_festbangkok
ss318
Ā 
PPT
Petec Google Earth
damopsu
Ā 
PDF
Create Location Sharing apps using the Ionic framework
Shelly Megan
Ā 
PPTX
Android chapter25-map views
Tran Le Hoan
Ā 
PPTX
Android development session 6 - Google Maps v2
Farabi Technology Middle East
Ā 
PDF
Map view
YAMANE Toshiaki
Ā 
PDF
Easily Create Maps in Drupal with Leaflet
Amber Matz
Ā 
PDF
Processing 2.0 + Open Data
Steven Battle
Ā 
PPTX
Understanding memory management in xamarin forms
Tsvyatko Konov
Ā 
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Ossama Alami
Ā 
SmartphoneKanto#10
Yukiya Nakagawa
Ā 
How to build a Pokemon Go App
Charles Ramos
Ā 
Maperitive
Calvin Ng
Ā 
@Ionic native/google-maps
Masashi Katsumata
Ā 
GIS - google earth -placemark - image overlay - screen overlay
anjali s
Ā 
CKEditor Widgets with Drupal
Ranel Padon
Ā 
Android MapView and MapActivity
Ahsanul Karim
Ā 
Intro To Google Maps
Eric ShangKuan
Ā 
Global mapperhelp
sami horchani
Ā 
Maps API on_mobile_dev_festbangkok
ss318
Ā 
Petec Google Earth
damopsu
Ā 
Create Location Sharing apps using the Ionic framework
Shelly Megan
Ā 
Android chapter25-map views
Tran Le Hoan
Ā 
Android development session 6 - Google Maps v2
Farabi Technology Middle East
Ā 
Map view
YAMANE Toshiaki
Ā 
Easily Create Maps in Drupal with Leaflet
Amber Matz
Ā 
Processing 2.0 + Open Data
Steven Battle
Ā 
Understanding memory management in xamarin forms
Tsvyatko Konov
Ā 
Ad

More from Kobkrit Viriyayudhakorn (20)

PDF
Thai E-Voting System
Kobkrit Viriyayudhakorn
Ā 
PPTX
Thai National ID Card OCR
Kobkrit Viriyayudhakorn
Ā 
PPTX
Chochae Robot - Thai voice communication extension pack for Service Robot
Kobkrit Viriyayudhakorn
Ā 
PDF
ąøØąø±ąøąø¢ąø ąø²ąøžąø‚ąø­ąø‡ AI ąøŖąø¹ą¹ˆą¹‚ąø­ąøąø²ąøŖą¹ƒąø«ąø”ą¹ˆą¹ąø«ą¹ˆąø‡ąøąø²ąø£ą¹ąø‚ą¹ˆąø‡ąø‚ąø±ąø™ą¹ąø„ąø°ąø„ąø§ąø²ąø”ąøŖąø³ą¹€ąø£ą¹‡ąøˆ (Thai AI updates in yea...
Kobkrit Viriyayudhakorn
Ā 
PDF
Thai Text processing by Transfer Learning using Transformer (Bert)
Kobkrit Viriyayudhakorn
Ā 
PDF
How Emoticon Affects Chatbot Users
Kobkrit Viriyayudhakorn
Ā 
PPTX
ąø«ąø±ąø§ą¹ƒąøˆąø‚ąø­ąø‡ąø›ąø±ąøąøąø²ąø›ąø£ąø°ąø”ąø“ąø©ąøą¹Œ (Gradient Descent ąø—ąø³ąø‡ąø²ąø™ąø­ąø¢ą¹ˆąø²ąø‡ą¹„ąø£)
Kobkrit Viriyayudhakorn
Ā 
PDF
Check Raka Chatbot Pitching Presentation
Kobkrit Viriyayudhakorn
Ā 
PPTX
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
Kobkrit Viriyayudhakorn
Ā 
PPTX
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
Kobkrit Viriyayudhakorn
Ā 
PPTX
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
Kobkrit Viriyayudhakorn
Ā 
PDF
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
Kobkrit Viriyayudhakorn
Ā 
PDF
Lecture 12: React-Native Firebase Authentication
Kobkrit Viriyayudhakorn
Ā 
PDF
Unity Google VR Cardboard Deployment on iOS and Android
Kobkrit Viriyayudhakorn
Ā 
PDF
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
Kobkrit Viriyayudhakorn
Ā 
PDF
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Kobkrit Viriyayudhakorn
Ā 
PDF
Lecture 2: C# Programming for VR application in Unity
Kobkrit Viriyayudhakorn
Ā 
PDF
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
Ā 
PDF
Thai Word Embedding with Tensorflow
Kobkrit Viriyayudhakorn
Ā 
PDF
Lecture 3 - ES6 Script Advanced for React-Native
Kobkrit Viriyayudhakorn
Ā 
Thai E-Voting System
Kobkrit Viriyayudhakorn
Ā 
Thai National ID Card OCR
Kobkrit Viriyayudhakorn
Ā 
Chochae Robot - Thai voice communication extension pack for Service Robot
Kobkrit Viriyayudhakorn
Ā 
ąøØąø±ąøąø¢ąø ąø²ąøžąø‚ąø­ąø‡ AI ąøŖąø¹ą¹ˆą¹‚ąø­ąøąø²ąøŖą¹ƒąø«ąø”ą¹ˆą¹ąø«ą¹ˆąø‡ąøąø²ąø£ą¹ąø‚ą¹ˆąø‡ąø‚ąø±ąø™ą¹ąø„ąø°ąø„ąø§ąø²ąø”ąøŖąø³ą¹€ąø£ą¹‡ąøˆ (Thai AI updates in yea...
Kobkrit Viriyayudhakorn
Ā 
Thai Text processing by Transfer Learning using Transformer (Bert)
Kobkrit Viriyayudhakorn
Ā 
How Emoticon Affects Chatbot Users
Kobkrit Viriyayudhakorn
Ā 
ąø«ąø±ąø§ą¹ƒąøˆąø‚ąø­ąø‡ąø›ąø±ąøąøąø²ąø›ąø£ąø°ąø”ąø“ąø©ąøą¹Œ (Gradient Descent ąø—ąø³ąø‡ąø²ąø™ąø­ąø¢ą¹ˆąø²ąø‡ą¹„ąø£)
Kobkrit Viriyayudhakorn
Ā 
Check Raka Chatbot Pitching Presentation
Kobkrit Viriyayudhakorn
Ā 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
Kobkrit Viriyayudhakorn
Ā 
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
Kobkrit Viriyayudhakorn
Ā 
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
Kobkrit Viriyayudhakorn
Ā 
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
Kobkrit Viriyayudhakorn
Ā 
Lecture 12: React-Native Firebase Authentication
Kobkrit Viriyayudhakorn
Ā 
Unity Google VR Cardboard Deployment on iOS and Android
Kobkrit Viriyayudhakorn
Ā 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
Kobkrit Viriyayudhakorn
Ā 
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Kobkrit Viriyayudhakorn
Ā 
Lecture 2: C# Programming for VR application in Unity
Kobkrit Viriyayudhakorn
Ā 
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
Ā 
Thai Word Embedding with Tensorflow
Kobkrit Viriyayudhakorn
Ā 
Lecture 3 - ES6 Script Advanced for React-Native
Kobkrit Viriyayudhakorn
Ā 

Recently uploaded (20)

PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
Ā 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
Ā 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
Ā 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
Ā 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
Ā 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
Ā 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
Ā 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Ā 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
Ā 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
Ā 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
Ā 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
Ā 
PDF
Software Development Methodologies in 2025
KodekX
Ā 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
Ā 
PDF
Doc9.....................................
SofiaCollazos
Ā 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
Ā 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
PDF
Chapter 2 Digital Image Fundamentals.pdf
Getnet Tigabie Askale -(GM)
Ā 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
Ā 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
Ā 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
Ā 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
Ā 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
Ā 
Coupa-Overview _Assumptions presentation
annapureddyn
Ā 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
Ā 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Ā 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
Ā 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
Ā 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
Ā 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
Ā 
Software Development Methodologies in 2025
KodekX
Ā 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
Ā 
Doc9.....................................
SofiaCollazos
Ā 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
Ā 
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
Chapter 2 Digital Image Fundamentals.pdf
Getnet Tigabie Askale -(GM)
Ā 

[React-Native Tutorial] Map

  • 1. Kobkrit Viriyayudhakorn, Ph.D. CEO of iApp Technology Limited. [email protected] http://www.kobkrit.com
  • 3. React-Native-Maps • https://github.com/airbnb/react- native-maps • React Native Map Components for iOS + Android • Made by Airbnb • iOS => Choose either • Google Map • Apple Map • Android => Only Google Map
  • 4. Installation 1. $ react-native init --version=ā€œ0.35.0ā€ l9_map 2. $ npm install react-native-maps --save 3. $ react-native link 4. Write some code 5. $ react-native run-ios 6. For Android, we have extra steps.
  • 5. Android Installation Extra Steps. 1. Google Map need an API key 2. You can get your own at https:// console.developers.google.com or using my API key. >> 
 AIzaSyCKspSGmpYn3GxZfIc_Sccu7x-8qXQcZkI 3. Add the Google Map’s API key at androidappsrcmainAndroidManifest.xml 4. $ react-native run-android
  • 6. Adding Google API key Add meta-data tag as shown below, between <application> tag in AndroidManifest.xml
  • 7. Adding Basic Map Code l9_map_1 You can see full l9_map_1 source code at the end of lecture note (A4)
  • 8. First try! 1. $ react-native run-ios 2. Empty screen come up!? why!? 3. Map need the width, height. Can not use flex:1 here… :( l9_map_1
  • 9. Adding Width,Height to Map l9_map_2Full l9_map_2 source code at the end of lecture note • Dimensions return current screen’s 
 width and height. • Dimensions.get(ā€˜windows’).width • Dimensions.get(ā€˜windows’).height • Thus, the map will be full screen.
  • 10. 1. Welcome to San Francisco, the home of tech companies in the world. 2. At the center point of the screen is <37.78825, -122.4324> 3. The zoom of the map is specify by *Delta. 4. At the Equator
 1 LatitudeDelta => 110.57 KM
 1 LongitudeDelta => 111.32 KM 0.0922 latDelta 0.0421 longDelta (37.78825, -122.4324) l9_map_2
  • 11. Make it controllable by State l9_map_3 Instead of, the fixed regions, we make it as a state.
  • 12. Make it controllable by State #2 l9_map_3 • onRegionChange props will be called when the location/zoom are changed, with the value of new location/zoom (region) • Region props defined the current location/zoom in the map.
  • 13. 1. Drag on map view to move the map. 2. Once drag, this.state.region was updated by onRegionChanged(). 3. Text at the lower third of the screen is updated according to the this.state.region 4.Try two fingers pinch, to zoom, to rotate the map. In simulator, press alt(option) button to two fingers pinch. l9_map_3
  • 14. Configure the MapView And much more.. https://github.com/airbnb/react-native-maps/blob/master/docs/mapview.md
  • 15. MapEvents are also catchable And much more.. https://github.com/airbnb/react-native-maps/blob/master/docs/mapview.md
  • 16. Let configure some MapView l9_map_4
  • 17. Let’s change the mapType mapType=ā€œhybridā€ mapType=ā€œsatelliteā€ mapType=ā€œterrainā€ l9_map_4 Android only
  • 18. Adding Map Markerl9_map_5 Let move the location to the Victory Monument, Bangkok, Thailand. MapView.Marker coordinate => LatLng Object of that marker title => Title of Information popup
 description => Description of popup
  • 19. 1. MapView.Marker creates a red- pin marker on the map (for Apple map), and droplet shape pin on Google map. Place it as children of the MapView. 2.Touch the pin to show up the popup windows, touch elsewhere to hide it. 3. The map is draggable. 4.You can add many markers you want. Google Map Apple Map l9_map_5
  • 22. Don’t forget to add ā€œkeyā€ We found that there are warnings below… It will occur every time, when we use JSX under loop.
 To remove it, Add key props. 
 To distinguish each MapView.Marker
 from others. l9_map_6
  • 23. Adding custom images to markers images/shopping.png images/music.png images/attention.png W=56px / H=56px / Transparent Background l9_map_7
  • 24. Adding custom images to markers l9_map_7 • Load image into state, and display it on map using ā€œimageā€ prop. • Image shall be around
 56px X 56px
  • 26. Nah,.. Change my mind
 I want custom view to represent
 markers instead… l9_map_8 Place Name Normal Picture Group of View
  • 27. Marker as Custom View • Add View as the children of MapView.Marker l9_map_8
  • 29. That such a boring 
 Popup… I want to have 
 a photo in it. (Custom Popup) l9_map_9
  • 30. Custom Popup • Add MapView.Callout as the children of the MapView.Marker l9_map_9
  • 32. Drawing Circle on Map … https://github.com/airbnb/react-native-maps/blob/master/docs/circle.md l9_map_10
  • 33. Drawing Polyline on Map … https://github.com/airbnb/react-native-maps/blob/master/docs/polyline.md l9_map_10
  • 34. Drawing Polygon on Map … https://github.com/airbnb/react-native-maps/blob/master/docs/polygon.md l9_map_10
  • 35. Drawing Something on Map (Code) l9_map_10
  • 37. Travel Directory App • Center map at the Victory Monument • Map can be moved. • Tap on icon, show Title and Description • Push buttons to move the map to that specific location and zoom in and open the call out. • Starting to modify the app from l9_map_7 App Requirements l9_map_travel
  • 38. moveMapToLocation method Once called, moveMaptoLocation method change the state of region to assigned latlng, and zoom in by setting
 latitudeDelta, and longitudeDelta l9_map_travel
  • 44. The Change is so sudden! • I want to make it smoothly animate to the new location! • MapView have a method for that called ā€œanimateToRegionā€ • They accept 2 arguments, i.e., Region to move to, and, How long does the animation will need (in ms). l9_map_travel_smooth
  • 45. How to reference to the MapView (Ref) • How we can reference to our UI in react? • Luckily, we have Ref System! • We can have ref props in any component, e.g., 
 <MapView ref=ā€œmapā€ … > • We can reference to the MapView Component by accessing this.ref.map l9_map_travel_smooth
  • 46. l9_map_travel_smooth • We move to the new location as specified in latlng. • And zoom in, • smoothly in 3 seconds (3000 ms)
  • 48. HW: How to automatically open call out when pressing a button? • There is a method call ā€œshowCallout()ā€ in MapView.Marker • Use Ref! • This is your homework! https://github.com/airbnb/react-native-maps/blob/master/docs/marker.md
  • 49. Q/A