{"id":925,"date":"2022-02-23T14:54:29","date_gmt":"2022-02-23T06:54:29","guid":{"rendered":"http:\/\/blog.xrhoujie.com\/?p=925"},"modified":"2022-02-23T14:54:29","modified_gmt":"2022-02-23T06:54:29","slug":"reactnative%e5%88%9d%e4%bd%93%e9%aa%8cflex%e7%af%87%e4%ba%8c","status":"publish","type":"post","link":"http:\/\/blog.xrhoujie.com\/?p=925","title":{"rendered":"ReactNative\u521d\u4f53\u9a8cflex\u7bc7(\u4e8c)"},"content":{"rendered":"\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u4f7f\u7528flexDirection\u3001alignItems\u548c&nbsp;justifyContent\u4e09\u4e2a\u6837\u5f0f\u5c5e\u6027\u5c31\u5df2\u7ecf\u80fd\u6ee1\u8db3\u5927\u591a\u6570\u5e03\u5c40\u9700\u6c42\u3002<\/p>\n\n\n\n<p>\u53c2\u8003\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/reactnative.cn\/docs\/flexbox\">https:\/\/reactnative.cn\/docs\/flexbox<\/a><br>\u5907\u6ce8\uff1a1.flex\u5185\u90e8\u53ef\u591a\u5c42\u5d4c\u5957\u30022.felx\u603b\u9ad8\u5ea6\u56fa\u5b9a\uff0c\u5b50\u9009\u9879\u8d85\u51fa\u5219\u9876\u51fa\u53bb\u4e0d\u4f1a\u5f71\u54cdflex\u5bb9\u5668\u53d8\u5316\u30023.felx\u9ad8\u5ea6\u4e0d\u786e\u5b9a\u65f6\uff0c\u4f1a\u9009\u62e9\u9ad8\u5ea6\u6700\u9ad8\u7684\u5b50\u9009\u62e9\u9ad8\u5ea6\u6491\u5f00\u3002<br><strong>(2)felx example\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import React, {Component} from \"react\";\nimport {StyleSheet, View, Text} from \"react-native\";\n\n\/**\n * Created by marno on 2022\/2\/22.\n * Desc:\u7b49\u4efd\u5e03\u5c40\n *\/\nexport default class FlexDiceTest extends Component {\n    render() {\n        return (\n            &lt;View style={{flexDirection: 'row', height: 100, padding: 20}}>\n          &lt;View style={{backgroundColor: 'blue', flex: 0.5}} \/>\n          &lt;View style={{backgroundColor: 'red', flex: 0.25}} \/>\n          &lt;View style={{backgroundColor: 'green', flex: 0.25}} \/>\n      &lt;\/View>\n        )\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u9884\u89c8\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2022\/02\/image3.png\" alt=\"\" class=\"wp-image-926\" width=\"152\" height=\"111\" srcset=\"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2022\/02\/image3.png 558w, http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2022\/02\/image3-300x219.png 300w\" sizes=\"(max-width: 152px) 100vw, 152px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u822c\u6765\u8bf4\uff0c\u4f7f\u7528flexDirection\u3001alignItems\u548c&nbsp;justifyContent\u4e09\u4e2a\u6837 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40,1],"tags":[39],"_links":{"self":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/925"}],"collection":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=925"}],"version-history":[{"count":1,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/925\/revisions"}],"predecessor-version":[{"id":927,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/925\/revisions\/927"}],"wp:attachment":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=925"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}