<p style="margin-top:20px; margin-bottom:20px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue',Arial,'Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif; font-size:16px; line-height:27.2000007629395px"> 数月前,<a class="wrap external" href="https://code.facebook.com/videos/786462671439502/react-js-conf-2015-keynote-introducing-react-native-/" rel="noopener noreferrer" style="text-decoration:none; color:rgb(34,93,153); margin:0px 4px 0px 0px; word-break:break-word; background:transparent" target="_blank">Facebook 对外宣布了正在开发的 React Native 框架<span class="icon-external" style="margin-left:4px; display:inline-block; width:7px; height:7px; vertical-align:0px"></span></a>,这个框架允许你使用 JavaScript 开发原生的 iOS 应用——就在今天,<a class="wrap external" href="https://github.com/facebook/react-native" rel="noopener noreferrer" style="text-decoration:none; color:rgb(34,93,153); margin:0px 4px 0px 0px; word-break:break-word; background:transparent" target="_blank">Beta 版的仓库<span class="icon-external" style="margin-left:4px; display:inline-block; width:7px; height:7px; vertical-align:0px"></span></a>释出了!</p>
<p style="margin-top:20px; margin-bottom:20px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue',Arial,'Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif; font-size:16px; line-height:27.2000007629395px"> 基于 <a class="wrap external" href="http://phonegap.com/" rel="noopener noreferrer" style="text-decoration:none; color:rgb(34,93,153); margin:0px 4px 0px 0px; word-break:break-word; background:transparent" target="_blank">PhoneGap<span class="icon-external" style="margin-left:4px; display:inline-block; width:7px; height:7px; vertical-align:0px"></span></a> 使用 JavaScript 和 HTML5 开发 iOS 应用已经有好几年了,那 React Native 有什么牛的?</p>
<p style="margin-top:20px; margin-bottom:20px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue',Arial,'Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif; font-size:16px; line-height:27.2000007629395px"> React Native 真的很牛,让大家兴奋异常的主要原因有两点:</p>
<ol style="margin:20px 0px; padding-left:24px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue',Arial,'Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif; font-size:16px; line-height:27.2000007629395px"><li style="margin-top:10px"> <p style="margin-top:20px; margin-bottom:20px">可以基于 React Native使用 JavaScript 编写应用逻辑,UI 则可以保持全是原生的。这样的话就没有必要就 HTML5 的 UI 做出常见的妥协;</p> </li><li style="margin-top:10px"> <p style="margin-top:20px; margin-bottom:20px">React 引入了一种与众不同的、略显激进但具备高可用性的方案来构建用户界面。长话短说,应用的 UI 简单通过一个基于应用目前状态的函数来表达。</p> </li></ol>
<p style="margin-top:20px; margin-bottom:20px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue',Arial,'Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif; font-size:16px; line-height:27.2000007629395px"> React Native 的关键就是,以把 <a class="wrap external" href="http://facebook.github.io/react/" rel="noopener noreferrer" style="text-decoration:none; color:rgb(34,93,153); margin:0px 4px 0px 0px; word-break:break-word; background:transparent" target="_blank">React<span class="icon-external" style="margin-left:4px; display:inline-block; width:7px; height:7px; vertical-align:0px"></span></a> 编程模式的能力带到移动开发来作为主要目标。它的目标不是跨平台一次编写到处执行,而是一次学习跨平台开发。这个是一个非常大的区别。这篇教程只介绍 iOS 平台,不过你一旦掌握了相关的概念,就可以应用到 Android 平台,快速构建 Android 应用。</p>
<p style="margin-top:20px; margin-bottom:20px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue',Arial,'Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif; font-size:16px; line-height:27.2000007629395px"> 如果之前只用过 Objective-C 或者 Swift 写应用的话,你很可能不会对使用 JavaScript 来编写应用的愿景感到兴奋。尽管如此,作为一个 Swift 开发者来说,上面提到的第二点应该可以激起你的兴趣!</p>
<p style="margin-top:20px; margin-bottom:20px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue',Arial,'Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif; font-size:16px; line-height:27.2000007629395px"> 你通过 Swift,毫无疑问学习到了新的更多有效的编码方法和技巧,鼓励转换和不变性。然而,构建 UI 的方式还是和使用 Objective-C 的方式一致。仍然以 UIKit 为基础,独断专横。</p>
<p style="margin-top:20px; margin-bottom:20px; color:rgb(65,66,67); font-family:'Open Sans','Helvetica Neue& |
|