React Native---iOS开发学习

作为一名iOS开发者,断断续续一年前开始接触React Native,最近由于工作需要,专职学习React Native也有一个多月了。网络上知识资源非常的多,但能让人豁然开朗、迅速学习的还是少数,我整理出的这些文章对于初学者来说是比较有好的,希望通过整理我的学习路线,能给同样作为iOS开发者,想学习React Native的朋友们一些帮助。

既然是写给iOS开发者的,那么我默认你已经掌握iOS原生应用开发的基本知识,所以对iOS原生开发的相关内容不做解释说明。


React Native概念介绍

名词解释
  • 首先列举几个关键词:

    • React

    • Native

    • React Native

  • 这三个词其实没有太大关系,我们逐个来解释:

    • React:近几年Web前端领域非常火热的一个开发框架React.JS,其核心思想是将视图组件化,通过更新组件的state来渲染出组件。
      Native:这个词从字面理解就够了,就是指原生的。前几年有个非常火热的跨平台开发框架– PhoneGap(现称Cordova),那就不是原生的开发方式。原生就要使用对应平台的特定语言和框架进行开发,比如使用Objective-C或Swift开发的iOS应用。

    • React Native:结合了这两个词,我们可以简单地得到结论:使用React框架进行原生方式的开发。

实现原理

我们都知道在iOS平台上,苹果提供了一个JavaScriptCore的framework,可以进行JavaScript语言的解析,React Native通过多次封装定义,最终实现了在JavaScript语言中调用Objective-C的类和方法。具体的原理我们现在还不必深究,后文的学习路线中会有提到。
所以既然是调用Objective-C的类和方法,性能上当然是不差的(但也不完美),所以这也是React Native相比其他跨平台开发方式的一大优势。

评价
  • 跨平台:目前React Native官方已经支持iOS、Android两个平台的移动设备,民间也有一些大牛在做macOS、tvOS,甚至UWP平台的适配。但由于不同平台特性不同,并不能一份代码在所有平台上直接运行,React Native的思想是「Learn once, write anywhere」,我们需要针对不同平台的特性写出不同的代码,尽量保持组件的高可复用性。

  • 性能:官方宣称性能堪比Native,实际使用中我们会发现几个问题,比如复杂视图渲染出View层级过多、ListView(等同于iOS上的UITableView)无重用机制、有些组件存在内存泄露。这就会导致在部分低端Android机型上的性能过差,复杂的、大型的应用会有明显性能问题。

  • 热更新:由于App Store应用商店发版迭代效率问题,热更新成为了iOS平台非常渴求的功能,可喜的是React Native的热更新能力非常好,通过将JavaScript代码部署到服务器中,运行过程中即可重新reload整个界面。(PS:目前热更苹果已经出台针对措施!)

  • 学习成本:对于iOS开发者来讲,要了解相当数量的Web前端开发知识才可以进行开发,对于Web前端开发者来讲,对于原生性能调优则需要原生开发知识和经验,所以说学习成本略高。

  • 开发效率 :Android和iOS平台可复用很多组件,仅部分代码需要各自平台分别维护,所以比开发两个平台原生应用效率要高得多。加上本身可动态渲染的能力,不用重新编译,Command⌘+R即可重新渲染界面,开发效率更是惊人地快。


学习路线

按照顺序进行学习即可


React Native

快速入门
布局
组件
React with Redux
热更新
原理
推荐资源
最后附上原文链接:

talisk斯温的技术博客](http://blog.talisk.cn/)

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Discover how to use React Native in the real world, from scratch. This book shows you what React Native has to offer, where it came from, and where it’s going. You’ll begin with a solid foundation of practical knowledge, and then build on it immediately by constructing three different apps. You’ll learn how to use each feature of React Native by working on two full projects and one full game. These aren’t just simple React Native Hello World examples (although you’ll naturally start there!) but are apps that you can, if you so choose, install on your mobile devices and use for real. Throughout this book, you’ll gain real-world familiarity with React Native as well as supporting components from Expo, NativeBase, React Navigation and the Redux and Lodash libraries. You’ll also build server-side code for a mobile React Native app to talk to using the popular Node.js and Socket.io library, providing you a holistic view of things even beyond React Native. And, you’ll see many helpful tips, tricks and gotchas to watch out for along the way! Practical React Native offers practical exercises that will give you a solid grasp of building apps with React Native, allowing you to springboard into creating more advanced apps on your own.Creating a game with React Native will allow you to see a whole other perspective on what React Native can do. What You’ll Learn Master the basics of React Native Create a logically structured project Review interface elements, such as widgets, controls, and extensions Build layouts Work with Expo, an open source toolchain Who This book Is For The primary audience is mobile developers and anyone looking to build for multiple mobile platforms and trying to do so with a codebase that is largely the same across all. Readers will need a decent foundation, but not necessarily be experts in, HTML, CSS, and JavaScript, but I’ll assume little beyond that.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值