Skip to content

Commit 859abee

Browse files
committed
add react-native
1 parent 17ee181 commit 859abee

File tree

2 files changed

+79
-4
lines changed

2 files changed

+79
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,16 @@ Android-Note里面记录了有关Android的常用基础知识、面试中经常
118118

119119

120120

121+
## ReactNative
122+
123+
- [ReactNative入门](/ReactNative相关/ReactNative入门.md)
124+
125+
126+
121127
## webRTC相关
122128

123129
- [WebRTC——Android入门](/webRTC相关/WebRTC——Android入门.md)
124-
- [WebRTC——Android源码解析](/webRTC相关/WebRTC-Android源码解析.md)
130+
- [WebRTC——Android源码解析](/webRTC相关/WebRTC-Android源码解析.md)
125131

126132
----
127133

@@ -205,6 +211,3 @@ Unless required by applicable law or agreed to in writing, software distributed
205211
**已经看到这里啦,不妨给个star~**
206212

207213
![](/img/background.jpg)
208-
209-
210-
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# ReactNative入门
2+
3+
## 简介
4+
5+
ReactNative旨在开发过程的高效,它具有一些原生App所不具备的优势,它的跨平台性非常强,代码的复用程度非常的高,并且可以具有热更新的能力,其次就是它的社区也在日趋的强大起来。
6+
7+
## 为什么选择ReactNative
8+
9+
纵观国内的比较大的厂商并没有完全的转移到React Native,但也没有完全的排斥说不搞React Native,所以学习这样一个新的技能对我们有百利而无一害,在学习React Native的过程中,我们也会接触到React这样一个新的UI方案,同时对一些ES6,ES7新的特性也都会有接触,总体感觉还不错~
10+
11+
## 入门
12+
13+
学习React Native最好还是要有一些React JavaScript 以及原生应用的开发经验,当然没有也无妨,慢慢一步一步的来嘛。
14+
15+
**目前我介绍的是针对Android端介绍的,后续也会把Ios相关的内容补上。**
16+
17+
需要有的软件:
18+
19+
- Node.js
20+
- Android studio
21+
- Watchman
22+
23+
运行:
24+
25+
```
26+
react-native init AwesomeProject
27+
cd AwesomeProject
28+
react-native run-android
29+
```
30+
31+
## 知识点
32+
33+
**项目的入口:** index.android.js / index.ios.js
34+
35+
**视图呈现:**
36+
37+
```
38+
render() {
39+
return (
40+
<View style={cStyles.container}>
41+
<View style={styles.row}>
42+
<Text style={styles.label}>AAA</Text>
43+
<View style={styles.rowCount}>
44+
<Text style={styles.countUnit}>BBB/Text>
45+
<Text style={styles.price}>CCC</Text>
46+
</View>
47+
</View>
48+
<LinkRow label="DDD" onPress={() => {
49+
}}/>
50+
<LinkRow label="EEE" onPress={this.logout}/>
51+
</View>
52+
);
53+
}
54+
```
55+
56+
我们的视图需要写在return()下面,并且这个下面只能有一个根View
57+
58+
**抽出公共控件:**
59+
60+
在界面中,可能我们有很多控件是可以复用的,如果我们不把它们抽出来的话,可能就会导致代码的臃肿,并且不是很利于维护,所以我们应该将公共部分抽出来。
61+
62+
**将公用的style抽象出来**
63+
64+
同上
65+
66+
## 推荐编译器
67+
68+
- 需要测试性能的时候需要使用Android studio
69+
- 与性能无关时,编写代码时还是推荐使用WebStorm编写代码
70+
71+
72+
好了,就先介绍到这里吧,在等到我有时间的时候,可以介绍一下,手写一个tab,或者实现登录注册的全部逻辑(包含网络框架)。

0 commit comments

Comments
 (0)