Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Firebase and React Native
Search
SAWA, Norihiko
July 13, 2016
Technology
770
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Firebase and React Native
SAWA, Norihiko
July 13, 2016
More Decks by SAWA, Norihiko
See All by SAWA, Norihiko
OCR Optimized for Images Created by Print Typesetting
nakamods320yen
0
160
データサイエンスを活用した契約資産価値評価(LTV)とその改善 / Lifetime Value as Asset Pricing with Data Science
nakamods320yen
1
160
日本経済新聞社 デジタル人材採用案内 / Nikkei Digital Hiring
nakamods320yen
1
49k
AI making new content
nakamods320yen
0
8.4k
Dive into E2D3
nakamods320yen
0
500
Other Decks in Technology
See All in Technology
複数プロダクト組織のAIネイティブ化における戦略 / AICon2026_kude
rakus_dev
0
330
Webの技術とガジェットで子どもも大人も楽しめるワクワク体験を提供する / Qiita Tech Festa Day 2026
you
PRO
1
290
システム監視入門
grimoh
2
560
テックカンファレンス三大ステークホルダーの文化人類学 ─ 違いを認め合う関係性作り
bash0c7
2
650
ダッシュボード"開発"について 〜使われるダッシュボードのつくりかた〜
kimichan
0
220
論語・武士道・産業革命から見る かわるもの、かわらないもの
ichimichi
7
1.1k
PHPで作って学ぶリアルタイム音声対話AIとWebSocket入門 by ムナカタ
munakata
0
160
QA・ソフトウェアテスト研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
1
460
探索・可視化・自動化を一本化 Amazon Quickでデータ活用スピードを上げる方法
koheiyoshikawa
0
210
AI Native なプロダクト組織の立ち上げ方 : 生産性 100 倍への挑戦
mikesorae
0
1.5k
キャリアLT会#3
beli68
2
270
AI時代におけるエンジニアの新たな役割──FDEとクオリアの探求/登壇資料(戸井田 裕貴)
hacobu
PRO
0
450
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Odyssey Design
rkendrick25
PRO
2
730
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
500
Designing for Performance
lara
611
70k
RailsConf 2023
tenderlove
30
1.5k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
420
Scaling GitHub
holman
464
140k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Making Projects Easy
brettharned
120
6.7k
How to build a perfect <img>
jonoalderson
1
5.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
6TJOH'JSFCBTF3FBMUJNF%BUBCBTFCZ3FBDU/BUJWF 4"8" /PSJIJLPຊܦࡁ৽ฉࣾσδλϧฤہ 3FBDU/BUJWFBOE'JSFCBTF
2 4"8" /PSJIJLP %FWFMPQBOE1MBO/JLLFJ0OMJOF %KT3FBDU/BUJWF "CPVUNF
'JSFCBTF3FBMUJNF%BUBCBTF 3
4 #BB4 σʔλߋ৽͕Ϋϥυʹอଘ͞ΕϦΞϧλΠϜͰಉظ Ͱ͖Δ 'JSFCBTF3FBMUJNF%BUBCBTF IUUQTZPVUVCF6BF.EW6Q"
3FBDU/BUJWF 5
6 +BWB4DSJQU &4 ͰJ04"OESPJEΞϓϦ͕ॻ͚Δ 3FBDU/BUJWF IUUQTGBDFCPPLHJUIVCJPSFBDUOBUJWF
7 3FBDU/BUJWF4IPXDBTF IUUQTGBDFCPPLHJUIVCJPSFBDUOBUJWFTIPXDBTFIUNM
-FU`TTUBSU 8
9 'PMMPXJOHUIJT1PTU IUUQTpSFCBTFHPPHMFCMPHDPNUIFCFHJOOFSTHVJEFUPSFBDUOBUJWFBOE@IUNM
10 OQNͰ'JSFCBTFΛΠϯετʔϧ 'JSFCBTFTFUVQ KTϑΝΠϧͰಡΈࠐΈ const Firebase = require('firebase'); npm install
firebase --save
11 %FDMBSF%BUB4PVSDF 1 constructor(props) { 2 super(props); 3 this.state =
{ 4 dataSource: new ListView.DataSource({ 5 rowHasChanged: (row1, row2) => row1 !== row2, 6 }) 7 }; 8 this.itemsRef = new Firebase("<my-fb-app>/items"); 9 }
12 *OJUJBMJ[FMJTUXIFOUIFDPNQPOFOUIBTpSTUCFFOSFOEFSFE 1 listenForItems(itemsRef) { 2 itemsRef.on('value', (snap) => {
3 // get children as an array 4 var items = []; 5 snap.forEach((child) => { 6 items.push({ 7 title: child.val().title, 8 post_time: child.val().post_time, 9 userID: child.val().userID, 10 _key: child.key() 11 }); 12 }); 13 this.setState({ 14 dataSource: this.state.dataSource.cloneWithRows(items) 15 }); 16 }); 17 } 18 19 componentDidMount() { 20 this.listenForItems(this.itemsRef); 21 }
13 DPNQPOFOUT 1 render() { 2 return ( 3 <View
style="{styles.container}"> 4 <ListView 5 dataSource="{this.state.dataSource}" 6 renderRow=“{this._renderItem.bind(this)}" 7 style="{styles.listview}/"> 8 </View> 9 ); 10 }
14 "EE*UFN 1 this.itemsRef.push({ 2 title: this.tmpText, 3 post_time: Firebase.ServerValue.TIMESTAMP,
4 userID: userID 5 });
15 3FNPWF*UFN 1 _renderItem(item) { 2 const onPress = ()
=> { 3 AlertIOS.prompt( 4 'Delete', 5 null, 6 [ 7 {text: 'Delete', onPress: (text) => this.itemsRef.child(item._key).remove()}, 8 {text: 'Cancel', onPress: (text) => console.log('Cancel')} 9 ], 10 'default' 11 ); 12 }; 13 return ( 14 <ListItem item={item} onPress={onPress} /> 15 ); 16 }
$PODMVTJPO 16
17 3FBDU/BUJWFͰͷ'JSFCBTFͷه๏ʹετϨεͳ͍ ʢ·ͩʣ 3FBDUͷTUBUFཧͱɺ'JSFCBTFͷಉظ૬ੑ͕ྑͦ͞͏ $PODMVTJPO “This is where React fits
perfectly with Firebase. Because the Firebase database synchronizes application state across multiple devices, and React efficiently re-renders application state changes.”
18 OBUJWF4%,ΛΠϯετʔϧͯ͠ͳ͍ A4MPX"OJNBUJPOTAϞʔυͩͱ 8FC7JFX͕ݟΕΔ ͓ͦΒ͘+4Ͱಈ͍ͯΔ )PXUPXPSL
IUUQTOJLLFJDPNTBJZP +PJOVT% 19