Slide 1

Slide 1 text

ʮ͸΍͍ɺ΍͍͢ɺ͏·͍ʁʯ React Native kawasaki.rb #047 @MasaruTech

Slide 2

Slide 2 text

ΞδΣϯμ ▸ ࣗݾ঺հ ▸ React Nativeͱ͸ ▸ ͸΍͍ ▸ ΍͍͢ ▸ ͏·͍ʁ

Slide 3

Slide 3 text

ࣗݾ঺հ ▸ Rails࢖͓ͬͯ࢓ࣄͯ͠ΔΤοεΞΠΞʔ ▸ kawasaki.rb#046͔ΒࢀՃ ▸ ͜͜2ϲ݄ͪΐͬͱϓϥΠϕʔτͰReact NativeΛ࢖ͬͯ ΞϓϦΛ࡞ͬͯΈ͍ͯΔͱ͜Ζ ▸ Swift/Xcode͸ॳ৺ऀɺAndroid͸ະܦݧ େఉɹকʢΦΦόɹϚαϧʣ

Slide 4

Slide 4 text

React Native

Slide 5

Slide 5 text

React Nativeͱ͸ ▸ Facebook੡ͷReact.jsϕʔεͰωΠςΟϒΞϓϦ͕࡞੒Ͱ͖ ΔϑϨʔϜϫʔΫ
 (React 3ܑఋͷ࣍உ) ▸ Webͷ஌ࣝ/ٕज़(JS, CSS LikeͳStyle, npm)Ͱ։ൃͰ͖Δ ▸ ΫϩεϓϥοτϑΥʔϜͰ͸ͳ͍
 (Learn once, write anywhereɿҰ౓ֶ΂͹ɺͲ͜Ͱ΋ॻ͚Δ)

Slide 6

Slide 6 text

͸΍͍ɺ΍͍͢ɺ͏·͍ʁ

Slide 7

Slide 7 text

͸΍͍

Slide 8

Slide 8 text

։ൃ଎౓଎͍ ▸ ίϯύΠϧ͸ॳճىಈ࣌ͷΈ
 Ҏ߱͸ίʔυΛมߋͯ͠΋࠶ίϯύΠϧͤͣʹߋ৽Մೳ ▸ npmͷϥΠϒϥϦ͕࢖͑Δ ▸ ωΠςΟϒͷAPI஌Βͳͯ͘΋Կͱ͔ͳΔ
 ެࣜͷυΩϡϝϯτಡΊ͹େମͲ͏ʹ͔ɾɾɾ ▸ σόοά΋׳ΕͨChromeͷDeveloper Tool͕࢖͑Δ

Slide 9

Slide 9 text

ಈ࡞଎͍ ▸ UI͸ωΠςΟϒଆͰඳը͞ΕΔ
 ωΠςΟϒͷUIΛ௚઀JS͕ίϯτϩʔϧ ▸ List౳ɺύϑΥʔϚϯεͷ࠷దԽ͕͞Ε͍ͯΔ ▸ JSͰΰϦΰϦʹॲཧΛॻ͘ͱ஗͘ͳΔ(Β͍͠)

Slide 10

Slide 10 text

΍͍͢

Slide 11

Slide 11 text

͸͡Ί΍͍͢ ▸ JSͰهड़͢ΔͷͰɺWebͷ஌ࣝ͑͋͞Ε͹swift/javaΛ஌Β ͳͯ͘΋ΞϓϦΛ࡞ΕΔ ▸ Babel΋React Native͕Α͠ͳʹͯ͘͠ΕΔͷͰɺReact.jsͷ Α͏ʹઃఆ౳ΛؾʹͤͣES2015/2016Ͱॻ͚Δ

Slide 12

Slide 12 text

ViewΛ૊Έ΍͍͢ ▸ ͜Εʹਚ͖Δ ▸ ॳ৺ऀʹ͸SwiftɺXcodeͷIB(Interface Builder)ͰViewΛ૊ Ήͷ͸೉͍͠
 UIܥΛશͯIBͰࢦఆͰ͖ͳ͍ɻɻɻ ▸ CSSʹࣅͨهड़Ͱॻ͚ΔͷͰWebͷΑ͏ʹσβΠϯ͕Ͱ͖Δ

Slide 13

Slide 13 text

Viewͷྫ return ( {item.username} {item.accountNo} {item.postedAt} {item.message} );

Slide 14

Slide 14 text

const styles = StyleSheet.create({ container: { padding: 10, borderBottomColor: '#ededed', borderBottomWidth: 1, backgroundColor: 'transparent', flexDirection: 'row', }, thumbnail: { width: 34, height: 34, borderRadius: 17 }, mainContainer: { flex: 1, flexDirection: 'column', marginLeft: 10, }, header: { flexDirection: 'row', }, userInfo: { flex: 1, flexDirection: 'row' }, username: { fontSize: normalize(16), color: colors.grey1, fontWeight: '800' }, accountNo: { color: colors.grey3, fontSize: normalize(12), marginLeft: 5, marginTop: 3 }, postedAt: { color: colors.grey3, fontSize: normalize(12), marginTop: 3 }, messageContainer: { flexDirection: 'row', marginTop: 10 }, });

Slide 15

Slide 15 text

͏·͍ʁ

Slide 16

Slide 16 text

͏·͍Ͱʒ͔͕ͨͬͨࢥ͍͔ͭͳ͔ͬͨ ͳͷͰศརͳϦϩʔυػೳΛ঺հ

Slide 17

Slide 17 text

Ϧϩʔυ ▸ Reload(⌘+R)
 ௨ৗͷϦϩʔυ ▸ Live Reload
 ϑΝΠϧʹมߋ͕͋ΔͱࣗಈͰϦϩʔυ
 State͕ॳظঢ়ଶʹͳΔ ▸ Hot Reload
 ϑΝΠϧʹมߋ͕͋ΔͱࣗಈͰϦϩʔυ
 State͸อ࣋ͨ͠··

Slide 18

Slide 18 text

·ͱΊ ʮ͸΍͍ɺ΍͍͢ɺ͏·͍ʯ ↓ ʮ͸΍͍ɺ΍͍͢ɺ΂ΜΓʯͰͨ͠

Slide 19

Slide 19 text

͓ΘΓ ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠