React Nativeã¯ã¢ããªéçºè ã®å¤¢ãè¦ããï¼
ES6ã¨Reactã®åå¼·ãå ¼ãã¦ãReact Nativeã§iOSã¢ããªã¨Androidã¢ããªãä½ã£ã¦ã¿ã¾ããã
ã¢ãã¡ã°ããºã®æå®å¤ãæ¤ç´¢ããã¢ããªã§ãã
React Nativeã¯JavaScriptãæ¸ããã°iOSã¢ããªã¨Androidã¢ããªãä½ãã¾ãã ããã«å ãã¦HTML5ã®ãã¤ããªããã¢ããªã¨ã¯éããé«éã«åä½ããã¨è¬³ããããã©ãããã©ã¼ã ã§ãã
ã³ã¼ãã®å ±éåãã§ãã¦ããããé«éã¨ããã®ã¯éçºè ã«ã¯ã¨ã¦ãé åçã§ãã
ã¿ã¤ãã«ã¯ãããã£ãªã®ã§å°ã 大ãããªæãããã¾ãããå®éã«ä½ã£ã¦è²ã ã¨åããã¾ããã®ã§ã React Nativeã«ã¤ãã¦è»½ãç´¹ä»ãã¤ã¤ãããããå°å ¥ãæ¤è¨ãã¦ãã人åãã«æ¸ãã¦ã¿ã¾ãã
ãã£ããã¨ããã¾ã¨ã
é·ãè¨äºãªã®ã§ãå¿ãã人åãã®ãã£ããã¨ããã¾ã¨ããç½®ãã¦ããã¾ãã
è¯ãã¨ãã
- iOSã¢ããªã¨Androidã¢ããªãã»ã¼å ±éã®ã³ã¼ãã§ä½ãã
- è¨èª(ES6)ã®ç¿å¾ã³ã¹ããä½ãï¼æ°ããSwift,Objective-C,Java,Kotlinãªã©ãè¦ãããã¨ã«æ¯ã¹ãã°ï¼
- ã©ã¤ããµã¤ã¯ã«ãæèããªãã¦ãéçºãã§ãã
- flexboxã使ããã®ã§ãæãéãã®ã¬ã¤ã¢ã¦ãã«ãããã
- ãã«ãå¾ ã¡ã®ã¹ãã¬ã¹ãã解æ¾ããã
- ãã¤ãã£ãã¢ããªã®éçºçµé¨ããªãã¦ãé å¼µãã°ä½ã¨ããªã
- æè¡çéå£ãä½ããã¨ã§ã¨ã³ã¸ãã¢ãæã¾ãããã
è¾ãã¨ãã
- éçºé度ã¨æè¡ç容æããç¶æããã«ã¯UIãããç¨åº¦ç ç²ã«ããå¿ è¦ããã
- UIã¯ãã¤ãã£ãã³ã¼ãã§å®è¡ããããããã¸ãã¯ã¯ES6(JavaScript)ãªã®ã§ãéãå¦çã¯è¦æ
- UIã®çµã¿æ¹ã«ãã£ã¦ã¯ãåä½ãé ãã±ã¼ã¹ããã
- UIã«åãã ãã¨ãã¤ãã£ãã³ã¼ããå¿ é ã«ãªã
- ã¾ã çºå±éä¸ã®ããããã¼ã¸ã§ã³ã«ãã£ã¦æåãå¤ãããã¨ãå¤ã
- ãµã¼ããã¼ãã£è£½ãã¼ã«ã¯å¤ãããã¡ã«ã¡ã³ãããã¦ãã½ã¼ã¹ãå°ãªã
- ã¡ã¢ãªã®ä½¿ç¨éãå¤ããã(ã¢ããªã®æ§é ã«ãããã¨æãã¾ã)
ãããªã±ã¼ã¹ã«ãããã
Androidã¨ã³ã¸ãã¢ã¨ãiOSã¨ã³ã¸ãã¢ãæã£ã¦ãã¦ã UX/UIã«ã¯ãã ãããããªããåºæ¬çã«ã¯æãåºããã¦ãããããç¥ãã¾ãã
ã³ã¼ãã®å ±éåãã¯ãããªãC++ã¨ãã§éçã©ã¤ãã©ãªãæ¸ãã¦ã iOSã¯ãã®ã¾ã¾ä½¿ããAndroidã§ã¯NDKã使ãã®ããã¿ã¼ã¨æãã¾ãã
ãã以å¤ã§ã¯ä¸è¨ã®ãããªã±ã¼ã¹ã«ãã¦ã¯ã¾ãå ´åã¯React Nativeããªã¹ã¹ã¡ã§ãã
- Webéçºè ããããªããã©ãã¢ããªãä½ã£ã¦ã¿ãã
- ã¨ã«ããéçºã¹ãã¼ããæ±ãããã
- ã©ãããã»ãããã¿ã¤ãã³ã°ã¨ãã¦ä¸ã«ã ãã¦ããæ¹åãã¦ãããã
æ¬æ°ãªã¢ã¤ãã¢ã®äºæ¥ãå¤ããã¹ã¿ã¼ãã¢ãããªããã¯ããããç¥ãã¾ããã ã¢ããªåã¯ããã¯å¿ é ã«ãªã£ã¦ãã¦ãã¾ãããã¡ããã¨ããã¢ããªãä½ãã人æã確ä¿ããã®ã¯å¤§å¤ã ã¨æãã¾ãã
React Nativeã¯Webéçºã®æè¡ãããã°ä½ã¨ããªãã®ã§ã UIçã«ã¯æªçã ãã©ãã¨ã«ããæ°ããäºæ¥ãåºãããã±ã¼ã¹ã«ã¯æé©ã¨æãã¾ãã
売ä¸ãä¸ãã£ã¦ããã¤ãã£ãã®ã¨ã³ã¸ãã¢ãæããããã¿ã¤ãã³ã°ã§ãã¤ãã£ãã«ç§»è¡ãããããã ãã®ã¾ã¾Reactãã¼ã¹ã§åã£ãUIãå®ç¾ã§ããããã«ãããããã¨ãé¸æè¢ãåºããã¾ãã
åææ¡ä»¶
- ReactNative 0.29
- Xcode 7.3.1
- Android Studio 2.1
- çè ã¯iOSã¢ããªãAndroidã¢ããªå ±ã«éçºçµé¨ããã
- Reactã¯å ¨ãã®åãã¦ãæ¦å¿µãããã¯Webã®è¨äºã§èªãã§ç¥ã£ã¦ããç¨åº¦ã
- JavaScriptèªä½ã¯jQueryããªãã¦ãä¸éãã®æ©è½ãå®è£ ã§ãããããã
- CSSã¯æ®éã«æ¸ããã
React Nativeã¨ã¯?
ç¹å¾´
Facebookã2015å¹´ã«å ¬éãããã¢ããªéçºã®ãã©ãããã©ã¼ã ã§ãã JavaScriptã§ã³ã¼ããæ¸ããªããããUIã¯é«éã«åä½ãããã¨ãç¹å¾´ã§ãã
æè¿äººæ°ãã§ã¦ãã¦ããNative Scriptãå¾å¹´ã®Titaniumãåããããªã³ã³ã»ããã§ããã æ大ã®ç¹å¾´ã¯Reactã®ä»çµã¿ã§ã¢ããªãä½ããã¨ãããã¨ã§ãã
æªããªãããã©ã¼ãã³ã¹
JavaScriptã§ä½ãããã¢ããªã¨è¨ãã°ããã¤ã¦ã¯åå¿ãæªãã¢ããªã®ä»£åè©çãªåå¨ã§ããã
ãã®çµæãã¢ããªéçºã®é»ææã«å¤§éã«ä½ããã¦ããHTML5ã®ãã¤ããªããã¢ããªã¯å½±ãæ½ãã ç¾å¨ã¯ãã¤ãã£ãã¢ããªã主æµã¨ãªã£ã¦ãã¾ãã
Facebookã¯HTML5ãæ¨é²ãã¦ãããã¨ãããã éå»ã«èªç¤¾ã®Facebookã¢ããªãHTML5ã®ãã¤ããªããã¢ããªã¨ãã¦æä¾ãã¦ããææãããã¾ããã
ããããããã©ã¼ãã³ã¹ã®æªãããã¦ã¼ã¶ã¼ã®è©ä¾¡ãèããä½ãã ãã¤ãã£ãã¢ããªã«åãæ¿ããããå¾ãªãç¶æ³ã«é¥ãã¾ããã
ãã¼ã¯ã»ã¶ãã«ã¼ãã¼ã°ã¯å¾ã«HTML5ã«è³ããã®ã¯æ大ã®å¤±æã ã£ãã¨ã¾ã§çºè¨ãã¦ãã¾ãã
ãã®éç¨ã§çã¾ãããã®ãªã®ãã¯å®ãã§ã¯ãªãã§ãããHTMLãé«éã«ã¬ã³ããªã³ã°ã§ããReact.JSãä¸ã«åºããã®ã2013å¹´ã ãã®2å¹´å¾ã®2015å¹´ã«ã¯ãã¤ãã£ãã¢ããªãéçºã§ããReact Nativeãçºè¡¨ããã¾ããã
React Nativeã¯JavaScriptã§ä½ãããã¢ããªã®ããã©ã¼ãã³ã¹åé¡ã解決ãããããã¯ãã§ãããFacebookãã¢ããªéçºã«å¯¾ãã¦åºããçãã®ä¸ã¤ã§ãã
ã©ã®ããã«ããã©ã¼ãã³ã¹ãåä¸ãããã?
- JavaScriptã§éçºãè¡ããªããããUIã¯ãã¤ãã£ãã®ã³ã¼ãã§å®è¡
- ãã¥ã¼ã®æç»æã«ã¯React.JSã§å¹ã£ãä»®æ³DOMã®æè¡ãå©ç¨
- JSXã¨å¼ã°ããXMLã«ä¼¼ãæ§æã§ãã¥ã¼ãå®ç¾©ãåãã©ãããã©ã¼ã ã§ã®å®è¡æã«ãã¤ãã£ãã®ã³ã¼ãã¸ã¨å¤æãã
React.JSã§å¹ã£ãæè¡ãæ大éã«ä½¿ããã¨ã§ãããã©ã¼ãã³ã¹ãåä¸ããã¦ãã¾ãã
æ¢ã«Facebook製ã®ã¢ããªã®å¤ããReact Nativeã§ä½ããã¦ããã ãã¤ãã£ãã¢ããªã¨åãããã«æ±ãããã¨ãå®æã§ãã¾ãã
å¿ è¦ã¨ãããç¥è
- ES2015 a.k.a ES6 (ç°¡åã«è¨ãã¨JavaScriptã®æ©è½ãå¼·åããè¨èªã§ã)
- React(React.JSã®ç¥èãããã°ããã«ã§ãä½ãå§ãããã¾ã)
- CSS (CSSèªä½ã¯åãããªãã¦ãiOSãAndroidã®éçºã§ããã¥ã¼ãXMLã§æ¸ãããªãåé¡ãªã)
- npmçã®å¨è¾ºãã¼ã«ã®ç¥è(éçºãå§ããã°èªç¶ã¨è¦ãããã¾ã)
åºæ¬çã«ã¯Webéçºã®ç¥èãããã°ãã¢ããªãéçºãããã¨ãå¯è½ã§ãã
ãã ããã¤ãã£ãã¢ããªã®ç¥èãããã«ããããã¨ã¯ãªãã®ã§ã iOSã¨Androidã¢ããªã®ãã¥ã¼ããªã¢ã«ç¨åº¦ã¯ãã£ã¦ãããæ¹ãè¯ãã¨æãã¾ãã
ES2015
JavaScriptã®å ã¨ãªã£ã¦ãããECMAScriptã®ç¬¬6çã¨ãã¦ãªãªã¼ã¹ãããã®ãES2015(ES6)ã§ãã
ãããã¿ã¤ããã¼ã¹ã®è¨èªã«ã¯ã©ã¹æ§æãå°å ¥ãããªã©å¤§ããå¤ãã£ããã¼ã¸ã§ã³ã§ã å¾æ¥ã®JavaScriptãæ³åãã¦ããã¨å ¨ãã®å¥è¨èªã«è¦ããã¨æãã¾ãã
ã¯ã©ã¹ã«å ãã¦ãimportãªã©ã®ã¢ã¸ã¥ã¼ã«ã®æ¦å¿µãå ¥ã£ã¦ãã¦ãã¾ãã®ã§ã ãã®è¾ºãã ãå¦ã¹ã°ã¨ããããã¯éçºã§ããã¨æãã¾ãã
ãã ãSwiftãJava8,Kotlinã¨æ¯ã¹ãã¨è¨èªçãªè²§å¼±ãã¯å¦ãã¾ããã ã§ãããè¨èªãã®ãã®ã®å ç¢æ§ãç ç²ã«ãã代ããã«ãéçºäººå£ã®å¤ãJavaScriptã§ä½ããã¨æãã°æªãã¯ãªãã¨æãã¾ãã
React
React Nativeã®ä¸å¿ã¨ãªããReactã«ã¤ãã¦ã¯æåã«ããç¨åº¦å¦ãã§ãããæ¹ãããã§ãã
åã¯å¤å°ã®ç¥èã ãã¯ãã£ãã®ã§ããã®ã¾ã¾ã³ã¼ããæ¸ãå§ãã¾ãããã Reactã®æ¦å¿µãææ³ãç解ããä¸ã§ä½¿ããªãã¨ãã¾ã¨ããªã³ã¼ããæ¸ããªãã¨æãã¾ãã
1ã2æ¥ããã°å¤§ä½ã®ãã¨ã¯ç解ã§ããã¨æãã¾ãã®ã§ãéçºã®åã«ããç¨åº¦ã¯ç¥èãå ¥ãã¦ãããã¨ããªã¹ã¹ã¡ãã¾ãã
éã«React.JSã®éçºè ã§ããã°ãããã«ã§ãéçºãé²ããããã¨æãã¾ãã
ä»åã¯ä½ããªãããReactã®è¯ãã課é¡ã¨ãªã£ã¦ãããã¨ãå®æã§ããã®ã§ã ã¨ã¦ãè¯ãçµé¨ã«ãªãã¾ããã
æåã¯ã³ã¼ãã®ä¸ã«JSXãå ¥ã£ã¦ãããã¨ã¸ã®éåæãå端ãªãã®ã§ããã ã³ã³ãã¼ãã³ãåããããã®ã¨æãã°ããã®æ¸ãæ¹ãèªç¶ã«æãã¦ãã¾ãã
é ãåãæ¿ãã¦Reactã®ææ³ã«å¾åããã®ããç¿å¾ã¸ã®è¿éã§ãã
React.JSã®å ´åã¯HTML/CSSã³ã¼ãã¼ã¨ã¨ã³ã¸ãã¢ã®åæ¥ãæã 話é¡ã«ãããã¾ããã ã¢ããªéçºè ãªãHTMLã»ã©åæ¥åã¯é²ãã§ããªãã¨æãã¾ãã®ã§ãReactã¨ããä»çµã¿ã¯ãããã¢ããªåãã¨æãã¾ãã
éçºç°å¢
ãã¤ãã£ãã¢ããªéçºæã«ä½¿ãXcodeãAndroid Studioã®ãããªãçµ±åéçºç°å¢ã¯ããã¾ããã
æã«é¦´æãã ã¨ãã£ã¿ã¨ããã©ã¦ã¶ã®éçºè ãã¼ã«(ãããã°ã«å©ç¨)ã§éçºãããã¨ã«ãªãã¾ãã
åã¯Atomã§éçºãã¾ããã
ES6ãReactåãã®ãã©ã°ã¤ã³ãå ¥ãã¦éçºãã¾ãããããã¤ãã£ãéçºã§ä½¿ããIDEã¯åªç§ãªã®ã§ãIDEããªãã®ã¯æ®å¿µã§ãã
ä»å¾ã®çµ±åéçºç°å¢ã®ç»å ´ã«æå¾ ãã¾ãããã
ãã¥ã¼
åºæ¬çãªæ¸ãæ¹
React.JSã¨åæ§ã«JSX(DeNAãéçºãã¦ããè¨èªã¨ã¯å¥ãã®)ã§æ¸ãã¦ããã¾ãã
ç°¡åãªãã®ã ã¨ä»¥ä¸ã®ãããªæãã§ãã
class MySample extends Component { render() { return ( <View style={{backgroundColor: "blue"}}> <Text> Hello World! </Text> </View> ); } }
ã¹ã¿ã¤ã«ã¯ã¤ã³ã©ã¤ã³æå®ãã¦ãã¾ããããåããã®ãä¸è¬çã§ãã ä¸è¨ã®ã³ã¼ãã ã¨ä¸è¨ã®ãããªæãã«ãªãã¾ãã
class MySample extends Component { render() { return ( <View style={styles.mystyle}> <Text> Hello World! </Text> </View> ); } } const styles = StyleSheet.create({ mystyle: { backgroundColor: "blue", } });
ãããªæãã§æ¸ãã¦ããã¨ãReact Nativeãç¨æãã¦ããæ¨æºã³ã³ãã¼ãã³ãã«ã¤ãã¦ã¯ã Androidåãã¨iOSåãã«èªåã§ãã¤ãã£ãã³ã¼ãã«å±éãã¦ããã¾ãã
æ¨æºã³ã³ãã¼ãã³ãã§å¯¾å¿ã§ããªãå ´åã¯ã©ãããã®ï¼
ãã¤ãã£ãã³ã¼ãã¨é£çµã§ããä»çµã¿ãããã¾ãã®ã§ã æ¨æºã§æä¾ãã¦ããªãUIã¯ãã¤ãã£ãã³ã¼ããæ¸ãã¦ãããã¨ã«ãªãã¾ãã
iOSã§ããUITableViewã¯æ¨æºã§æä¾ããã¦ããªãããã ãµã¼ããã¼ãã£ã®ã³ã³ãã¼ãã³ããåå¨ãã¦ãã¾ãã
ã³ã¼ãã®å ±éåã¨ããç¹ããã¯å¤ãã¦ãã¾ãã¾ãããææªã¯ãã¤ãã£ãã®ã³ã¼ããæ¸ãã°ä½ã¨ããªãã¾ãã
ã¬ã¤ã¢ã¦ã
ã¬ã¤ã¢ã¦ãã¯CSS3ã®flexboxã¨ããæ¦å¿µã使ã£ã¦è¡ãã¾ãã
ç¹ã«é£ããã¨ããã¯ãªãã®ã§ãä¸è¨ãèªãã°ããã«ç解ã§ããã¨æãã¾ãã
åãã¦ã®äººã«ã¯é£è§£ãªiOSã®AutoLayoutã¨æ¯ã¹ãã¨ãã¨ã¦ãåãããããã¬ã¤ã¢ã¦ããçµãã¾ãã
è¤éãªã¬ã¤ã¢ã¦ããçµããã¨ããã¨ããã¥ã¼ã®é層ãæ·±ããªãã¾ãããä»ã®ã¨ããã¯ç®ã«è¦ãã¦ããã©ã¼ãã³ã¹ã®å£åãæãããã¨ã¯ããã¾ããã§ããã
ã¢ãã¡ã¼ã·ã§ã³
ã¢ãã¡ã¼ã·ã§ã³ã«ã¤ãã¦ã®APIãç¨æããã¦ãã¦ãç°¡åã«ä½¿ããæãã®ããã§ããã ä»åã¯ç¹ã«ä½¿ãã¾ããã§ããã
ããã¥ã¡ã³ããããã£ã¨èªãã ç¨åº¦ã§ããããã»ã©è¤éãªã¢ãã¡ã¼ã·ã§ã³ã§ãªãéãã¯åé¡ãªãããã§ãã
ã©ã¤ããµã¤ã¯ã«
ãã¤ãã£ãã¢ããªãéçºãã¦ããã¨ãå«ã§ãã©ã¤ããµã¤ã¯ã«ãæèããªããã®éçºã«ãªãã¾ããã React Nativeã¯ç¶æ ã§å ¨ã¦ã管çãããããã©ã¤ããµã¤ã¯ã«ãã»ã¼æèããã«éçºãããã¨ãå¯è½ã§ãã
ããã¯ã¨ã¦ã大ããªå¹æããããéçºå¹çãä¸ããã¨æãã¾ãã
React Nativeã«ãã³ã³ãã¼ãã³ãããã¦ã³ããããããã¬ã³ããªã³ã°ãããã¿ã¤ãã³ã°çã® ã©ã¤ããµã¤ã¯ã«ãä¸å¿åå¨ãã¾ãããä»åã¯ã»ã¨ãã©ä½¿ãã¾ããã§ããã
ã©ã¤ããµã¤ã¯ã«ãæèããªãã§éçºã§ããã
ããã¯React Nativeã®å¤§ããªã¡ãªããã®ä¸ã¤ã§ãã
ã³ã¼ãã®å ±éå
React Nativeã®æ¨æºã³ã³ãã¼ãã³ãã使ã£ã¦ããã°ãåºæ¬çã«Viewã使ãã¾ããã¾ãã OSãããæãã®UIã§ã¯ãªããªãã¾ãããã³ã¼ãã®å ±éåãã§ããã®ã¯å¤§ããã¨æãã¾ãã
ä»åã¯UIã«ããã¾ã§ãã ãããªãã£ãã®ã§ã8å²ã9å²ãããã¯å ±éã®ã³ã¼ãã§æ¸ãã¾ããã
ãµã¼ããã¼ãã£è£½ã®ã³ã³ãã¼ãã³ããå å®ãã¦ããã°ãåå¥ã§ã³ã¼ããæ¸ãå¿ è¦ã¯ã©ãã©ãå°ãªããªãããã§ãã
ã³ã¼ããåããå ´åã¯?
ä¸çªã¹ãã¼ããªã®ããiOSç¨ã¨Androidç¨ã®ã³ã³ãã¼ãã³ããä½ãã®ããããã¨æãã¾ããã ä»åã¯å¤§å ã®ããã²ã¼ã·ã§ã³ä»¥å¤ã¯ä¸ã¤ã®ã³ã³ãã¼ãã³ãå ã§åå²ããã¾ããã
ãã¨ãã°ãiOSã§ã¯SFSafariViewã使ããããã©ãAndroidã¯å é¨ãã©ã¦ã¶ã§ã¯ãªãã æ¨æºãã©ã¦ã¶ã§è¦ãããæã¨ãã§ãã
è¯ãããæ¹ãè¦ã¤ãããªãã¦ãpropsã«ãisAndroidãã¿ãããªã®ã渡ãã¦æ¡ä»¶åå²ããã¾ãããã propsã®ãã±ããªã¬ã¼ã«ã¯ããããªãã®ã§ããå°ãã¹ãã¼ãã«æ¸ãããã¨ããã§ãã
ã¯ã©ã¹ãç¶æ¿ãããããã°ãä¸æãã¾ã¨ã¾ããããªã®ã§ããã®è¾ºã¯ä»å¾ã®èª²é¡ã¨ãã¦ãã¾ãã
ããã©ã¼ãã³ã¹
UIé¢ã¯ãã¤ãã£ãã®ã³ã³ãã¼ãã³ãã使ããã¦ããã®ã§ããããåé¡ãªãã®ã§ããã ã¬ã¤ã¢ã¦ãã«ãã£ã¦ã¯æç»ã«æéãæãã£ããããã±ã¼ã¹ãããã¾ããã
ãã¨Androidã«ã¤ãã¦ã¯å¤ã端æ«ã ã¨å ¨ä½çã«ãã£ãããªæã¯å¦ããªãã§ãã å ¬å¼ã®ããã¥ã¡ã³ãã«UIããã©ã¼ãã³ã¹ã®ãããã¡ã¤ãªã³ã°æ¹æ³ãããã®ã§ãå ´åã«ãã£ã¦ã¯ãã¥ã¼ãã³ã°ãå¿ è¦ã¨ãªãããç¥ãã¾ããã
ReactNativeã®ãã¼ã¸ã§ã³ã¢ããã§æé©åãé²ãã°è§£æ¶ãããããç¥ãã¾ãããã ç¾ç¶ã§ã¯Androidçã®ãã¥ã¼ãã³ã°ã«å¤å°æéãæãããã¨ã¯è¦æããæ¹ãããããç¥ãã¾ããã ï¼ä»åã¯è©¦ãã«ä½ã£ãã ããªã®ã§ãããã¾ã§ã¯æãã¾ããã¾ããã§ãããï¼
ãã¸ãã¯é¨åã¯JavaScriptãªã®ã§ãåºæ¬çã«éãå¦çã«ã¯åãã¾ãããã APIãSQLiteçã¨ããã¨ãããç¨åº¦ã§ããã°åé¡ãªãã¨æãã¾ãã
ãããã°
ãããã°ã¯åºæ¬çã«ãã©ã¦ã¶ã®éçºè ãã¼ã«ã使ãã¾ãã
React Nativeã®éçºæã¯ãã¼ã«ã«ç°å¢ã«JavaScriptãå®è¡ãããµã¼ããç«ã¡ããã ã¢ããªã¯ãã®ãµã¼ãã¨éä¿¡ããå½¢ã§å¦çãå®è¡ãã¾ãã
ãã®ãããã¹ãããå®è¡çã¯ãã©ã¦ã¶ã®éçºè ãã¼ã«ã§è¡ãã¾ãã
æ£ç´ãªã¨ããIDEã¨æ¯ã¹ãã¨ä½¿ãã«ããã®ã§ããªããããã·ãªæãã¯ãã¾ãã
ãã ãReactã®ä»çµã¿ã®ããããä»åä½ã£ãã¢ããªã®ã¬ãã«ã§ã¯ã ãããã¬ã¼ã§è¿½ããããªãã¨åãããªããããªä¸å ·åã«ã¯ãããã¾ããã§ããã
ãã®ã³ã°ã¯JSã§ã馴æã¿ã®console.log()ã使ãã¨éçºè ãã¼ã«ã®ã³ã³ã½ã¼ã«ã«åºåããã¾ãã
ãµã¼ããã¼ãã£è£½SDKã®çµã¿è¾¼ã¿
Google Analyticsçã®æåãªSDKã¯æ¢ã«ã¢ã¸ã¥ã¼ã«ãä½ã£ã¦ããã¦ãã人ãããã®ã§ãnpmã§ç°¡åã«ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
åé¡ã¯ä¸ççã«ã¯æåã§ãªãæ¥æ¬ã®åºåäºæ¥è ãªã©ã®SDKã§ãã
ããããå©ç¨ããã«ã¯ããã¤ãã£ãã®å¦çã¨ããªãã¸ããå¦çãä½ã£ã¦ãããå¿ è¦ãããã¾ãã
SDKã®æ°ãå¤ãã¨æéåããããªã®ã§ãéçºåã«èæ ®ãã¦ãããæ¹ãããããã§ãã
使ç¨ãªã½ã¼ã¹
ã¢ããªåæã®ãã£ã¹ã¯å®¹éã¯ããã»ã©ã§ããªãã®ã§ãããã¡ã¢ãªä½¿ç¨éã¯å¤ãããç¥ãã¾ããã
ã¾ã ã¢ããªã1æ¬ããä½ã£ã¦ããªãã®ã§ãä½ã¨ãè¨ããªãã§ããã ç°¡åãªæ§é ã®ã¢ããªã®å²ã«ã¯æ大ã§200MBãããã¡ã¢ãªã使ç¨ãã¦ãã¾ããã
ããç¨åº¦ã¯React Nativeå´ã§ç®¡çãã¦ããããã¨æãã¾ããã Objectã®åç §ãæ®ã£ã¦ããã¨ãªã¼ã¯ã®åå ã«ãªãã¾ãã
ãã«ã
åºæ¬çã«ãã«ãã¯ä¸åº¦è¡ãã°ãåãã«ãããã«ã³ã¼ãã®å¤æ´ãã¢ããªã«åæ ãããã¨ãå¯è½ã§ãã ããã¯ã¹ã¯ãªããè¨èªã§ããES6ã®æ大ã®ã¢ããã³ãã¼ã¸ã¨æãã¾ãã
iOSãAndroidã§ãå·®åãã«ãã¯åå¨ãã¾ãããReact Nativeã§éçºããéãã¯ãã«ãå¾ ã¡ãã»ã¼çºçããªãããã é«éã«éçºãé²ãããã¨ãã§ãã¾ãã
npmã§ã¢ã¸ã¥ã¼ã«ã追å ããæãªã©ã¯ãåãã«ããå¿ è¦ã¨ãªãã¾ããã ãã«ãã®ã¹ãã¬ã¹ããã¯è§£æ¾ããã¾ãã
ãã¹ã
ä»åã¯ãã¹ãã³ã¼ããæ¸ããªãã£ãã®ã§ãããReact.JSåæ§ã«Jestã使ããããã§ãã UIãã¹ãã«ã¤ãã¦ã¯ããã¤ãã£ãã¨åæ§ã®ãã¹ãã«ãªãããã§ãã
ãã®ãããã¯ãã¾ã åå¼·ãå¿ è¦ã«ãªãããã§ããã
ãªãªã¼ã¹
iOSã¯AppDelegateã§å é¨ã®JSãã³ãã«ãå©ç¨ããå½¢ã«å¤æ´ãã ãã¨ã¯Xcodeã使ã£ã¦é常ã®æé ã§ãªãªã¼ã¹ãã§ãã¾ãã
Androidã¯ãªãªã¼ã¹ãã«ãç¨ã®è¨è¿°ãGradleã®è¨å®ã«è¿½å ããã³ãã³ãã§ãªãªã¼ã¹ç¨ã®apkãä½æãã¾ãã
ãã¤ãã£ãã¢ããªã®éçºçµé¨ããªãã¨ä¸çªãããã®ããªãªã¼ã¹ã®ãã§ã¼ãºããç¥ãã¾ããã
ã¹ã¯ãªã¼ã³ã·ã§ãããªã©ãæå¤ã¨ç¨æãããã®ãå¤ãã®ã§ãæ©ãã«åãçµãã§ããã¨å¾ãããã¿ã¤ããªãã¦ãã¿ã¾ãã
React Nativeã¯ã¢ããªéçºè ã®å¤¢ã¨ãªãã?
ä»å¾ã®ã³ãã¥ããã£ã®çãä¸ãã次第ã§ã¯ãããªãå¼·åãªãã©ãããã©ã¼ã ã¨ãªãããã§ãã
ç¾ç¶ã§ã¯åã£ãUIã«ãããªããã¤ãã£ãåãå¿ é ã«ãªãã¾ããã ãã®ããããå¸åãã¦ãããã³ã³ãã¼ãã³ããå¢ããã°ãååã«æç¨ãªãã¼ã«ã«ãªãã¨æãã¾ãã
React.JSã¨åæ§ã«npmã§è±å¯ãªã¢ã¸ã¥ã¼ã«ãæ±ããã®ã大ããã§ãã
ãã¨ãReact.JSã§Webãµã¤ããä½ã£ã¦ããå ´åã¯ãã¢ããªã¨Webã§å ±éã®ã³ã¼ããåãããã¨ãã§ããããªã®ã§ç©æ¥µçã«æ¤è¨ãã¦ãããããç¥ãã¾ããã
ãã ãéã®å¼¾ä¸¸ã§ã¯ãªãã®ã§ãä»å¾ã®æ¦ç¥ãç¾ç¶ã®ã¨ã³ã¸ãã¢ãªã½ã¼ã¹ã¨ç¸è«ããªããå°å ¥ãæ¤è¨ããå¿ è¦ãããã¾ãã
ä»ã¯äº¡ãParse.comã®ããã«Facebookããµã¸ãæããå¯è½æ§ãã¼ãã§ã¯ãªãã§ããã Facebookã®ã¢ããªèªä½ãReact Nativeãªã®ã§ããã®ãããã¯å¿é ããªãã¦ã大ä¸å¤«ãªæ°ããã¾ãã
Reactã«ä¾åããã®ã¯ãªã¹ã¯ãããã¾ããã2016å¹´7æç¾å¨ã§ã¯ä½¿ããã¬ãã«ã«ãªã£ã¦ãã¾ãã®ã§ãå人çã«ã¯ä»å¾ã楽ãã¿ã§ãã
ä»åã¯ç°¡åãªã¢ããªãä½ã£ãã ãã§ãããã¨ã¦ãè¯ãå°è±¡ãåãã¾ããã
Reactèªä½ã触ã£ã¦ã¿ããã¨ã¦ãè¯ãä»çµã¿ã§ããããããã使ã£ã¦ã¯ãã¹ãã©ãããã©ã¼ã ã®ã¢ããªãä½ããã®ã¯ç´ æ´ãããã§ãã
åæãªã¤ã¡ã¼ã¸ã§è»ã«ä¾ããã¨ãReact Nativeãå¸è²©è»ãXmarinããã¥ã¼ã³ãã«ã¼(Xmarinã¯è§¦ã£ããã¨ãªããã©)ããã¤ãã£ãéçºãF1ã¨ãããããªå°è±¡ã§ãã
åã£ãUIã§ãªããã°ç°¡åã«ã¢ããªãä½ããã®ã§ããã¤ãã£ãéçºè ã触ã£ã¦ããã¦æã¯ãªãã¨æãã¾ãã