SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
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
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

Mais conteúdo relacionado

Mais procurados

online blogging system
online blogging systemonline blogging system
online blogging system001vaibhav
 
City search documentation
City search documentationCity search documentation
City search documentationRajesh Varanasi
 
[FOSS4G Korea 2016] Workshop - Advanced GeoServer
[FOSS4G Korea 2016] Workshop - Advanced GeoServer[FOSS4G Korea 2016] Workshop - Advanced GeoServer
[FOSS4G Korea 2016] Workshop - Advanced GeoServerMinPa Lee
 
Kafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around KafkaKafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around KafkaGuido Schmutz
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드confluent
 
Responsive Design
Responsive DesignResponsive Design
Responsive DesignSara Cannon
 
Introduction to Firebase
Introduction to FirebaseIntroduction to Firebase
Introduction to FirebaseMustafa Şenel
 
Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...
Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...
Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...Kai Wähner
 
From a monolith to microservices + REST: The evolution of LinkedIn's architec...
From a monolith to microservices + REST: The evolution of LinkedIn's architec...From a monolith to microservices + REST: The evolution of LinkedIn's architec...
From a monolith to microservices + REST: The evolution of LinkedIn's architec...Karan Parikh
 
GeoServer 2.4.x 한국어 사용자 지침서
GeoServer 2.4.x 한국어 사용자 지침서GeoServer 2.4.x 한국어 사용자 지침서
GeoServer 2.4.x 한국어 사용자 지침서SANGHEE SHIN
 
Final year project presentation in android application
Final year project presentation in android applicationFinal year project presentation in android application
Final year project presentation in android applicationChirag Thaker
 
Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafkaconfluent
 
.NET MAUI with .NET 6 (December 2021, Preview 10)
.NET MAUI with .NET 6 (December 2021, Preview 10).NET MAUI with .NET 6 (December 2021, Preview 10)
.NET MAUI with .NET 6 (December 2021, Preview 10)Alex Pshul
 
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판BJ Jang
 
Google Firebase
Google FirebaseGoogle Firebase
Google FirebaseAliZaidi94
 
Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...
Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...
Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...Amazon Web Services
 
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 

Mais procurados (20)

online blogging system
online blogging systemonline blogging system
online blogging system
 
City search documentation
City search documentationCity search documentation
City search documentation
 
[FOSS4G Korea 2016] Workshop - Advanced GeoServer
[FOSS4G Korea 2016] Workshop - Advanced GeoServer[FOSS4G Korea 2016] Workshop - Advanced GeoServer
[FOSS4G Korea 2016] Workshop - Advanced GeoServer
 
Kafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around KafkaKafka Connect & Streams - the ecosystem around Kafka
Kafka Connect & Streams - the ecosystem around Kafka
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
 
Responsive Design
Responsive DesignResponsive Design
Responsive Design
 
Introduction to Firebase
Introduction to FirebaseIntroduction to Firebase
Introduction to Firebase
 
Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...
Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...
Event-Driven Stream Processing and Model Deployment with Apache Kafka, Kafka ...
 
From a monolith to microservices + REST: The evolution of LinkedIn's architec...
From a monolith to microservices + REST: The evolution of LinkedIn's architec...From a monolith to microservices + REST: The evolution of LinkedIn's architec...
From a monolith to microservices + REST: The evolution of LinkedIn's architec...
 
GeoServer 2.4.x 한국어 사용자 지침서
GeoServer 2.4.x 한국어 사용자 지침서GeoServer 2.4.x 한국어 사용자 지침서
GeoServer 2.4.x 한국어 사용자 지침서
 
Final year project presentation in android application
Final year project presentation in android applicationFinal year project presentation in android application
Final year project presentation in android application
 
Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafka
 
.NET MAUI with .NET 6 (December 2021, Preview 10)
.NET MAUI with .NET 6 (December 2021, Preview 10).NET MAUI with .NET 6 (December 2021, Preview 10)
.NET MAUI with .NET 6 (December 2021, Preview 10)
 
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
 
Google Firebase
Google FirebaseGoogle Firebase
Google Firebase
 
Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...
Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...
Deep Dive into Amazon ElastiCache Architecture and Design Patterns (DAT307) |...
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Sample Website Proposal Presentation
Sample Website Proposal PresentationSample Website Proposal Presentation
Sample Website Proposal Presentation
 
Google maps api 3
Google maps api 3Google maps api 3
Google maps api 3
 
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
 

Semelhante a [React-Native Tutorial] Map

Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)Ossama Alami
 
How to build a Pokemon Go App
How to build a Pokemon Go AppHow to build a Pokemon Go App
How to build a Pokemon Go AppCharles Ramos
 
GIS - google earth -placemark - image overlay - screen overlay
GIS - google earth -placemark - image overlay - screen overlay GIS - google earth -placemark - image overlay - screen overlay
GIS - google earth -placemark - image overlay - screen overlay anjali s
 
CKEditor Widgets with Drupal
CKEditor Widgets with DrupalCKEditor Widgets with Drupal
CKEditor Widgets with DrupalRanel Padon
 
Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivityAhsanul Karim
 
Maps API on_mobile_dev_festbangkok
Maps API on_mobile_dev_festbangkokMaps API on_mobile_dev_festbangkok
Maps API on_mobile_dev_festbangkokss318
 
Petec Google Earth
Petec Google EarthPetec Google Earth
Petec Google Earthdamopsu
 
Create Location Sharing apps using the Ionic framework
Create Location Sharing apps using the Ionic framework					Create Location Sharing apps using the Ionic framework
Create Location Sharing apps using the Ionic framework Shelly Megan
 
Android chapter25-map views
Android chapter25-map viewsAndroid chapter25-map views
Android chapter25-map viewsTran Le Hoan
 
Easily Create Maps in Drupal with Leaflet
Easily Create Maps in Drupal with LeafletEasily Create Maps in Drupal with Leaflet
Easily Create Maps in Drupal with LeafletAmber Matz
 
Processing 2.0 + Open Data
Processing 2.0 + Open DataProcessing 2.0 + Open Data
Processing 2.0 + Open DataSteven Battle
 
Understanding memory management in xamarin forms
Understanding memory management in xamarin formsUnderstanding memory management in xamarin forms
Understanding memory management in xamarin formsTsvyatko Konov
 

Semelhante a [React-Native Tutorial] Map (20)

Map
MapMap
Map
 
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
 
SmartphoneKanto#10
SmartphoneKanto#10SmartphoneKanto#10
SmartphoneKanto#10
 
How to build a Pokemon Go App
How to build a Pokemon Go AppHow to build a Pokemon Go App
How to build a Pokemon Go App
 
Maperitive
MaperitiveMaperitive
Maperitive
 
@Ionic native/google-maps
@Ionic native/google-maps@Ionic native/google-maps
@Ionic native/google-maps
 
GIS - google earth -placemark - image overlay - screen overlay
GIS - google earth -placemark - image overlay - screen overlay GIS - google earth -placemark - image overlay - screen overlay
GIS - google earth -placemark - image overlay - screen overlay
 
CKEditor Widgets with Drupal
CKEditor Widgets with DrupalCKEditor Widgets with Drupal
CKEditor Widgets with Drupal
 
Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivity
 
Intro To Google Maps
Intro To Google MapsIntro To Google Maps
Intro To Google Maps
 
Global mapperhelp
Global mapperhelpGlobal mapperhelp
Global mapperhelp
 
Maps API on_mobile_dev_festbangkok
Maps API on_mobile_dev_festbangkokMaps API on_mobile_dev_festbangkok
Maps API on_mobile_dev_festbangkok
 
Petec Google Earth
Petec Google EarthPetec Google Earth
Petec Google Earth
 
Create Location Sharing apps using the Ionic framework
Create Location Sharing apps using the Ionic framework					Create Location Sharing apps using the Ionic framework
Create Location Sharing apps using the Ionic framework
 
Android chapter25-map views
Android chapter25-map viewsAndroid chapter25-map views
Android chapter25-map views
 
Android development session 6 - Google Maps v2
Android development   session 6 - Google Maps v2Android development   session 6 - Google Maps v2
Android development session 6 - Google Maps v2
 
Map view
Map viewMap view
Map view
 
Easily Create Maps in Drupal with Leaflet
Easily Create Maps in Drupal with LeafletEasily Create Maps in Drupal with Leaflet
Easily Create Maps in Drupal with Leaflet
 
Processing 2.0 + Open Data
Processing 2.0 + Open DataProcessing 2.0 + Open Data
Processing 2.0 + Open Data
 
Understanding memory management in xamarin forms
Understanding memory management in xamarin formsUnderstanding memory management in xamarin forms
Understanding memory management in xamarin forms
 

Mais de Kobkrit Viriyayudhakorn

Chochae Robot - Thai voice communication extension pack for Service Robot
Chochae Robot - Thai voice communication extension pack for Service RobotChochae Robot - Thai voice communication extension pack for Service Robot
Chochae Robot - Thai voice communication extension pack for Service RobotKobkrit Viriyayudhakorn
 
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...Kobkrit Viriyayudhakorn
 
Thai Text processing by Transfer Learning using Transformer (Bert)
Thai Text processing by Transfer Learning using Transformer (Bert)Thai Text processing by Transfer Learning using Transformer (Bert)
Thai Text processing by Transfer Learning using Transformer (Bert)Kobkrit Viriyayudhakorn
 
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)Kobkrit Viriyayudhakorn
 
Check Raka Chatbot Pitching Presentation
Check Raka Chatbot Pitching PresentationCheck Raka Chatbot Pitching Presentation
Check Raka Chatbot Pitching PresentationKobkrit Viriyayudhakorn
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)Kobkrit Viriyayudhakorn
 
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
[Lecture 4] AI and Deep Learning: Neural Network (Theory)[Lecture 4] AI and Deep Learning: Neural Network (Theory)
[Lecture 4] AI and Deep Learning: Neural Network (Theory)Kobkrit Viriyayudhakorn
 
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)Kobkrit Viriyayudhakorn
 
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.Kobkrit Viriyayudhakorn
 
Lecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase AuthenticationLecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase AuthenticationKobkrit Viriyayudhakorn
 
Unity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidUnity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidKobkrit Viriyayudhakorn
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2Kobkrit Viriyayudhakorn
 
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming Kobkrit Viriyayudhakorn
 
Lecture 2: C# Programming for VR application in Unity
Lecture 2: C# Programming for VR application in UnityLecture 2: C# Programming for VR application in Unity
Lecture 2: C# Programming for VR application in UnityKobkrit Viriyayudhakorn
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingKobkrit Viriyayudhakorn
 
Lecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-NativeLecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-NativeKobkrit Viriyayudhakorn
 

Mais de Kobkrit Viriyayudhakorn (20)

Thai E-Voting System
Thai E-Voting System Thai E-Voting System
Thai E-Voting System
 
Thai National ID Card OCR
Thai National ID Card OCRThai National ID Card OCR
Thai National ID Card OCR
 
Chochae Robot - Thai voice communication extension pack for Service Robot
Chochae Robot - Thai voice communication extension pack for Service RobotChochae Robot - Thai voice communication extension pack for Service Robot
Chochae Robot - Thai voice communication extension pack for Service Robot
 
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
 
Thai Text processing by Transfer Learning using Transformer (Bert)
Thai Text processing by Transfer Learning using Transformer (Bert)Thai Text processing by Transfer Learning using Transformer (Bert)
Thai Text processing by Transfer Learning using Transformer (Bert)
 
How Emoticon Affects Chatbot Users
How Emoticon Affects Chatbot UsersHow Emoticon Affects Chatbot Users
How Emoticon Affects Chatbot Users
 
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
 
Check Raka Chatbot Pitching Presentation
Check Raka Chatbot Pitching PresentationCheck Raka Chatbot Pitching Presentation
Check Raka Chatbot Pitching Presentation
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
 
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
[Lecture 4] AI and Deep Learning: Neural Network (Theory)[Lecture 4] AI and Deep Learning: Neural Network (Theory)
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
 
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
 
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
 
Lecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase AuthenticationLecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase Authentication
 
Unity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidUnity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and Android
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
 
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
 
Lecture 2: C# Programming for VR application in Unity
Lecture 2: C# Programming for VR application in UnityLecture 2: C# Programming for VR application in Unity
Lecture 2: C# Programming for VR application in Unity
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
 
Thai Word Embedding with Tensorflow
Thai Word Embedding with Tensorflow Thai Word Embedding with Tensorflow
Thai Word Embedding with Tensorflow
 
Lecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-NativeLecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-Native
 

Último

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

[React-Native Tutorial] Map

  • 1. Kobkrit Viriyayudhakorn, Ph.D. CEO of iApp Technology Limited. kobkrit@gmail.com 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
  • 36.
  • 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