Commit 5270cd03 authored by Matt Kane's avatar Matt Kane Committed by zooble

Allow user to specify picker row height on iOS (#204)

Allow user to specify row height for iOS
parent e8ff6cc7
......@@ -22,6 +22,7 @@
|pickerToolBarFontSize | |number |16 |
|wheelFlex | |array |[1, 1, 1] |
|pickerFontSize | |number |16 |
|pickerRowHeight | |number |24 |
|pickerFontColor | |array |[31, 31, 31, 1] |
|pickerData | |array | |
|selectedValue | |array | |
......
......@@ -148,6 +148,16 @@ interface PickerOptions {
*/
pickerFontSize?: number
/**
* Row height of the items in the picker
*
* Default is 24
*
* @type {number}
* @memberof PickerOptions
*/
pickerRowHeight?: number
/**
* Color of the text for the items in the picker
*
......
......@@ -17,6 +17,7 @@ const options = {
pickerTitleColor: [20, 20, 20, 1],
pickerToolBarBg: [232, 232, 232, 1],
pickerBg: [196, 199, 206, 1],
pickerRowHeight: 24,
wheelFlex: [1, 1, 1],
pickerData: [],
selectedValue: [],
......@@ -29,7 +30,6 @@ const options = {
};
export default {
init(params){
const opt = {
...options,
......
......@@ -41,7 +41,8 @@ typedef void(^backBolock)(NSDictionary * );
@property(strong,nonatomic)NSString *rightStr;
@property(strong,nonatomic)NSString *pickerToolBarFontSize;
@property(strong,nonatomic)NSString *pickerFontSize;
@property(strong,nonatomic)NSArray*pickerFontColor;
@property(strong,nonatomic)NSArray *pickerFontColor;
@property(strong,nonatomic)NSString *pickerRowHeight;
......@@ -78,7 +79,7 @@ typedef void(^backBolock)(NSDictionary * );
-(instancetype)initWithFrame:(CGRect)frame dic:(NSDictionary *)dic leftStr:(NSString *)leftStr centerStr:(NSString *)centerStr rightStr:(NSString *)rightStr topbgColor:(NSArray *)topbgColor bottombgColor:(NSArray *)bottombgColor leftbtnbgColor:(NSArray *)leftbtnbgColor rightbtnbgColor:(NSArray *)rightbtnbgColor centerbtnColor:(NSArray *)centerbtnColor selectValueArry:(NSArray *)selectValueArry weightArry:(NSArray *)weightArry
pickerToolBarFontSize:(NSString *)pickerToolBarFontSize pickerFontSize:(NSString *)pickerFontSize pickerFontColor:(NSArray *)pickerFontColor;
pickerToolBarFontSize:(NSString *)pickerToolBarFontSize pickerFontSize:(NSString *)pickerFontSize pickerFontColor:(NSArray *)pickerFontColor pickerRowHeight:(NSString *)pickerRowHeight;
-(void)selectRow;
@end
......@@ -12,7 +12,7 @@
@implementation BzwPicker
-(instancetype)initWithFrame:(CGRect)frame dic:(NSDictionary *)dic leftStr:(NSString *)leftStr centerStr:(NSString *)centerStr rightStr:(NSString *)rightStr topbgColor:(NSArray *)topbgColor bottombgColor:(NSArray *)bottombgColor leftbtnbgColor:(NSArray *)leftbtnbgColor rightbtnbgColor:(NSArray *)rightbtnbgColor centerbtnColor:(NSArray *)centerbtnColor selectValueArry:(NSArray *)selectValueArry weightArry:(NSArray *)weightArry
pickerToolBarFontSize:(NSString *)pickerToolBarFontSize pickerFontSize:(NSString *)pickerFontSize pickerFontColor:(NSArray *)pickerFontColor
pickerToolBarFontSize:(NSString *)pickerToolBarFontSize pickerFontSize:(NSString *)pickerFontSize pickerFontColor:(NSArray *)pickerFontColor pickerRowHeight:(NSString *)pickerRowHeight
{
self = [super initWithFrame:frame];
......@@ -30,6 +30,7 @@
self.pickerToolBarFontSize=pickerToolBarFontSize;
self.pickerFontSize=pickerFontSize;
self.pickerFontColor=pickerFontColor;
self.pickerRowHeight=pickerRowHeight;
[self getStyle];
[self getnumStyle];
dispatch_async(dispatch_get_main_queue(), ^{
......@@ -469,6 +470,12 @@
self.bolock(dic);
}
}
- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component
{
return self.pickerRowHeight.integerValue;
}
//判断进来的类型是那种
-(void)getStyle
{
......
......@@ -8,7 +8,7 @@
#import "RCTBEEPickerManager.h"
#import "BzwPicker.h"
#import "RCTEventDispatcher.h"
#import <React/RCTEventDispatcher.h>
@interface RCTBEEPickerManager()
......@@ -55,7 +55,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
NSString *pickerToolBarFontSize=[NSString stringWithFormat:@"%@",indic[@"pickerToolBarFontSize"]];
NSString *pickerFontSize=[NSString stringWithFormat:@"%@",indic[@"pickerFontSize"]];
NSArray *pickerFontColor=indic[@"pickerFontColor"];
NSString *pickerRowHeight=indic[@"pickerRowHeight"];
id pickerData=indic[@"pickerData"];
NSMutableDictionary *dataDic=[[NSMutableDictionary alloc]init];
......@@ -78,10 +78,9 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
}else{
self.height=220;
}
self.pick=[[BzwPicker alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.height) dic:dataDic leftStr:pickerCancelBtnText centerStr:pickerTitleText rightStr:pickerConfirmBtnText topbgColor:pickerToolBarBg bottombgColor:pickerBg leftbtnbgColor:pickerCancelBtnColor rightbtnbgColor:pickerConfirmBtnColor centerbtnColor:pickerTitleColor selectValueArry:selectArry weightArry:weightArry pickerToolBarFontSize:pickerToolBarFontSize pickerFontSize:pickerFontSize pickerFontColor:pickerFontColor];
self.pick=[[BzwPicker alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.height) dic:dataDic leftStr:pickerCancelBtnText centerStr:pickerTitleText rightStr:pickerConfirmBtnText topbgColor:pickerToolBarBg bottombgColor:pickerBg leftbtnbgColor:pickerCancelBtnColor rightbtnbgColor:pickerConfirmBtnColor centerbtnColor:pickerTitleColor selectValueArry:selectArry weightArry:weightArry pickerToolBarFontSize:pickerToolBarFontSize pickerFontSize:pickerFontSize pickerFontColor:pickerFontColor pickerRowHeight: pickerRowHeight];
_pick.bolock=^(NSDictionary *backinfoArry){
dispatch_async(dispatch_get_main_queue(), ^{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment