Skip to content

Commit 4fd991a

Browse files
committed
更新文档
1 parent 6eecfd1 commit 4fd991a

File tree

2 files changed

+164
-0
lines changed

2 files changed

+164
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# `react-native-smartbar`
22
Maybe this is the best tabbar
33

4+
>### **Install**
5+
```apple js
6+
7+
```
8+
49
>### **Get Started**
510
611
- DEMO

README_CN.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# `react-native-smartbar`
2+
可能是最好的tabbar。
3+
4+
>### **开始**
5+
6+
- 效果展示
7+
8+
![Witt Bulter](http://obqqxnnm4.bkt.clouddn.com/demo.gif?imageView2/1/w/140/h/280)
9+
10+
- 显示/隐藏
11+
12+
![Witt Bulter](http://obqqxnnm4.bkt.clouddn.com/demo-2.gif?imageView2/1/w/140/h/280)
13+
14+
- 只显示图片
15+
16+
如果你希望只显示图片, 忽略此项属性即可: [text(TabBar.Item)]
17+
![Witt Bulter](http://obqqxnnm4.bkt.clouddn.com/demo-3.png?imageView1/1/w/500/h/110)
18+
- 只显示文字
19+
20+
如果你希望只显示文字, 忽略此项属性即可: [image(TabBar.Item)]
21+
![Witt Bulter](http://obqqxnnm4.bkt.clouddn.com/demo-4.png?imageView1/1/w/500/h/110)
22+
23+
24+
25+
>### **文档**
26+
27+
- TabBar(底部bar)
28+
29+
| 属性 | 类型 | 必须 | 描述 | 例子 |
30+
| ----------- | ------ | -------- | ---------------------------- | ----------------------------- |
31+
| activeColor | string || 激活颜色 | activeColor={'#FE985B'} |
32+
| toggleBar | bool || 显示与隐藏 | toggleBar={this.state.toggle} |
33+
| height | number || 高度,默认高度45px | height={50} |
34+
| index | number || 跳转至指定路由 | index={this.state.index} |
35+
| style | style || 自定义样式 | style={{height: 500}} |
36+
37+
38+
- TabBar.Item(底部bar的每一个子项)
39+
40+
| 属性 | 类型 | 必须 | 描述 | 例子 |
41+
| ------------ | ------ | -------- | ---------------- | --------------------------------- |
42+
| icon | image || 默认图标(图片) | icon={require('./img/abc.png')} |
43+
| selectedIcon | image || 激活时图标(图片) | icon={require('./img/abc_2.png')} |
44+
| text | string || 默认文字 | text={'List'} |
45+
| style | style || 自定义样式 | style={{height: 500}} |
46+
47+
48+
49+
>### **特点**
50+
51+
1. 简单敏捷的控制显示/隐藏
52+
53+
```javascript
54+
<TabBar
55+
// ...
56+
ref={tabbar=> this.tabbar=tabbar}
57+
>
58+
59+
// 使用句柄的函数控制
60+
this.tabbar.toggleBar()
61+
62+
// 或是设置一个布尔值
63+
this.tabbar.toggleBar(true)
64+
this.tabbar.toggleBar(false)
65+
```
66+
67+
或者使用属性的方式:
68+
69+
```javascript
70+
<TabBar
71+
// ...
72+
toggleBar={this.state.toggle}
73+
>
74+
75+
// toggle
76+
componentWillReceiveProps (nextProps){
77+
this.setState({
78+
toggle: nextProps.toggle
79+
})
80+
}
81+
82+
```
83+
84+
2. 标准的指定路由跳转方式:
85+
```javascript
86+
<TabBar
87+
// ...
88+
ref={tabbar=> this.tabbar=tabbar}
89+
>
90+
91+
// 使用句柄的函数跳转
92+
this.tabbar.jumpToIndex(index)
93+
94+
```
95+
96+
或者通过设置属性的方式跳转:
97+
98+
```javascript
99+
<TabBar
100+
// ...
101+
index={this.state.index}
102+
>
103+
104+
// jump
105+
componentWillReceiveProps (nextProps){
106+
this.setState({
107+
index: nextProps.index
108+
})
109+
}
110+
111+
```
112+
113+
3. 可扩展的样式:
114+
115+
你可以为tabbar自定义任何样式:
116+
```javascript
117+
<TabBar
118+
// ...
119+
style={{...}}
120+
>
121+
<TabBar.Item
122+
// ...
123+
style={{...}}
124+
>
125+
<Index />
126+
</TabBar.Item>
127+
</TabBar>
128+
129+
```
130+
131+
132+
>### **使用例子**
133+
134+
参见 /example
135+
136+
>### **支持**
137+
138+
- MAIL `(# = @) => nanazuimeng123#gmail.com`
139+
- [ISSUES](https://github.com/WittBulter/react-native-smartbar/issues)
140+
141+
142+
143+
144+
145+
146+
147+
148+
149+
150+
151+
152+
153+
154+
155+
156+
157+
158+
159+

0 commit comments

Comments
 (0)