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
Native開発者から見たReactNative
Search
y_matsuwitter
March 31, 2015
Programming
8k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Native開発者から見たReactNative
at Gunosy React Meetup
y_matsuwitter
March 31, 2015
More Decks by y_matsuwitter
See All by y_matsuwitter
LLMと共に進化するプロセスを目指して
ymatsuwitter
13
5.3k
Building Products in the LLM Era
ymatsuwitter
11
13k
Product Utilization of Large Language Models Starting Today
ymatsuwitter
3
3.5k
経営・意思・エンジニアリング
ymatsuwitter
23
22k
LLM in 2023 and 2024
ymatsuwitter
8
6.4k
Turbulent Technological Changes and Career Strategies
ymatsuwitter
2
3.2k
LLM in toB Service and Its UX
ymatsuwitter
7
12k
Agent and small LLM validation
ymatsuwitter
7
3.1k
Information management for a culture of speed: The story of Notion and LayerX
ymatsuwitter
4
11k
Other Decks in Programming
See All in Programming
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
590
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
410
AIの中の人になってみる
htkym
0
110
FastAPI の並行処理モデルを完全に理解する
hoto17296
8
2.9k
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
270
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
290
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
170
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
180
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
170
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4.1k
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
140
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
Featured
See All Featured
Designing Powerful Visuals for Engaging Learning
tmiket
1
510
Color Theory Basics | Prateek | Gurzu
gurzu
0
430
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
300
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
480
My Coaching Mixtape
mlcsv
0
270
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
500
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
ラッコキーワード サービス紹介資料
rakko
1
4.5M
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
490
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Transcript
Na#veApp։ൃऀ͔ΒΈͨ ReactNa#ve
Who$am$I? • ։ൃຊ෦ࣥߦһࡶ༻ • iOS,&Android,&Infrastructure,&Web • Golangڭ • ਖ਼࠲ •
࠷ۙؾʹͳΔͷ:&MQTT
ωΠςΟϒ։ൃͰͷελϯε • ωΠςΟϒΞϓϦ֤Pla%orm͝ͱʹ࠷దԽࣗͰΔ • ΫϩεϓϥοτϑΥʔϜʹເݟͳ͍
ReactNa'veͱ • ReactjsϕʔεͰωΠςΟϒΞϓϦ։ൃΛߦ͏ͨΊͷπʔϧηο τɻ • Not+only+for+DOM,+But+for+any+Views. • 03/27ʹɺiOS͚͕ϦϦʔε
ViewͷநԽ • Na$veଆͰjsx*<=>*Na$veͷViewͷมΛߦ͏ • iOSͰjsxΛUIKitʹม͍ͯ͠Δ༷ • ྨࣅ:*ReactCanvas*(jsx*<=>*Canvas)
ReactNa'veΛݟͯΈΑ͏ QiitaͷReactjsλάϦʔμʔΛ࡞ͬͯΈΔ
֤छϞδϡʔϧͷϩʔυ 'use strict'; var React = require('react-native'); var { AppRegistry,
// ΞϓϦͷىಈϙΠϯτ StyleSheet, // ֤ཁૉͷελΠϧ Text, // ςΩετϥϕϧ View, // View ListView, // Ϧετ Image, // ը૾View NavigatorIOS, // iOSͷUINavigationController TouchableWithoutFeedback, //λονΠϕϯτͷऔಘ WebView // WebView } = React; var QIITA_URL = "https://qiita.com/api/v2/tags/reactjs/items";
φϏήʔγϣϯͷఆٛ • ΞϓϦ͕࠷ॳʹىಈ͢ΔViewControllerͱͯ͠ࠓճNaviga0on Λͬͨ // ϕʔεͷUINavigationControllerʹ֘͢Δͷ var ReactQiitaNavigator = React.createClass({
render: function() { return ( <NavigatorIOS style={styles.navigator} initialRoute={{ component: ReactQiitaList, title: 'ReactQiita', }}/> ); } })
Listදࣔ:&ॳظԽ // هࣄҰཡϦετ var ReactQiitaList = React.createClass({ getInitialState: function() {
return { items: new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2, }), loaded: false, }; }, componentDidMount: function() { this.fetchData(); //σʔλͷऔಘʢޙड़ʣ },
ListView:)શମඳը render: function() { if (!this.state.loaded) { // ಡΈࠐΈϏϡʔͷඳըʢࠓճઆ໌লུʣ return
this.renderLoadingView(); } return ( <ListView dataSource={this.state.items} renderRow={this.renderItem} //֤ߦͷඳըϝιουΛࢦఆ style={styles.listView}/> ); },
ListView:)ߦͷඳը :"TouchableWithoutFeedback̎ͭҎ্ͷࢠΛԼʹ࣋ͯͳ͍ renderLoadingView: function() { /*লུ*/ }, renderItem: function(item, sectionID,
rowID) { return ( <TouchableWithoutFeedback onPress={() => this.onPressed(item)}> // Πϕϯτݕ <View style={styles.container}> <Image source={{uri: item.user.profile_image_url}} style={styles.thumbnail}/> <View style={styles.rightContainer}> <Text style={styles.title}>{item.title}</Text> <Text style={styles.name}>{item.user.id}</Text> </View> </View> </TouchableWithoutFeedback> ); },
ListView:)APIͷऔಘ window.fetch͕ඪ४Ͱ͑ΔʢCORSͷ੍ͳ͠ʣ fetchData: function() { fetch(QIITA_URL) .then((response) => response.json()) .then((responseData)
=> { this.setState({ items: this.state.items.cloneWithRows(responseData), loaded: true, }); }) .done(); },
ListView:)Πϕϯτͷॲཧ iOSͰͷViewؒͷભҠprops.navigatorͷpush,4popϝιουͳͲ ͕͑Δ //ηϧͷλονΠϕϯτ onPressed: function(item) { this.props.navigator.push({ title: item.title,
component: ReactQiitaItemView, passProps: { url: item.url } }) },
WebView // هࣄӾཡ༻ͷWebView var ReactQiitaItemView = React.createClass({ render: function() {
return ( <WebView url={this.props.url}/> ) } });
ελΠϧͷهड़ // ֤छσβΠϯཁૉɺҰ෦ൈਮ var styles = StyleSheet.create({ navigator: { flex:
1 }, container: { flex: 1, flexDirection: 'row', justifyContent: 'center', alignItems: 'center', backgroundColor: '#FFFFFF', }, }
ىಈ࣌ΤϯτϦϙΠϯτ AppRegistry.registerComponent('ReactQiita', () => ReactQiitaNavigator);
͜Ε·ͰͷNa#ve։ൃͱͷൺֱ • Reac&veʹॻ͘ํ๏RAC͘Β͍͔͠ແ͔ͬͨ • RAC*...*Reac&veCocoa
Reac%veCocoaͱͷൺֱ • ReactNa(veॻ͖ํ͕γϯϓϧ(ޙड़) • Na(veίʔυͱͷϒϦοδΛ࡞͢Δඞཁ͕͋Δ • iOSඪ४ͱൺͯɺσβΠϯཁૉͷهड़ָ͕ • Viewࣗମͷॻ͖ํָͩͱࢥ͏͕͜Ε·ͩϏϡʔ͕খ͍͞ ͔Βͩͱࢥ͏
RACͷॻ͖ํ ͷมߋΛݕ͢Δ͚ͩͰԼهͷΑ͏ͳهड़ɺ [[RACObserve(self, username) filter:^(NSString *newName) { return [newName hasPrefix:@"j"];
}] subscribeNext:^(NSString *newName) { NSLog(@"%@", newName); }];
ReactNa'veͷίί͕ྑ͍ • UIKitϕʔεʹίʔυͰϏϡʔΛهࡌ͢ΔΑΓָ • xibΑΓهड़͕ʢࠓͷͱ͜Ζʣָ • Reac-veͳهड़͕ඇৗʹগͳ͍ίʔυྔͰॻ͚Δ
ReactNa'veͷίί͕μϝ • fetchͳͲ͕ಠ࣮ࣗͬΆ͍ͷͰnpmͷࢿ࢈͕׆͔ͤΔ͔ • ݁ہUIKitͷֶशͷ্ʹReactNa1veͷಠࣗίϯϙʔωϯτͷֶ श͕ඞཁʹͳΔ • na1veͷϒϦοδRCTBridgeModuleʹै͏
࡞ͬͯͷײ • UIKitͱ͍͏͔iOS)SDKΒͳ͍ͱ࡞Εͳ͍ • ͦͷ্ʹReactjsͱReactNa2veͷ͕ࣝඞཁ • ݸਓతʹReac2veͳna2veΞϓϦ͜Ε͕Ұ൪࡞Γ͍͢ͱࢥ ͏ • iOSॻ͚ͯReactjs͔͚ΔਓҎ֎Θͳ͍ํ͕ྑͦ͞͏
• ܶతʹ։ൃΛϥΫʹ͢ΔͷͰͳ͍
࠷ޙʹ • ReactNa(veΫϩεϓϥοτϑΥʔϜͷͨΊͷΈ͡Όͳ͍ ʢͱࢥ͍ͬͯΔʣ • Reac(veͷจ຺Λ࣋ͪࠐΈͯ͘͘͢͠ΕΔSDK • ֤ϓϥοτϑΥʔϜͱReactͷ͕ࣝ͋ΕΑΓΑ͍։ൃ͕Մೳ
ָ͠Α͏ͱࢥ͏ͳΒ (Java|Swi)) ॻ͖·͠ΐ͏