Skip to content

Commit ad98fb7

Browse files
author
lijie
committed
新增修改label字体粗细属性
1 parent bb990f9 commit ad98fb7

File tree

6 files changed

+34
-10
lines changed

6 files changed

+34
-10
lines changed

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
example/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ mjHeaderStyle需要指定一个对象,通过这个对象来的属性来设置
174174
| hideTimeLabel | 是否隐藏时间标签 | Boolean | 默认为 false | |
175175
| hideStateLabel | 是否隐藏显示状态文字的标签 | Boolean | 默认为 false | |
176176
| labelImageGap | 菊花/箭头/图片 与 文字 的间距 | Number | 如果header类型是 gifTop 则默认值为0, 其他情况下默认值为20 | 单位pt |
177-
| stateLabelStyle | 显示状态文字的标签样式 | Object | **Object.fontSize** 字体大小<br>**Object.color** 字体颜色,可以使用十六进制色号 如: #1232fa, 也可以使用 rgb(255,2,34) 以及带不透明度的 rgba(255,22,2,0.5),如果色号格式不正确,则返回黑色 | fontSize默认值14pt<br>color默认值#5A5A5A |
177+
| stateLabelStyle | 显示状态文字的标签样式 | Object | **Object.fontSize** 字体大小<br>**Object.bold** 字体粗细(true/false)<br>**Object.color** 字体颜色,可以使用十六进制色号 如: #1232fa, 也可以使用 rgb(255,2,34) 以及带不透明度的 rgba(255,22,2,0.5),如果色号格式不正确,则返回黑色 | fontSize默认值14pt<br>color默认值#5A5A5A |
178178
| timeLabelStyle | 显示上次刷新时间的标签样式 | 同上 | 同上 | 同上 |
179179
| stateTitle | 状态标签在各个状态下显示的文字 | Object | **Object.idle** 开始下拉时的状态文字<br>**Object.pulling** 下拉超过刷新阈值, 如果放手则触发刷新的状态文字<br>**Object.refreshing** 正在刷新状态文字<br>**Object.willRefresh** 将要刷新状态文字<br>**Object.noMoreData** 没有更多数据状态(适用于上拉加载更多)文字 | 1.各个属性值类型为字符串 |
180180
| ignoredInsetTop | 刷新组件距离scrollview的内容顶部的距离 | Number | 默认值为 0 | |
@@ -191,7 +191,7 @@ mjHeaderStyle需要指定一个对象,通过这个对象来的属性来设置
191191
| gifImages | 指定各个状态下的动画图片 | Object | Object属性值与headerStyle的gifImages相同 | 1. 只有footerType为 autoGif backGif 类型才有效<br>2. 使用方法同headerType中的gifImages属性的使用方法一致, 具体详情请看之前描述 |
192192
| labelImageGap | 菊花/箭头/图片 与 文字 的间距 | Number | 如果header类型是 gifTop 则默认值为0, 其他情况下默认值为20 | 单位pt |
193193
| hideStateLabel | 是否隐藏显示状态文字的标签 | Boolean | 默认为 false | |
194-
| stateLabelStyle | 显示状态文字的标签样式 | Object | **Object.fontSize** 字体大小<br>**Object.color** 字体颜色,可以使用十六进制色号 如: #1232fa, 也可以使用 rgb(255,2,34) 以及带不透明度的 rgba(255,22,2,0.5),如果色号格式不正确,则返回黑色 | fontSize默认值14pt<br>color默认值#5A5A5A |
194+
| stateLabelStyle | 显示状态文字的标签样式 | Object | **Object.fontSize** 字体大小<br>**Object.bold** 字体粗细(true/false)<br>**Object.color** 字体颜色,可以使用十六进制色号 如: #1232fa, 也可以使用 rgb(255,2,34) 以及带不透明度的 rgba(255,22,2,0.5),如果色号格式不正确,则返回黑色 | fontSize默认值14pt<br>color默认值#5A5A5A |
195195
| stateTitle | 状态标签在各个状态下显示的文字 | Object | 各个状态值与headerStyle的stateTitle相同 | 1.idle状态autoXX 类型下显示: 点击或上拉加载更多 backXX 类型下显示: 上拉可以加载更多<br>pulling状态,footerType为 backNormal backGif 时有效, 默认显示: 松开立即加载更多 |
196196
| ignoredInsetBottom | 上拉加载组件距离ScrollView的内容底部距离 | Number | 只有footerType为 backNormal backGif 时才有效 | 默认为0 |
197197
| autoChangeAlpha | 是否在上拉拖拽时, 上拉加载组件自动改变不透明度 | Boolean | 默认值 false | |

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@
236236
FA990366247F8A6400C8AE00 /* RNCWebView+MJRefresh */ = {
237237
isa = PBXGroup;
238238
children = (
239+
FA990369247F8A6400C8AE00 /* RNCWebView+MJRfresh.h */,
239240
FA990367247F8A6400C8AE00 /* RNCWebView+MJRfresh.m */,
240241
FA990368247F8A6400C8AE00 /* RNCWebViewManager+MJRefresh.h */,
241-
FA990369247F8A6400C8AE00 /* RNCWebView+MJRfresh.h */,
242242
FA99036A247F8A6400C8AE00 /* RNCWebViewManager+MJRefresh.m */,
243243
);
244244
name = "RNCWebView+MJRefresh";
@@ -248,9 +248,9 @@
248248
FA99036B247F8A6400C8AE00 /* RCTScrollView+MJRefresh */ = {
249249
isa = PBXGroup;
250250
children = (
251+
FA99036E247F8A6400C8AE00 /* RCTScrollView+MJRefresh.h */,
251252
FA99036C247F8A6400C8AE00 /* RCTScrollView+MJRefresh.m */,
252253
FA99036D247F8A6400C8AE00 /* RCTScrollViewManager+MJRefresh.h */,
253-
FA99036E247F8A6400C8AE00 /* RCTScrollView+MJRefresh.h */,
254254
FA99036F247F8A6400C8AE00 /* RCTScrollViewManager+MJRefresh.m */,
255255
);
256256
name = "RCTScrollView+MJRefresh";

ios/RCTScrollView+MJRefresh/RCTScrollView+MJRefresh.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,22 @@ -(void)settingMJHeaderAutomaticallyChangeAlpha:(NSNumber *)isAuto{
199199
}
200200
}
201201
-(void)setLabelStyleWithLable: (UILabel *)label styles: (NSDictionary *)styles{
202-
// styles里面可用的值只有(暂且) fontSize color
202+
// styles里面可用的值只有(暂且) fontSize bold color
203203
NSNumber *fontSize = styles[@"fontSize"];
204+
NSNumber *bold = styles[@"bold"];
204205
NSString *color = styles[@"color"];
205206
if (fontSize) {
206-
label.font = [UIFont boldSystemFontOfSize:fontSize.floatValue];
207+
if (bold.boolValue) {
208+
label.font = [UIFont boldSystemFontOfSize:fontSize.floatValue];
209+
}else{
210+
label.font = [UIFont systemFontOfSize:fontSize.floatValue];
211+
}
212+
}else{
213+
if (bold.boolValue) {
214+
label.font = [UIFont boldSystemFontOfSize: 14];
215+
}else{
216+
label.font = [UIFont systemFontOfSize: 14];
217+
}
207218
}
208219
if (color) {
209220
UIColor *textcolor = [UIColor xy_colorWithColorString:color];

ios/RNCWebView+MJRefresh/RNCWebView+MJRfresh.m

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,25 @@ -(void)settingMJHeaderAutomaticallyChangeAlpha:(NSNumber *)isAuto{
250250
}
251251
}
252252
-(void)setLabelStyleWithLable: (UILabel *)label styles: (NSDictionary *)styles{
253-
// styles里面可用的值只有(暂且) fontSize color
253+
// styles里面可用的值只有(暂且) fontSize bold color
254254
NSNumber *fontSize = styles[@"fontSize"];
255+
NSNumber *bold = styles[@"bold"];
255256
NSString *color = styles[@"color"];
256257
if (fontSize) {
257-
label.font = [UIFont boldSystemFontOfSize:fontSize.floatValue];
258+
if (bold.boolValue) {
259+
label.font = [UIFont boldSystemFontOfSize:fontSize.floatValue];
260+
}else{
261+
label.font = [UIFont systemFontOfSize:fontSize.floatValue];
262+
}
263+
}else{
264+
if (bold.boolValue) {
265+
label.font = [UIFont boldSystemFontOfSize: 14];
266+
}else{
267+
label.font = [UIFont systemFontOfSize: 14];
268+
}
258269
}
259270
if (color) {
260-
UIColor *textcolor = [UIColor xy_colorWithColorString: color];
271+
UIColor *textcolor = [UIColor xy_colorWithColorString:color];
261272
label.textColor = textcolor;
262273
}
263274
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-mjrefresh-ios",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"description": "the extension of MJRefresh in React Native",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)