{"id":4025,"date":"2019-04-13T18:49:40","date_gmt":"2019-04-13T09:49:40","guid":{"rendered":"https:\/\/greentown.tokyo\/?p=4025"},"modified":"2019-05-06T14:20:11","modified_gmt":"2019-05-06T05:20:11","slug":"reactnative-tutorial","status":"publish","type":"post","link":"https:\/\/greentown.tokyo\/?p=4025","title":{"rendered":"React Native \u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u8a66\u3059"},"content":{"rendered":"<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u3044\u308d\u3044\u308d\u8a66\u3057\u3066\u307f\u305f\u3093\u3060\u3051\u3069\u3001\u3055\u3063\u3071\u308a\u7406\u89e3\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u672c\u5bb6\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u3084\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3053\u308d\u3069\u3053\u308d Qiita \u307f\u306a\u304c\u3089\u3002<\/p>\n<h2>\u57fa\u790e<\/h2>\n<h3>React \u3068 React Native \u306e\u9055\u3044<\/h3>\n<h6>\u69cb\u6210\u8981\u7d20<\/h6>\n<table>\n<tbody>\n<tr>\n<td>React<\/td>\n<td>Web\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/td>\n<\/tr>\n<tr>\n<td>React Native<\/td>\n<td>Native\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>React Native \u306f ES2015\uff08import, from, class, and extends\uff09\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u308b<\/p>\n<p>&nbsp;<\/p>\n<h6>JSX<\/h6>\n<p>&lt;View&gt;&lt;Text&gt;Hello world!&lt;\/Text&gt;&lt;\/View&gt;<\/p>\n<ul>\n<li>JavaScript\u306bXML\u3092\u57cb\u3081\u8fbc\u3080\u69cb\u6587<\/li>\n<li>\u591a\u304f\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306f\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u8a00\u8a9e\u306e\u4e2d\u306b\u30b3\u30fc\u30c9\u3092\u57cb\u3081\u8fbc\u3080\u3051\u3069\u3001React\u306f\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u8a00\u8a9e\u3092\u30b3\u30fc\u30c9\u5185\u306b\u66f8\u304f<\/li>\n<li>HTML\u306b\u4f3c\u3066\u308b\u3051\u3069&lt;div&gt;\u3068\u304b\u3092\u4f7f\u7528\u3059\u308b\u306e\u3067\u306f\u306a\u304fReact Native\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f7f\u7528\u3059\u308b<\/li>\n<li>&lt;Text&gt;\u306f\u3001\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u7d44\u307f\u8fbc\u307f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3002&lt;span&gt;\u307f\u305f\u3044\u306a\u611f\u3058\u3002<\/li>\n<li>&lt;View&gt;\u306f\u3001&lt;div&gt;\u307f\u305f\u3044\u306a\u611f\u3058<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h6>Components\uff08\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff09<\/h6>\n<p>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3001HelloWorldApp\u3092\u5b9a\u7fa9<\/p>\n<pre class=\"lang:js decode:true \">export default class HelloWorldApp extends Component {\r\n  render() {\r\n    return (\r\n      &lt;View style={{ flex: 1, justifyContent: \"center\", alignItems: \"center\" }}&gt;\r\n        &lt;Text&gt;Hello, world!&lt;\/Text&gt;\r\n      &lt;\/View&gt;\r\n    );\r\n  }\r\n}\r\n<\/pre>\n<ul>\n<li>React Native\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u3068\u304d\u306f\u3001\u305f\u304f\u3055\u3093\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u308b\u3053\u3068\u306b\u306a\u308b<\/li>\n<li>\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u308b\u3082\u306e\u306f\u3001\u3059\u3079\u3066\u4f55\u304b\u3057\u3089\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/li>\n<li>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u5fc5\u9808\u306a\u3082\u306e\u306f\u3001JSX\u3092\u8fd4\u3059\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u6a5f\u80fd<\/li>\n<\/ul>\n<p>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5236\u5fa1\u3059\u308b\u30c7\u30fc\u30bf\u30bf\u30a4\u30d7\u306b\u306f\u3001props\u3068state \u3063\u3066\u306e\u304c\u3042\u308b\u3002<\/p>\n<h2>props<\/h2>\n<ul>\n<li>\u89aa\u304b\u3089\u6e21\u3055\u308c\u308b\u30a4\u30df\u30e5\u30fc\u30bf\u30d6\u30eb\u306a\u30c7\u30fc\u30bf<\/li>\n<li>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5185\u3067\u5024\u3092\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u306f\u306a\u3044<\/li>\n<li>xxx=&#8217;hoge&#8217;\u306e\u3088\u3046\u306b\u30bf\u30b0\u5c5e\u6027\u3068\u3057\u3066\u4f7f\u3046<\/li>\n<li>\u5909\u6570\u3092\u4f7f\u3046\u3068\u304d\u306f{}\u3067\u304f\u304f\u308b\u3002&lt;Text&gt;Hello {this.props.name},&lt;\/Text&gt;<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/facebook\/prop-types\">\u578b\u30c1\u30a7\u30c3\u30af\u306e\u30e9\u30a4\u30d6\u30e9\u30ea<\/a><\/p>\n<p>&nbsp;<\/p>\n<h6>\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/h6>\n<pre class=\"lang:js decode:true\">import React, {Component} from 'react';\r\nimport { AppRegistry, Image } from 'react-native';\r\n\r\nexport default class App extends Component {\r\n  render() {\r\n    let pic = {\r\n      uri: 'https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/de\/Bananavarieties.jpg'\r\n    };\r\n    return (\r\n      &lt;Image source={pic} style={{width: 193, height: 110}}\/&gt;\r\n    );\r\n  }\r\n}\r\nAppRegistry.registerComponent('HelloWorldApp', () =&gt; App);<\/pre>\n<ul>\n<li>\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u308b\u3068\u304d\u306f\u3001source\u3068\u3044\u3046prop\u3092\u4f7f\u7528\u3059\u308b<\/li>\n<li>{pic}\u306f\u3001\u5909\u6570pic\u3092JSX\u306b\u57cb\u3081\u8fbc\u3093\u3067\u3044\u308b<\/li>\n<li>props\u306f\u5225\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u5024\u3084\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u308b<\/li>\n<\/ul>\n<p>\u89aa\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304b\u3089\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u6e21\u3059\u3068\u304d<\/p>\n<pre class=\"lang:default decode:true \">&lt;Child props={value}\/&gt;<\/pre>\n<p>\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8(Child)\u3067\u306f\u3001\u6e21\u3055\u308c\u305f\u5024(value)\u3092props\u3068\u3044\u3046\u540d\u524d\u3067\u6271\u3046<\/p>\n<p>&nbsp;<\/p>\n<h3>\u30a4\u30d9\u30f3\u30c8\u3092\u89aa\u306b\u4f1d\u3048\u308b\u5834\u5408\u306fprops\u3067\u30cf\u30f3\u30c9\u30e9\u3092\u6e21\u3059<\/h3>\n<h6>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5074<\/h6>\n<p>onPress\u30a4\u30d9\u30f3\u30c8\u3067\u3001\u89aa\u304b\u3089\u8cb0\u3063\u305fprops.onClick\u304c\u547c\u3070\u308c\u308b<\/p>\n<pre class=\"lang:default decode:true \">&lt;Button onPress={this.props.onClick} \/&gt;<\/pre>\n<h6><\/h6>\n<h6>\u4f7f\u3044\u65b9<\/h6>\n<pre class=\"lang:default decode:true \">_onClick(){\r\n  console.log('Clicked!!!');\r\n}\r\n\r\n&lt;MyButton onClick={this._onClick} \/&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>state<\/h2>\n<ul>\n<li>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5185\u3067\u4fdd\u6301\u3057\u3066\u3044\u308b\u72b6\u614b\u3092\u7ba1\u7406\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/li>\n<li>\u4ed6\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3068\u306f\u3084\u308a\u3068\u308a\u3057\u306a\u3044<\/li>\n<li>\u5024\u3092\u66f8\u304d\u63db\u3048\u308b\u3068\u304d\u306f setState()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046<\/li>\n<li>\u5024\u304c\u5909\u66f4\u3055\u308c\u308b\u3068\uff08setState()\u3059\u308b\u3068)\u3001\u52dd\u624b\u306brender\u304c\u8d70\u308a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u518d\u63cf\u753b\u3055\u308c\u308b<\/li>\n<\/ul>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u521d\u671f\u5024\u3092\u8a2d\u5b9a\u3057<\/p>\n<pre class=\"lang:default decode:true\">constructor(props) {\r\n  super(props);\r\n  this.state={\r\n      x: 0,\r\n  };\r\n}<\/pre>\n<p>setState\u3067\u66f4\u65b0<\/p>\n<pre class=\"lang:default decode:true \">this.setState({x: 1});<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u69cb\u6587<\/h2>\n<h3>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u5ba3\u8a00<\/h3>\n<pre class=\"lang:js decode:true\">export default class App extends Component&lt;{}&gt; {<\/pre>\n<h6>export default<\/h6>\n<p>\u4ed6\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u304b\u3089\u30a4\u30f3\u30dd\u30fc\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n<h6>extends Component<\/h6>\n<p>\u5fc5\u9808\u3002React\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5ba3\u8a00<\/p>\n<h6>&lt;{}&gt;<\/h6>\n<p>flow\u306e\u66f8\u5f0f<\/p>\n<h3>render\u30e1\u30bd\u30c3\u30c9<\/h3>\n<pre class=\"lang:js decode:true\">render() {\r\n    return (\r\n      \/\/ &lt;View&gt;,&lt;Text&gt; React Native\u306e\u66f8\u5f0f\r\n      \/\/ React\u3060\u3068&lt;div&gt;\u3068\u304b&lt;span&gt;\r\n      &lt;View style={styles.container}&gt;\r\n        &lt;Text style={styles.welcome}&gt;\r\n          Welcome to React Native!\r\n        &lt;\/Text&gt;\r\n        &lt;Text style={styles.instructions}&gt;\r\n          To get started, edit App.js\r\n        &lt;\/Text&gt;\r\n        &lt;Text style={styles.instructions}&gt;\r\n          {instructions}\r\n        &lt;\/Text&gt;\r\n      &lt;\/View&gt;\r\n    );\r\n  }<\/pre>\n<p>render\u5185\u3067return\u3057\u305f\u3082\u306e\u304c\u3001\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u308b\u3002<\/p>\n<h6>&lt;View&gt;\u3068\u304b&lt;Text&gt;<\/h6>\n<p>React Native\u306e\u66f8\u5f0f\u3002React\u3060\u3068&lt;div&gt;\u3068\u304b&lt;span&gt;\u3068\u304b\u4f7f\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>View<\/h3>\n<ul>\n<li>div\u306a\u611f\u899a\u3067\u4f7f\u7528\u3059\u308b<\/li>\n<li>\u4e2d\u306b\u6587\u5b57\u306f\u304b\u3051\u306a\u3044<\/li>\n<\/ul>\n<h3>Text<\/h3>\n<ul>\n<li>span\u306a\u611f\u899a\u3067\u4f7f\u7528\u3059\u308b<\/li>\n<li>\u6587\u5b57\u3092\u63cf\u753b\u3059\u308b\u5834\u5408\u306fText\u3067\u56f2\u3046<\/li>\n<\/ul>\n<h3>StyleSheet<\/h3>\n<pre class=\"lang:default decode:true \">const styles = StyleSheet.create({\r\n  container: {\r\n    flex: 1,\r\n    justifyContent: 'center',\r\n    alignItems: 'center',\r\n    backgroundColor: '#F5FCFF',\r\n  },\r\n  welcome: {\r\n    fontSize: 20,\r\n    textAlign: 'center',\r\n    margin: 10,\r\n  },\r\n  instructions: {\r\n    textAlign: 'center',\r\n    color: '#333333',\r\n    marginBottom: 5,\r\n  },\r\n});<\/pre>\n<h6>CSS in JS \u3067\u5b9a\u7fa9\u3059\u308b<\/h6>\n<p>CSS\u3092JavaScript\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u5b9a\u7fa9\u3059\u308b<\/p>\n<h6>CSS in JS \u306e\u30eb\u30fc\u30eb<\/h6>\n<ul>\n<li>background-color\u307f\u305f\u3044\u306b\u30cf\u30a4\u30d5\u30f3\u304c\u3042\u308b\u306e\u306fbackgroundColor\u3063\u3066\u611f\u3058\u3067\u30ad\u30e3\u30e1\u30eb\u30b1\u30fc\u30b9\u3067\u5b9a\u7fa9\u3059\u308b<\/li>\n<li>\u6570\u5b57\u4ee5\u5916\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u6587\u5b57\u5217\u3067\u5b9a\u7fa9\u3059\u308b\u3002\u3075\u3064\u3046\u306ecss\u3060\u3068red\u3068\u304b\u304c\u4f7f\u3048\u308b\u3051\u3069\u3001CSS in JS \u3067\u306f &#8216;red&#8217; \u3063\u3066\u66f8\u304f<\/li>\n<li>\u30bb\u30ec\u30af\u30bf\u306f\u306a\u3044\uff08p \u3068\u304b .class \u3068\u304b\uff09<\/li>\n<li>style\u5c5e\u6027\u306b\u30b9\u30bf\u30a4\u30eb\u3092\u9069\u7528\u3059\u308b<\/li>\n<\/ul>\n<p>\u6700\u521d\u306e\u3046\u3061\u306fcreate\u30e1\u30bd\u30c3\u30c9\u3060\u3051\u3092\u899a\u3048\u3066\u304a\u304f<\/p>\n<p><a href=\"https:\/\/qiita.com\/YutamaKotaro\/items\/d0cd253c998f9b28dd55\">https:\/\/qiita.com\/YutamaKotaro\/items\/d0cd253c998f9b28dd55<\/a><\/p>\n<p>&lt;View <strong><span style=\"color: #ff6600;\">style<\/span><\/strong>={styles.<strong><span style=\"color: #008080;\">container<\/span><\/strong>}&gt; \u2192 <span style=\"color: #008080;\"><strong>container<\/strong><\/span>\u3063\u3066\u3044\u3046\u30b9\u30bf\u30a4\u30eb\u3092 <strong><span style=\"color: #ff6600;\">style\u3063\u3066\u3044\u3046\u5909\u6570<\/span><\/strong>\u306b\u5b9a\u7fa9<\/p>\n<p>&lt;Text <span style=\"color: #ff6600;\"><strong>style<\/strong><\/span>={styles.<strong><span style=\"color: #008080;\">welcome<\/span><\/strong>}&gt; \u2192 <strong><span style=\"color: #008080;\">welcome<\/span><\/strong>\u3063\u3066\u3044\u3046\u30b9\u30bf\u30a4\u30eb\u3092 <strong><span style=\"color: #ff6600;\">style\u3063\u3066\u3044\u3046\u5909\u6570<\/span><\/strong>\u306b\u5b9a\u7fa9<\/p>\n<p>&lt;Text <strong><span style=\"color: #ff6600;\">style<\/span><\/strong>={styles.<span style=\"color: #008080;\"><strong>instructions<\/strong><\/span>}&gt; \u2192 <strong><span style=\"color: #008080;\">instructions<\/span><\/strong>\u3063\u3066\u3044\u3046\u30b9\u30bf\u30a4\u30eb\u3092 <strong><span style=\"color: #ff6600;\">style\u3063\u3066\u3044\u3046\u5909\u6570<\/span><\/strong>\u306b\u5b9a\u7fa9<\/p>\n<pre class=\"lang:css decode:true \">container: {\r\n    flex: 1,\r\n    justifyContent: 'center',\r\n    alignItems: 'center',\r\n    backgroundColor: '#F5FCFF',\r\n  },<\/pre>\n<h6>flex<\/h6>\n<ul>\n<li>flex: 1 \u3067\u753b\u9762\u5168\u4f53\u8868\u793a<\/li>\n<li>flex\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u753b\u9762\u4e0a\u306b\u5bfe\u3059\u308b\u8981\u7d20\u306eflexDirection\u65b9\u5411\u306e\u5927\u304d\u3055\u306e\u6bd4\u7387<\/li>\n<li>position:&#8217;fixed&#8217;\u304c\u306a\u3044<\/li>\n<\/ul>\n<pre class=\"lang:js decode:true \">const style = StyleSheet.create({\r\n  container:{\r\n    marginTop:20,\r\n    flex:1,\r\n    \/\/flexDirection:'column' ##defaultValue\r\n  }\r\n});<\/pre>\n<p>\u2191\u8981\u7d20\u304c\u306a\u3044\u3068\u304d\u306f\u76ee\u4e00\u676f\u5e83\u304c\u308b\u304c\u3001\u8981\u7d20\u304c\u5897\u3048\u308b\u3068\u5747\u7b49\u5272\u306b\u306a\u308b<\/p>\n<h6>\u3053\u3093\u306a\u611f\u3058\u2193<\/h6>\n<p>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/p>\n<pre class=\"lang:js decode:true \">export default class App extends Component&lt;{}&gt; {\r\n  \/\/ render\u30e1\u30bd\u30c3\u30c9\r\n  \/\/ \u3053\u3053\u3067return\u3057\u305f\u3082\u306e\u304c\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u308b\r\n  render() {\r\n    return (\r\n      \/\/ &lt;View&gt;,&lt;Text&gt; React Native\u306e\u66f8\u5f0f\r\n      \/\/ React\u3060\u3068&lt;div&gt;\u3068\u304b&lt;span&gt;\r\n      &lt;View style={styles.container}&gt;\r\n        &lt;View style={styles.header}&gt;\r\n          &lt;Text style={styles.title}&gt;\u305f\u3044\u3068\u308b&lt;\/Text&gt;\r\n        &lt;\/View&gt;\r\n        &lt;View&gt;\r\n          &lt;Text style={styles.mainContents}&gt;\u3081\u3044\u3093\u3053\u3093\u3066\u3093\u3064&lt;\/Text&gt;\r\n        &lt;\/View&gt;\r\n      &lt;\/View&gt;\r\n    );\r\n  }\r\n}<\/pre>\n<p>\u30b9\u30bf\u30a4\u30eb<\/p>\n<pre class=\"lang:css decode:true \">const styles = StyleSheet.create({\r\n  container: {\r\n    flex: 1,\r\n    backgroundColor: 'skyblue',\r\n  },\r\n  header: {\r\n    \/\/fontSize: 20,\r\n    \/\/textAlign: 'center',\r\n    \/\/margin: 10,\r\n    flex: 0.5,\r\n    backgroundColor: 'pink'\r\n  },\r\n  title: {\r\n    marginTop: 100,\r\n    textAlign: 'center',\r\n    fontSize: 40,\r\n  },\r\n  mainContents: {\r\n    marginTop: 100,\r\n    textAlign: 'center',\r\n    fontSize: 20,\r\n  }\r\n});<\/pre>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/dcacb6a63ecf05b1d223beb24efc87a9.png\"><img decoding=\"async\" class=\"alignnone wp-image-4065 size-medium\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/dcacb6a63ecf05b1d223beb24efc87a9-150x300.png\" alt=\"\" width=\"150\" height=\"300\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/dcacb6a63ecf05b1d223beb24efc87a9-150x300.png 150w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/dcacb6a63ecf05b1d223beb24efc87a9-768x1532.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/dcacb6a63ecf05b1d223beb24efc87a9-513x1024.png 513w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/dcacb6a63ecf05b1d223beb24efc87a9.png 794w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u2193\u3053\u308c\u306f flex\u3068\u540c\u3058<\/p>\n<pre class=\"lang:default decode:true \">    justifyContent: 'center',\r\n    alignItems: 'center',<\/pre>\n<p>&nbsp;<\/p>\n<h6>flex: 1, flexDirection: &#8216;row&#8217;<\/h6>\n<pre class=\"lang:default decode:true \">const styles = StyleSheet.create({\r\n  container: {\r\n    flex: 1, flexDirection: 'row',\r\n    backgroundColor: 'skyblue',\r\n  },<\/pre>\n<p>\u3053\u308c\u306f<\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/8c2518597a0c2b872aadd4b52d2cd438.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-4068\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/8c2518597a0c2b872aadd4b52d2cd438-152x300.png\" alt=\"\" width=\"152\" height=\"300\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/8c2518597a0c2b872aadd4b52d2cd438-152x300.png 152w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/8c2518597a0c2b872aadd4b52d2cd438-768x1519.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/8c2518597a0c2b872aadd4b52d2cd438-518x1024.png 518w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/8c2518597a0c2b872aadd4b52d2cd438.png 798w\" sizes=\"(max-width: 152px) 100vw, 152px\" \/><\/a><\/p>\n<p>\u3053\u3046\u306a\u308b<\/p>\n<h2>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5185\u306e\u30e6\u30fc\u30b6\u5b9a\u7fa9\u95a2\u6570<\/h2>\n<ul>\n<li>\u95a2\u6570\u5185\u306ethis\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6307\u3059<\/li>\n<li>\u305d\u306e\u305f\u3081\u3001\u305d\u306e\u307e\u307ethis.props.hoge\u3092\u53c2\u7167\u3057\u3066\u3082undefined\u306b\u306a\u308b<\/li>\n<li>\u306a\u306e\u3067\u30e1\u30f3\u30d0\u95a2\u6570\u306e<code>bind(this)<\/code>\u3092\u547c\u3093\u3067Component\u81ea\u8eab\u304cthis\u306b\u306a\u308b\u3088\u3046\u306b\u6307\u5b9a\u3059\u308b<\/li>\n<li>\u305d\u308c\u304b\u30a2\u30ed\u30fc\u95a2\u6570\u306b\u3057\u3066\u304a\u3044\u3066\u3001\u53c2\u7167\u5143\u304cthis\u3068\u306a\u308b\u3088\u3046\u306b\u4ed5\u5411\u3051\u3066\u3082OK<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb<\/h2>\n<h6>render()<\/h6>\n<ul>\n<li>\u63cf\u753b\u3059\u308b\u8981\u7d20\u3092\u8fd4\u3059<\/li>\n<li>\u3053\u3053\u3067 setState() \u3057\u3061\u3083\u30c0\u30e1<\/li>\n<\/ul>\n<h3>\u30de\u30a6\u30f3\u30c8\u306e\u3068\u304d\u306b\u547c\u3070\u308c\u308b<\/h3>\n<p>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u30de\u30a6\u30f3\u30c8\u6642\u306b\u4e00\u5ea6\u3060\u3051\u5b9f\u884c\u3055\u308c\u308b<\/p>\n<h6>constractor(props)<\/h6>\n<ul>\n<li>super(props) \u3092\u5fc5\u305a\u547c\u3076\u3053\u3068<\/li>\n<li>state \u306e\u521d\u671f\u5316\u3092\u3059\u308b<\/li>\n<\/ul>\n<h6>componentWillMount()<\/h6>\n<p><span style=\"color: #ff0000;\"><strong>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306fReact\u30d0\u30fc\u30b8\u30e7\u30f317\u3067\u524a\u9664\u3055\u308c\u308b\u307f\u305f\u3044\uff08Native\u3082\uff1f\uff09<\/strong><\/span><\/p>\n<ul>\n<li>render() \u76f4\u524d\u306e\u51e6\u7406<\/li>\n<li>\u3053\u3053\u3067this.setState()\u3092\u884c\u3046\u3068\u3001render() \u306f\u66f4\u65b0\u3055\u308c\u305fstate\u3092\u53c2\u7167\u3059\u308b\u3002<\/li>\n<\/ul>\n<h6>componentDidMount()<\/h6>\n<ul>\n<li>render() \u5f8c\u306b\u547c\u3070\u308c\u308b<\/li>\n<li>DOM\u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u3001DOM\u304c\u89e6\u308c\u308b<\/li>\n<li>this.setState() \u3067\u304d\u308b<\/li>\n<\/ul>\n<h3>\u66f4\u65b0\u306e\u3068\u304d\u306b\u547c\u3070\u308c\u308b<\/h3>\n<h6>componentWillReceiveProps(object nextProps)<\/h6>\n<p><span style=\"color: #ff0000;\"><strong>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306fReact\u30d0\u30fc\u30b8\u30e7\u30f317\u3067\u524a\u9664\u3055\u308c\u308b\u307f\u305f\u3044\uff08Native\u3082\uff1f\uff09<\/strong><\/span><\/p>\n<ul>\n<li>\u65b0\u3057\u3044 props \u3092\u53d7\u3051\u53d6\u308b\u3068\u5b9f\u884c\u3059\u308b<\/li>\n<li>props \u3067 state \u3092\u5909\u66f4\u3059\u308b\u306b\u306f this.setState() \u3059\u308b<\/li>\n<li>\u66f4\u65b0\u6642\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u5185\u3067 this.setState \u3067\u304d\u308b\u306e\u306f\u3053\u3053\u306e\u307f<\/li>\n<li>\u3053\u306e\u95a2\u6570\u5185\u3067 this.setState \u304c\u3001\u3055\u3089\u306b render() \u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u306f\u306a\u3044<\/li>\n<\/ul>\n<h6>componentWillUpdate(object nextProps, object nextState)<\/h6>\n<p><span style=\"color: #ff0000;\"><strong>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306fReact\u30d0\u30fc\u30b8\u30e7\u30f317\u3067\u524a\u9664\u3055\u308c\u308b\u307f\u305f\u3044\uff08Native\u3082\uff1f\uff09<\/strong><\/span><\/p>\n<ul>\n<li>render() \u524d\u306b\u547c\u3070\u308c\u308b<\/li>\n<li>this.setState() \u306f\u3084\u3063\u3061\u3083\u30c0\u30e1<\/li>\n<li>componentWillUpdate() \u3068 render() \u306e\u9593\u306e\u30bf\u30a4\u30df\u30b0\u3067 this.props, this.state \u3067\u53c2\u7167\u3067\u304d\u308b\u5024\u3092\u66f4\u65b0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/li>\n<\/ul>\n<h6>shouldComponentUpdate(object nextProps, object nextState)<\/h6>\n<ul>\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306e\u3068\u304d\u306b\u4f7f\u3046<\/li>\n<li>return\u306fbool<\/li>\n<li>false\u3092\u8fd4\u3057\u305f\u3089\u3001\u4ee5\u964d\u306ecomponentWillUpdate()\u3001render()\u3001componentDidMount()\u304c\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u308b<\/li>\n<li><span style=\"color: #ff0000;\"><strong>\u3053\u3053\u3067 this.setState() \u3059\u308b\u3068\u7121\u9650\u30eb\u30fc\u30d7\u306b\u5165\u308b\u306e\u3067\u3001\u4f7f\u3063\u3066\u306f\u3044\u3051\u306a\u3044<\/strong><\/span><\/li>\n<\/ul>\n<h6>componentDidUpdate(object prevProps, object prevState)<\/h6>\n<ul>\n<li>\u65b0\u3057\u3044DOM\u304c\u89e6\u308c\u308b<\/li>\n<li>this.setState() \u3092\u547c\u3093\u3067\u306f\u3044\u3051\u306a\u3044<\/li>\n<\/ul>\n<h3>\u30a2\u30f3\u30de\u30a6\u30f3\u30c8\u306e\u3068\u304d\u306b\u547c\u3070\u308c\u308b<\/h3>\n<h6>componentWillUnmount()<\/h6>\n<ul>\n<li>\u30a2\u30f3\u30de\u30a6\u30f3\u30c8\u306e\u3068\u304d\u306b\u547c\u3070\u308c\u308b<\/li>\n<li>\u30ea\u30bd\u30fc\u30b9\u306e\u958b\u653e\u3068\u304b\u3001\u5f8c\u51e6\u7406\u3059\u308b<\/li>\n<\/ul>\n<p><a href=\"https:\/\/mail.google.com\/mail\/u\/0\/#inbox\">React\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u56f3<\/a><\/p>\n<p>&nbsp;<\/p>\n<h6>\u304a\u3057\u307e\u3044<\/h6>\n<p>\u5148\u304c\u307e\u3060\u307e\u3060\u9577\u3044\u301c<\/p>\n<p>GO\u306f\u30b5\u30dc\u308a\u6c17\u5473\u3067\u3059\u3002\u3044\u305d\u304c\u3057\u304f\u3066\u3001\u3044\u305d\u304c\u3057\u304f\u3066\u3002\u3084\u308a\u305f\u3044\u3053\u3068\u3044\u3063\u3071\u3044\u3042\u308b\u306e\u306b\u306a\u3041<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u3044\u308d\u3044\u308d\u8a66\u3057\u3066\u307f\u305f\u3093\u3060\u3051\u3069\u3001\u3055\u3063\u3071\u308a\u7406\u89e3\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u672c\u5bb6\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u3084\u308a\u307e\u3057\u305f\u3002 \u3068\u3053\u308d\u3069\u3053\u308d Qiita \u307f\u306a\u304c\u3089\u3002 \u57fa\u790e React \u3068 React Native \u306e\u9055\u3044  &#8230; <\/p>\n","protected":false},"author":1,"featured_media":4070,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[97],"tags":[],"class_list":["post-4025","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-react"],"_links":{"self":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/4025"}],"collection":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4025"}],"version-history":[{"count":46,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/4025\/revisions"}],"predecessor-version":[{"id":4232,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/4025\/revisions\/4232"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/media\/4070"}],"wp:attachment":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}