SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
1
20 1 8 ISIT
1
­
­
­
­
­ Expo Snack
­ UI React React
­
­
­ React
­ Expo SDK
2
REACT
3
REACT
4
UI
JavaScript
DOM
React
Node
React Native
DECLARATIVE
­
­
5
(+ 1 2 3 4 5) ;15
var sum = function(arr){
var sum=0;
for(var i=0; i < arr.length; i++){
sum += arr[i];
}
return sum;
}
var arr = [1, 2, 3, 4, 5];
console.log( sum(arr) ); // 15
sum [1,2,3,4,5] --15
6
function double (arr) {
let results = []
for (let i = 0; i < arr.length; i++){
results.push(arr[i] * 2)
}
return results
}
function double (arr) {
return arr.map((item) => item * 2)
}
function add (arr) {
let result = 0
for (let i = 0; i < arr.length; i++){
result += arr[i]
}
return result
}
function add (arr) {
return arr.reduce((prev, current) => prev + current, 0)
}
$("#btn").click(function() {
$(this).toggleClass("highlight")
$(this).text() === 'Add Highlight'
? $(this).text('Remove Highlight')
: $(this).text('Add Highlight')
})
<Btn
onToggleHighlight={this.handleToggleHighlight}
highlight={this.state.highlight}>
{this.state.buttonText}
</Btn>
https://tylermcginnis.com/imperative-vs-declarative-programming/
CBD: Component-based development
­ separation
of concerns
­
7
https://en.wikipedia.org/wiki/Component-based_software_engineering
https://medium.com/@dan.shapiro1210/understanding-component-based-architecture-3ff48ec0c238
•
•
•
REACT
8
class Welcome extends React.Component {
state = {name: 'Anzu'};
render() {
return (
<div>
<h1>Hello, {this.props.name}</h1>
<div>My name is {this.state.name}</div>
</div>
);
}
}
class App extends React.Component {
render() {
return (
<div>
<Welcome name="Taro" />
<Welcome name="Hanako" />
</div>
);
}
}
View
9
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}
Functional
•
•
•
Functional
REACT VER. 16.4
10http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/
LEARN ONCE, WRITE ANYWHERE
Java
­ Write once, run anywhere
­
­ React
­ iOS, android : React Native
­ Win, Mac React Desktop (https://reactdesktop.js.org/)
11https://reactjs.org/blog/2015/03/26/introducing-react-native.html
ES2015 ECMASCRIPT2015
12
let
let name = 'taro';
name = 'hanako'
const
const name = 'taro';
name = 'hanako'; // error
class
class Person { constructor(name){
this.name = name;
}
}
const person = new Person('taro')
const fn = (name) =>{
return console.log(name);
}
const arr = ['a', 'b', 'c'];
const arr2 = [...arr];
console.log(arr === arr2); // false
const name = 'taro';
console.log(`My name is ${name}.`); // My name is taro.
https://babeljs.io/docs/en/learn/
Expo ES6 6th Edition
extract(‘test.txt’, function(data1){
transform(data1, function(data2){
load(data2, function(data3){
console.log(‘done: ’, data3);
});
});
});
var promise = Promise.resolve();
promise
.then(()=> extract(‘text.txt’));
.then(data1=> transform(data1))
.then(data2=> load(data2))
.then((data3)=> console.log(‘done: , data3 ’))
async ()=>{
let data1 = await extract(‘test.txt’);
let data2 = await transform(data1);
let data3 = await load(data2);
console.log(‘done: ’, data3);
}
ES5
13
ES2015(ES6) Promise, ES2017(ES8) async/await
Expo ES8 async/await
JSX JAVASCRIPT XML, JAVASCRIPT SYNTAX EXTENSION
14
XML JavaScript
<MyButton color="blue" shadowSize={2}>
Click Me
</MyButton>
React.createElement(
MyButton,
{color: 'blue', shadowSize: 2},
'Click Me'
)
<div className="sidebar" />
React.createElement(
'div',
{className: 'sidebar'},
null
)
https://reactjs.org/docs/introducing-jsx.html
JSX React.createElement(component, props, ...children)
DOM
DOM ReactDOM
DOM
DOM
React DOM
15
DOM DOM
Key
{todos.map((todo, index) =>
<Todo
{...todo}
key={index}
/>
)}
{todos.map((todo) =>
<Todo {...todo}
key={todo.id} />
)}
ID
var shortid = require('shortid');
function createNewTodo(text) {
return {
completed: false,
id: shortid.generate(),
text
}
}
ID
todoCounter = 1;
function createNewTodo(text) {
return {
completed: false,
id: todoCounter++,
text
}
}
https://reactjs.org/docs/faq-internals.html
https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318
shortid
ID
EXPO SDK
16
EXPO SDK
­ Web
­
iOS, Android API
­ API API
17
Core Motion iOS Google Fit Android
Pedometer (Expo SDK)
API
18
AR Accelerometer Admob Amplitude AppLoading ART
Asset Audio AuthSession
Web
AV BarCodeScanner BlurView
Branch Brghtness Calendar Camera Constants
ID
Contacts
DeviceMotion DocumentPicker ErrorRecovery FacebookAds Facebook
Graph API
FaceDetector
FileSystem Font GestureHandler GLView
OpenGL ES
Google
Google
Gyroscope
Haptic ImageManipulator ImagePicker IntentLauncherAndroid KeepAwake LinerGradient
Linking LocalAuthentication Localization Location Lottie Magnetometer
MailComposer MapView MediaLibrary Notifications Payments Pedometer
Permissions Print registerRootComponent ScreenOrientation SecureStore Segment
SMS Speech SplashScreen SQLite StoreReview Svg
SVG
takeSnapshotAsync Updates Video WebBrowser
LOCATION
19
Expo.Location.getCurrentPositionAsync(options)
Expo.Location.watchPositionAsync(options, callback)
Expo.Location.getProviderStatusAsync()
Expo.Location.getHeadingAsync()
Expo.Location.watchHeadingAsync(callback)
Expo.Location.geocodeAsync(address)
Expo.Location.reverseGeocodeAsync(location)
Expo.Location.setApiKey(apiKey) Google API
https://snack.expo.io/@tygoto/location
LOCATION
20
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted’)
console.log('Permission to access location was denied');
Permissions API
let location = await Location.getCurrentPositionAsync({});
// address = await Location.reverseGeocodeAsync(loc)
// Location.watchHeadingAsync(this._getHeadingAsync)
//
//
PEDOMETER
Core Motion iOS Google Fit Android
21
Expo.Pedometer.isAvailableAsync()
Expo.Pedometer.getStepCountAsync(start, end)
Expo.Pedometer.watchStepCount(callback)
https://snack.expo.io/@tygoto/pedometer
PEDOMETER
22
componentDidMount() {
this._subscription = Pedometer.watchStepCount(result => {
this.setState({
currentStepCount: result.steps,
});
});
}
componentWillUnmount() {
this._subscription && this._subscription.remove();
this._subscription = null;
}
Pedometer.getStepCountAsync
CAMERA
23
https://snack.expo.io/@tygoto/camera
CAMERA
24
Camera.Constants.Type.back
front
ref={ref => {
this.cameraRef = ref;
}}>
let photo = await this.cameraRef.takePictureAsync();
OPEN DATA EXPO SDK
25
OPEN DATA EXPO SDK
http://data.bodik.jp/dataset
­
­ http://data.bodik.jp/dataset/atmospheric48
­
­ http://data.bodik.jp/dataset/401000_koutsuujiko2017
­
­
­
­
Expo SDK
26
1.
2.
3.
4.
27
React
­
­ ES2015, JSX, DOM
Expo SDK Expo SDK API
Open Data Expo SDK
­ Expo SDK
­
28

Contenu connexe

Tendances

Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
Sages
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simpler
Alexander Mostovenko
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
Vaclav Pech
 

Tendances (20)

The redux saga begins
The redux saga beginsThe redux saga begins
The redux saga begins
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
 
All you need to know about Callbacks, Promises, Generators
All you need to know about Callbacks, Promises, GeneratorsAll you need to know about Callbacks, Promises, Generators
All you need to know about Callbacks, Promises, Generators
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJS
 
RxJS Evolved
RxJS EvolvedRxJS Evolved
RxJS Evolved
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simpler
 
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
The Ring programming language version 1.9 book - Part 71 of 210
The Ring programming language version 1.9 book - Part 71 of 210The Ring programming language version 1.9 book - Part 71 of 210
The Ring programming language version 1.9 book - Part 71 of 210
 
The evolution of redux action creators
The evolution of redux action creatorsThe evolution of redux action creators
The evolution of redux action creators
 
The Ring programming language version 1.5.1 book - Part 63 of 180
The Ring programming language version 1.5.1 book - Part 63 of 180The Ring programming language version 1.5.1 book - Part 63 of 180
The Ring programming language version 1.5.1 book - Part 63 of 180
 
Jarmo van de Seijp Shadbox ERC223
Jarmo van de Seijp Shadbox ERC223Jarmo van de Seijp Shadbox ERC223
Jarmo van de Seijp Shadbox ERC223
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJS
 
Swift Sequences & Collections
Swift Sequences & CollectionsSwift Sequences & Collections
Swift Sequences & Collections
 
The Ring programming language version 1.6 book - Part 69 of 189
The Ring programming language version 1.6 book - Part 69 of 189The Ring programming language version 1.6 book - Part 69 of 189
The Ring programming language version 1.6 book - Part 69 of 189
 
Js interpreter interpreted
Js interpreter interpretedJs interpreter interpreted
Js interpreter interpreted
 
Ss dotnetcodexmpl
Ss dotnetcodexmplSs dotnetcodexmpl
Ss dotnetcodexmpl
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
Understanding the nodejs event loop
Understanding the nodejs event loopUnderstanding the nodejs event loop
Understanding the nodejs event loop
 

Similaire à オープンデータを使ったモバイルアプリ開発(応用編)

Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 
Gearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copyGearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copy
Brian Aker
 
Gearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copyGearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copy
Brian Aker
 

Similaire à オープンデータを使ったモバイルアプリ開発(応用編) (20)

Angular2 rxjs
Angular2 rxjsAngular2 rxjs
Angular2 rxjs
 
GDSC Flutter Forward Workshop.pptx
GDSC Flutter Forward Workshop.pptxGDSC Flutter Forward Workshop.pptx
GDSC Flutter Forward Workshop.pptx
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript Functions
 
JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
 
Es6 hackathon
Es6 hackathonEs6 hackathon
Es6 hackathon
 
How to practice functional programming in react
How to practice functional programming in reactHow to practice functional programming in react
How to practice functional programming in react
 
Call stack, event loop and async programming
Call stack, event loop and async programmingCall stack, event loop and async programming
Call stack, event loop and async programming
 
What's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageWhat's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritage
 
Introductory RxJava
Introductory RxJavaIntroductory RxJava
Introductory RxJava
 
Gearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copyGearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copy
 
Gearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copyGearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copy
 
Functional JavaScript for everyone
Functional JavaScript for everyoneFunctional JavaScript for everyone
Functional JavaScript for everyone
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervoso
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskell
 

Plus de Takayuki Goto (7)

ros2_cmd_api : ROS2コマンド機能のAPIを提供するROS2パッケージ.pdf
ros2_cmd_api :  ROS2コマンド機能のAPIを提供するROS2パッケージ.pdfros2_cmd_api :  ROS2コマンド機能のAPIを提供するROS2パッケージ.pdf
ros2_cmd_api : ROS2コマンド機能のAPIを提供するROS2パッケージ.pdf
 
OculusのPassthrough APIを使ってみた
OculusのPassthrough APIを使ってみたOculusのPassthrough APIを使ってみた
OculusのPassthrough APIを使ってみた
 
WindowsではじめるROSプログラミング
WindowsではじめるROSプログラミングWindowsではじめるROSプログラミング
WindowsではじめるROSプログラミング
 
DockerでCKANを動かそう
DockerでCKANを動かそうDockerでCKANを動かそう
DockerでCKANを動かそう
 
オープンデータを使ったモバイルアプリ開発(入門編)
オープンデータを使ったモバイルアプリ開発(入門編)オープンデータを使ったモバイルアプリ開発(入門編)
オープンデータを使ったモバイルアプリ開発(入門編)
 
オープンデータを使った モバイルアプリ開発入門
オープンデータを使ったモバイルアプリ開発入門オープンデータを使ったモバイルアプリ開発入門
オープンデータを使った モバイルアプリ開発入門
 
Expoによるモバイルアプリ開発入門
Expoによるモバイルアプリ開発入門Expoによるモバイルアプリ開発入門
Expoによるモバイルアプリ開発入門
 

Dernier

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Dernier (20)

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 

オープンデータを使ったモバイルアプリ開発(応用編)

  • 1. 1 20 1 8 ISIT 1
  • 2. ­ ­ ­ ­ ­ Expo Snack ­ UI React React ­ ­ ­ React ­ Expo SDK 2
  • 5. DECLARATIVE ­ ­ 5 (+ 1 2 3 4 5) ;15 var sum = function(arr){ var sum=0; for(var i=0; i < arr.length; i++){ sum += arr[i]; } return sum; } var arr = [1, 2, 3, 4, 5]; console.log( sum(arr) ); // 15 sum [1,2,3,4,5] --15
  • 6. 6 function double (arr) { let results = [] for (let i = 0; i < arr.length; i++){ results.push(arr[i] * 2) } return results } function double (arr) { return arr.map((item) => item * 2) } function add (arr) { let result = 0 for (let i = 0; i < arr.length; i++){ result += arr[i] } return result } function add (arr) { return arr.reduce((prev, current) => prev + current, 0) } $("#btn").click(function() { $(this).toggleClass("highlight") $(this).text() === 'Add Highlight' ? $(this).text('Remove Highlight') : $(this).text('Add Highlight') }) <Btn onToggleHighlight={this.handleToggleHighlight} highlight={this.state.highlight}> {this.state.buttonText} </Btn> https://tylermcginnis.com/imperative-vs-declarative-programming/
  • 7. CBD: Component-based development ­ separation of concerns ­ 7 https://en.wikipedia.org/wiki/Component-based_software_engineering https://medium.com/@dan.shapiro1210/understanding-component-based-architecture-3ff48ec0c238 • • •
  • 8. REACT 8 class Welcome extends React.Component { state = {name: 'Anzu'}; render() { return ( <div> <h1>Hello, {this.props.name}</h1> <div>My name is {this.state.name}</div> </div> ); } } class App extends React.Component { render() { return ( <div> <Welcome name="Taro" /> <Welcome name="Hanako" /> </div> ); } } View
  • 9. 9 function Welcome(props) { return <h1>Hello, {props.name}</h1>; } class Welcome extends React.Component { render() { return <h1>Hello, {this.props.name}</h1>; } } Functional • • • Functional
  • 11. LEARN ONCE, WRITE ANYWHERE Java ­ Write once, run anywhere ­ ­ React ­ iOS, android : React Native ­ Win, Mac React Desktop (https://reactdesktop.js.org/) 11https://reactjs.org/blog/2015/03/26/introducing-react-native.html
  • 12. ES2015 ECMASCRIPT2015 12 let let name = 'taro'; name = 'hanako' const const name = 'taro'; name = 'hanako'; // error class class Person { constructor(name){ this.name = name; } } const person = new Person('taro') const fn = (name) =>{ return console.log(name); } const arr = ['a', 'b', 'c']; const arr2 = [...arr]; console.log(arr === arr2); // false const name = 'taro'; console.log(`My name is ${name}.`); // My name is taro. https://babeljs.io/docs/en/learn/ Expo ES6 6th Edition
  • 13. extract(‘test.txt’, function(data1){ transform(data1, function(data2){ load(data2, function(data3){ console.log(‘done: ’, data3); }); }); }); var promise = Promise.resolve(); promise .then(()=> extract(‘text.txt’)); .then(data1=> transform(data1)) .then(data2=> load(data2)) .then((data3)=> console.log(‘done: , data3 ’)) async ()=>{ let data1 = await extract(‘test.txt’); let data2 = await transform(data1); let data3 = await load(data2); console.log(‘done: ’, data3); } ES5 13 ES2015(ES6) Promise, ES2017(ES8) async/await Expo ES8 async/await
  • 14. JSX JAVASCRIPT XML, JAVASCRIPT SYNTAX EXTENSION 14 XML JavaScript <MyButton color="blue" shadowSize={2}> Click Me </MyButton> React.createElement( MyButton, {color: 'blue', shadowSize: 2}, 'Click Me' ) <div className="sidebar" /> React.createElement( 'div', {className: 'sidebar'}, null ) https://reactjs.org/docs/introducing-jsx.html JSX React.createElement(component, props, ...children)
  • 15. DOM DOM ReactDOM DOM DOM React DOM 15 DOM DOM Key {todos.map((todo, index) => <Todo {...todo} key={index} /> )} {todos.map((todo) => <Todo {...todo} key={todo.id} /> )} ID var shortid = require('shortid'); function createNewTodo(text) { return { completed: false, id: shortid.generate(), text } } ID todoCounter = 1; function createNewTodo(text) { return { completed: false, id: todoCounter++, text } } https://reactjs.org/docs/faq-internals.html https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318 shortid ID
  • 17. EXPO SDK ­ Web ­ iOS, Android API ­ API API 17 Core Motion iOS Google Fit Android Pedometer (Expo SDK) API
  • 18. 18 AR Accelerometer Admob Amplitude AppLoading ART Asset Audio AuthSession Web AV BarCodeScanner BlurView Branch Brghtness Calendar Camera Constants ID Contacts DeviceMotion DocumentPicker ErrorRecovery FacebookAds Facebook Graph API FaceDetector FileSystem Font GestureHandler GLView OpenGL ES Google Google Gyroscope Haptic ImageManipulator ImagePicker IntentLauncherAndroid KeepAwake LinerGradient Linking LocalAuthentication Localization Location Lottie Magnetometer MailComposer MapView MediaLibrary Notifications Payments Pedometer Permissions Print registerRootComponent ScreenOrientation SecureStore Segment SMS Speech SplashScreen SQLite StoreReview Svg SVG takeSnapshotAsync Updates Video WebBrowser
  • 20. LOCATION 20 let { status } = await Permissions.askAsync(Permissions.LOCATION); if (status !== 'granted’) console.log('Permission to access location was denied'); Permissions API let location = await Location.getCurrentPositionAsync({}); // address = await Location.reverseGeocodeAsync(loc) // Location.watchHeadingAsync(this._getHeadingAsync) // //
  • 21. PEDOMETER Core Motion iOS Google Fit Android 21 Expo.Pedometer.isAvailableAsync() Expo.Pedometer.getStepCountAsync(start, end) Expo.Pedometer.watchStepCount(callback) https://snack.expo.io/@tygoto/pedometer
  • 22. PEDOMETER 22 componentDidMount() { this._subscription = Pedometer.watchStepCount(result => { this.setState({ currentStepCount: result.steps, }); }); } componentWillUnmount() { this._subscription && this._subscription.remove(); this._subscription = null; } Pedometer.getStepCountAsync
  • 24. CAMERA 24 Camera.Constants.Type.back front ref={ref => { this.cameraRef = ref; }}> let photo = await this.cameraRef.takePictureAsync();
  • 25. OPEN DATA EXPO SDK 25
  • 26. OPEN DATA EXPO SDK http://data.bodik.jp/dataset ­ ­ http://data.bodik.jp/dataset/atmospheric48 ­ ­ http://data.bodik.jp/dataset/401000_koutsuujiko2017 ­ ­ ­ ­ Expo SDK 26
  • 28. React ­ ­ ES2015, JSX, DOM Expo SDK Expo SDK API Open Data Expo SDK ­ Expo SDK ­ 28