@kinakobo ã§ãã
å æ¥ãã£ã¼ã¯ã«ã¨ããæ°è¦ãµã¼ãã¹ã®iOS, Androidã¢ããªãReactNativeã§éçºãããªãªã¼ã¹ãã¾ããã
ãã§ã«å½å ã§ãããã¤ãæ¡ç¨äºä¾ãããReactNativeã§ãããã¾ã ã¾ã äºä¾ãå°ãªãã¨æãã¾ãã
ä»åèªåãã¡ãReactNativeãæ¡ç¨ããã®ã§ãã¾ãã¯ãã®æ¤è¨æ®µéããç´¹ä»ãããã¨æãã¾ãã ã¾ããéçºãã¼ã ã¯Webã¨ã³ã¸ãã¢ã®ã¿ã§æ§æããã¦ãããããç¹ã«Webã¨ã³ã¸ãã¢ã®æ¹åãã®å 容ã«ãªãã¾ããåèã¾ã§ã«ãéçºãã¼ã ã®äººæ°ã¯4人ã§APIå´ãåãã¡ã³ãã¼ãæ å½ãã¦ãã¾ããã
ã¯ããã«ããã¤ãã£ãã¢ããªãä½ã§ä½ããæ¤è¨ããéã«åºãé¸æè¢ã¯ä»¥ä¸ã®3ã¤ã§ããã
- iOSã¨Androidãããããã¤ãã£ãã®ã³ã¼ãã§æ¸ã
- ReactNativeã使ç¨ãã
- Flutterã使ç¨ãã
1ã¯å ¨ãç¥èããªãç¶æ ããå§ãããã¨ã«ãªããããæãå¦ç¿ã³ã¹ããé«ãã§ããä½ããã¨ãã¦ãããã®ãã¾ã æ¤è¨¼æ®µéã®ãµã¼ãã¹ã§ãã£ããã¨ããããé·ãæéãã³ã¹ããããã¦éçºãè¡ãã¹ãã§ã¯ãªããé¸æè¢ããå¤ãã¾ããã
2ã¯ãã¼ã å ã«Reactã®çµé¨è ãæ°åãããããæåãªé¸æè¢ã§ããããããããã¤ãã£ãã¢ããªã®éçºçµé¨ããªãããããã«ãå¨ãããã¤ãã£ãã®ã³ã¼ãã§ã¨ã©ã¼ãçºçããæãªã©ã«å¤å°ä¸å®ãããã¾ããã
3ã¯æè¿å¢ãããããã®ã®ãReactNativeã¨æ¯è¼ããã¨æ¡ç¨äºä¾ãå°ãªããã¨ãä¸æ確ãªç¹ãå¤ãããé¸æè¢ããå¤ãã¾ããã
ãã®ãããªçµç·¯ã§ReactNativeãæ¡ç¨ãããã¨ã«æ±ºãã¾ããããã¤ãã£ãã®ç¥èä¸è¶³ã«å¤å°ä¸å®ããã£ããã®ã®ã社å ã®ã¢ããªã¨ã³ã¸ãã¢ã«ãã¤ã§ã質åã§ããç°å¢ã ã£ããã¨ãé¸æã®å¾æ¼ãã«ãªãã¾ããã
ãããªãããªã§ã¢ããªéçºãã¯ããããªãªã¼ã¹ã¾ã§æ¼ãçãããã¨ãã§ãã¾ãããçµæçã«ReactNativeã«ãã¦æ£è§£ã ã£ãã¨æãã¾ãã
éçºã®éã«ããã¤ãæ¤è¨ãå¿ è¦ãªãã¤ã³ãã使ã£ã¦ã¿ã¦è¯ãã£ãã¨æããæè¡ããã£ãããã以ä¸ã§ç´¹ä»ãã¾ãã
- ä½ãå§ããåã«æ¤è¨ããããã¨
- ãããããç¥ã£ã¦ããã¨è¯ãæè¡
- 使ã£ã¦ã¿ã¦è¯ãã£ãæè¡
- æå¾ã«
ä½ãå§ããåã«æ¤è¨ããããã¨
Expoã使ããã©ãã
Expoã¯ReactNativeã§ã®éçºãæ¯æ´ãããµã¼ãã¹ã§ãã詳細ã¯å²æãã¾ãããExpoã使ãã¨ãã¤ãã£ãã®ã³ã¼ããä¸åè¨è¿°ããå¿ è¦ãªããJSã®ã³ã¼ããæ¸ãã ãã§ReactNativeã¢ããªãä½æãããªãªã¼ã¹ãããã¨ãã§ãã¾ãã
ããã ãèãã¨ã¨ã¦ã便å©ãæ°ããã¾ãããå®é便å©ãªã®ã§ããããã¤ãã£ãã¢ã¸ã¥ã¼ã«ã追å ãããã¨ãã§ããªãã¨ãããã¡ãªãããããã¾ããããã·ã¥éç¥ãªã©å¤ãã®æ©è½ã¯Expoã§ç¨æããã¦ãã¾ããããããã§äºè¶³ããªããããªå ´åã¯Expoã使ããªãæ¹ãç¡é£ã§ããç¨æããã¦ããæ©è½ã¯ãã¡ãï¼Expo Documentationï¼ã®å·¦ãµã¤ããã¼ããä¸è¦§ã§ãã¾ãã
äºè¶³ãããã¨ãããã£ã¦ãã¦ããã¤ãã£ãã®ã³ã¼ãã«é¢ããç¥è¦ããªãå ´åã¯Expoã使ãã¨è¯ãããã§ãã
iOSãAndroidã§ãã¶ã¤ã³ãåãããã©ãã
ä»åã¯åããªããã¨ã«ãã¾ãããåãã³ã¼ãã使ãåãã«ãããªããReactNativeã使ãã¡ãªãããèããã¨æã£ãããã§ãã
ã¾ãããã¶ã¤ã³ãã¢ãã¡ã¼ã·ã§ã³ããã©ãããã©ã¼ã æ¯ã«ã¨ãã¨ãçªãè©°ãããå ´åã¯ãReactNativeã¯ãã¾ãåãã¦ãªãã¨ãæãã¾ãã
ã§ããæ¥ä»é¸æã®UIãªã©ãã©ããã¦ãåãããé¨åãããã¤ãããã¾ããããããã£ãé¨åã¯ããã©ãããã©ã¼ã æ¯ã®éããå¸åãã¦ãããå¤é¨ã©ã¤ãã©ãªã«é ¼ãã¾ããã æ¥ä»é¸æã®å ´å㯠react-native-datepicker ã使ç¨ãã¾ããã
ä»åã¯ä½¿ç¨ãã¦ãã¾ããããæ§ã ãªUIã³ã³ãã¼ãã³ãããã©ãããã©ã¼ã æ¯ã«è¯ãæãã®è¦ãç®ã§è¡¨ç¤ºãã¦ãããNativeBaseã¨ããã³ã³ãã¼ãã³ãã©ã¤ãã©ãªãããã¾ãã
ãããããç¥ã£ã¦ããã¨è¯ãæè¡
React
è¨ãããããªãªæãããã¾ãããã»ã¼Reactã®ã³ã¼ããæ¸ããã¨ã«ãªãã®ã§ãReactã§SPAçã®éçºçµé¨ãããã¨è¦ãããã¨ãå°ãªãã¦æ¸ã¿ã¾ãã
ç¹ã«Reduxãªã©ã®Fluxã¢ã¼ããã¯ãã£ã¯Reactãããç解ã«æéãããã£ãè¦ããããã®ã§ã使ã£ããã¨ããªãã¨å¦ç¿ã³ã¹ããè·³ãä¸ããæ°ããã¾ããã
iOSã¨Androidã¢ããªã®éçºçµé¨
Expoã使ããã«ç´ ã®ReactNativeã§éçºããå ´åãç¹ã«ãã«ãå¨ãã§iOS/Androidã®ç¥èãå¿ è¦ã«ãªãã¾ãã ãã®ããããã¼ã ã«1人以ä¸ã¢ããªã¨ã³ã¸ãã¢ãããæ¹ããã«ãå¨ãããã¤ãã£ãã³ã¼ãã®ã¨ã©ã¼ã§å¤ã«åµã£ãããããã¨ãå°ãªããªãã¾ãã
èªåãã¡ã®å ´åã¯ããã¼ã å ã«ã«ã¢ããªã¨ã³ã¸ãã¢ãããªãã£ããããiOSã¨Androidãæ±ãä»ãã¼ã ã®ã¢ããªã¨ã³ã¸ãã¢ã«ãã¤ã§ã質åã§ããç¶æ ã«ãã¦ãããã¾ããã
使ã£ã¦ã¿ã¦è¯ãã£ãæè¡
TypeScript
æåã¯ã³ã¼ãéå¢ãã¦é¢åèãã¨ãã声ãããã¾ããããéçºãé²ãã«ã¤ãã¡ãªãããä¸åããçµæçã«å¤§æºè¶³ã§ããã å ·ä½çã«ã¯ã
- ã¨ãã£ã¿ã§ã³ã¼ãè£å®ã¨å®ç¾©å ã«ã¸ã£ã³ãã§ããã
- ãªãã¡ã¯ã¿ãªã³ã°ãããã¨ãã«å®å¿æãããã
- ã³ã¼ããèªãã¨ãã«åããããã®ã§ãèªã¿è§£ãããããªãã
- ã³ã³ãã¤ã«ã¨ã©ã¼ã«ããåç´ãªãã¹ãé²ãã¦ã³ã¼ãã¬ãã¥ã¼ã®ã³ã¹ããä¸ããã
- TSLintãå°å ¥ãããã¨ã§ããã«ã¬ãã¥ã¼ã³ã¹ããä¸ãããã¨ãã§ããã
ã¨ãã£ãã¡ãªãããããã¾ããã
èªåã¯ä½¿ã£ããã¨ãããã¾ããããFlowã§ãåããããªãã¨ãã§ããã¨æãã¾ãã
Prettier
JavaScriptã®ç¨ã®ã³ã¼ããã©ã¼ããã¿ã¼ã§ããããã©ã«ãã®è¨å®ã§ãããªã綺éºã«ç´ãã¦ãããã®ã§ãå°å ¥ããªãæã¯ãªãã¨æãã¾ããããããTypeScriptã¨åæ§ã«ã³ã¼ãã¬ãã¥ã¼ã®ã³ã¹ããä¸ãã¦ããã¾ããã
ã¾ããèªåãã¡ã®å ´åã¯ã³ã¼ããã©ã¼ãããæ¸ã¿ããCircleCIã§ãã§ãã¯ããããã«ãããã¨ã§ããã©ã¼ããããã¦ããªãã³ã¼ãããã¼ã¸ãããã®ãé²ãã¾ããã å¾ããç¥ãã¾ããããpre-commitã¨ããããã±ã¼ã¸ãç¨ãã¦ã³ãããæã«Prettierãå®è¡ããæ¹æ³ãä¸è¬çã®ããã§ãã
Redux
Reduxã¯Reactã®state(ç¶æ )ã管çãããããã®ãã¬ã¼ã ã¯ã¼ã¯ã§ãã Reduxã使ãã¨ReactComponentããstate管çãå¼ãå¥ãããã¨ãã§ãã¾ããstateããªãããReactComponentã¯ãåãåã£ãpropsã«ãã£ã¦å¿ ãåãçµæãè¿ãã ãã®ãã®ã«ãªãã責åãæ確ã«ãªãã¾ãã
ã¾ããReduxã¯ä¸è¬çã«action, reducer, constantsã§ãã¡ã¤ã«ãåå²ãã¾ããããããã¯å¯çµåã«ãªã£ã¦ããã®ã§ã1ãã¡ã¤ã«ã«ã¾ã¨ãããã¨ããDucksãã¿ã¼ã³ãæ¡ç¨ãã¾ããããã®ãã¿ã¼ã³ã§æ¸ãã¦ã¿ã¦ç¹ã«å°ããã¨ã¯ãªãã£ãã®ã§ãã¡ãªãããããªãã¨ããå°è±¡ã§ããã
MobXãæ¤è¨ãã¾ãããããã¡ãã®è¨äºï¼ReduxとMobXの選定観点ï¼ ãåèã«ãã¦ãReduxã®æ¹ãç¨éã«åã£ã¦ãã®ã§Reduxãæ¡ç¨ãã¾ããã
CodePush
CodePushã使ãã¨ãã¢ããªã®JSé¨åãã¢ããªã¹ãã¢ã®å¯©æ»ãªãã§å¤æ´ãããã¨ãã§ãã¾ãããã®ãããJSé¨åã§å®çµãããªãªã¼ã¹ã¯å³åº§ã«å·®ãæ¿ãããã¨ãã§ãã¾ãã
ã¨è¨ã£ã¦ãæè¿ã¯3æ¥ãããã°ã¹ãã¢ã®å¯©æ»ãçµããã®ã§ãCodePushããªãã¦å°ãã¨ããå ´é¢ã¯ãã»ã©ãªãã¨æãã¾ããä½è£ãããã°å ¥ãã¦ã¿ãç¨åº¦ã§ãè¯ãããããã¾ããã
ã¾ããCodePushãæä¾ãã¦ããAppCenterã¨ãããµã¼ãã¹ã¯ãCodePush以å¤ã«ãã¢ããªã®ãã«ãããã¹ããã¯ã©ãã·ã¥ã¬ãã¼ãã®ç®¡çæ©è½ãªã©ãåãã¦ãã¾ããå ¬å¼ããã¥ã¡ã³ãã§ReactNativeããµãã¼ããã¦ããç¹ããããããã§ãã
å®éã«ãã«ãã®æ©è½ã使ç¨ãã¦ãã¾ãããGitHubã¨é£æºãã¦ç¹å®ã®ãã©ã³ãã«å¯¾ããã³ãããæ¯ã«èªåã§ã¢ããªããã«ããã¦ããã¹ãã¢ããªã社å é ä¿¡ããã¨ããã¾ã§ãç°¡åãªè¨å®ã§è¡ã£ã¦ããã¦ä¾¿å©ã§ãã
æå¾ã«
ReactNativeã«æ £ããã¨Reactã§SPAãä½ãæè¦ã§ãã¤ãã£ãã¢ããªãä½ããã¨ãã§ãã¾ãããã¤ãã£ãã¢ããªãä½ã£ããã¨ããªãèªåã«ã¨ã£ã¦ã¯ãä½ããç©ã®å¹ ãåºãã¦ãããç´ æ´ãããæè¡ã§ããã
ãã®è¨äºãReactNativeãæ¤è¨ãã¦ããæ¹ã®åèã«å°ãã§ããªãã°å¹¸ãã§ãã
ã¯ã©ã¦ãã½ã¼ã·ã³ã°ã®ã¯ã©ã¦ãã¯ã¼ã¯ã¹ã§ã¯ãæé·ãç¶ãããã¨ã³ã¸ãã¢ãåéãã¦ãã¾ãï¼
ããªã¼ã©ã³ã¹ã®æ¹ã¯æ¯éãã£ã¼ã¯ã«ãå©ç¨ãã¦ã¿ã¦ãã ããã