Skip to content

Commit 882eae5

Browse files
committed
Commit
1 parent 9477b4a commit 882eae5

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@
44

55
![登录效果](https://github.com/SurpassRabbit/react-native-template/blob/master/screenshots/Login.gif)
66

7+
### 使用小技巧
8+
##### 项目中常用的封装都放在app目录下Common文件夹
9+
1、`FontSize.js`:基于屏幕分辨率封装的字体适配方法,使用方法:`fontSize:FONT_SIZE(14)`
10+
2、`Tool.js`:封装常用的属性方法,比如说判断是否登录,或者其他的方法,在这个方法中,提供了用来做安卓,iOS换算px的方法,使用方法:`width:px2dp(100)`
11+
3、`global.js`:全局变量方法,一般我会用来设置全局的方法,比如说:系统判断,屏幕宽高,主题设置,图片初始化。
12+
具体的详情可以查看`global.js`内部注释。
13+
4、`Config.js`:配置文件,可以用来配置请求网址,配置表等等。
14+
5、`SetTheme.js`:更改主题,`teaset`提供了设置主题和切换主题的能力,但有些时候,有一些颜色需要再手动调整,所以创建了这个文件,通过在里面配置颜色,并在项目的入口中引入,就可以直接使用`Theme.backgroundColor`的方式调用颜色了。
15+
6、`Request.js`:基于`react-native-fetch-blob`封装的网络请求方法,很简单,不喜勿喷。
16+
7、`Images.js`:在`Resources`目录下有`index.js``Images.js`两个文件,这是基于`Marno`关于图片管理文章封装的实践。
17+
718

819
### 2017.11.7更新说明
920
1、使用`teaset``SegmentedView`组件实现左右滑动的效果。
1021
2、使用`teaset``Theme`控制页面中的颜色。
11-
3、使用`Mobx`控制登录中的状态,简单使用。
22+
3、使用`Mobx`控制登录中的状态,简单使用。
23+
4、修改`tabbar`选中图标和文字的颜色,使其更符合**识兔**项目的效果。
24+
25+

app/Component/TabIcon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ const TabIcon = (props) => {
1515
<View>
1616
<Image
1717
source={!props.focused ? props.image : props.selectedImage}
18-
style={[{ height:27,width:27,marginTop:5 }]}
18+
style={[{ height:27,width:27,marginTop:5,tintColor:props.tintColor }]}
1919
/>
2020
<Text
21-
style={{color: '#fff',marginTop:px2dp(6),fontSize:FONT_SIZE(10)}}
21+
style={{paddingLeft:px2dp(5),color:props.tintColor,marginTop:px2dp(6),fontSize:FONT_SIZE(10)}}
2222
>
2323
{props.title}
2424
</Text>

app/Router.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ const router = (...props) => (
6868
icon={TabIcon} // 自定义Icon显示方式
6969
lazy={true} // 是否默认渲染tabbar
7070
tabBarPosition={'bottom'} // tabbar在顶部还是底部,iOS默认顶部,安卓默认顶部
71-
activeBackgroundColor='#aaa' // 选中tabbar的背景色
72-
inactiveBackgroundColor='#4ECBFC' // 未选中tabbar的颜色
71+
activeBackgroundColor='white' // 选中tabbar的背景色
72+
inactiveBackgroundColor='white' // 未选中tabbar的背景色
73+
activeTintColor='#4ECBFC' // 选中tabbar图标的颜色
74+
inactiveTintColor='#aaa' // 未选中tabbar图标的颜色
7375
>
7476
<Stack key="Test1"
7577
title={'识兔'}
@@ -105,7 +107,6 @@ const router = (...props) => (
105107
onLeft={Actions.pop}
106108
/>
107109
<Scene
108-
title='登录'
109110
key="LoginPublic"
110111
component={LoginPublic}
111112
gesturesEnabled={false}

0 commit comments

Comments
 (0)