Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-picker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
react-native-picker
Commits
6af175d6
Commit
6af175d6
authored
May 18, 2018
by
xwenliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new feature pickerFontFamily for both android and ios
parent
0e39dea0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
32 deletions
+23
-32
README.md
README.md
+1
-1
index.d.ts
index.d.ts
+1
-1
ios/RCTBEEPickerManager/BzwPicker.h
ios/RCTBEEPickerManager/BzwPicker.h
+2
-1
ios/RCTBEEPickerManager/BzwPicker.m
ios/RCTBEEPickerManager/BzwPicker.m
+15
-26
ios/RCTBEEPickerManager/RCTBEEPickerManager.m
ios/RCTBEEPickerManager/RCTBEEPickerManager.m
+3
-2
package.json
package.json
+1
-1
No files found.
README.md
View file @
6af175d6
...
...
@@ -25,7 +25,7 @@
|wheelFlex | array | [1, 1, 1] | iOS/Android | |
|pickerFontSize | number | 16 | iOS/Android | |
|pickerFontColor | array | [31, 31, 31, 1] | iOS/Android | |
|pickerFontFamily | string | |
Android
| |
|pickerFontFamily | string | |
iOS/Android
| |
|pickerRowHeight | number | 24 | iOS | |
|pickerData | array | | iOS/Android | |
|selectedValue | array | | iOS/Android | |
...
...
index.d.ts
View file @
6af175d6
...
...
@@ -60,7 +60,7 @@ interface PickerOptions {
* @type {string}
* @memberof PickerOptions
*/
pickerCancelBtnText
:
string
pickerCancelBtnText
?
:
string
/**
* The color of the text for the confirm button
...
...
ios/RCTBEEPickerManager/BzwPicker.h
View file @
6af175d6
...
...
@@ -41,6 +41,7 @@ typedef void(^backBolock)(NSDictionary * );
@property
(
strong
,
nonatomic
)
NSString
*
rightStr
;
@property
(
strong
,
nonatomic
)
NSString
*
pickerToolBarFontSize
;
@property
(
strong
,
nonatomic
)
NSString
*
pickerFontSize
;
@property
(
strong
,
nonatomic
)
NSString
*
pickerFontFamily
;
@property
(
strong
,
nonatomic
)
NSArray
*
pickerFontColor
;
@property
(
strong
,
nonatomic
)
NSString
*
pickerRowHeight
;
...
...
@@ -79,7 +80,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
pickerRowHeight
:(
NSString
*
)
pickerRowHeight
;
pickerToolBarFontSize
:(
NSString
*
)
pickerToolBarFontSize
pickerFontSize
:(
NSString
*
)
pickerFontSize
pickerFontColor
:(
NSArray
*
)
pickerFontColor
pickerRowHeight
:(
NSString
*
)
pickerRowHeight
pickerFontFamily
:(
NSString
*
)
pickerFontFamily
;
-
(
void
)
selectRow
;
@end
ios/RCTBEEPickerManager/BzwPicker.m
View file @
6af175d6
...
...
@@ -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
pickerRowHeight
:(
NSString
*
)
pickerRowHeight
pickerToolBarFontSize
:(
NSString
*
)
pickerToolBarFontSize
pickerFontSize
:(
NSString
*
)
pickerFontSize
pickerFontColor
:(
NSArray
*
)
pickerFontColor
pickerRowHeight
:(
NSString
*
)
pickerRowHeight
pickerFontFamily
:(
NSString
*
)
pickerFontFamily
{
self
=
[
super
initWithFrame
:
frame
];
...
...
@@ -29,6 +29,7 @@
self
.
centStr
=
centerStr
;
self
.
pickerToolBarFontSize
=
pickerToolBarFontSize
;
self
.
pickerFontSize
=
pickerFontSize
;
self
.
pickerFontFamily
=
pickerFontFamily
;
self
.
pickerFontColor
=
pickerFontColor
;
self
.
pickerRowHeight
=
pickerRowHeight
;
[
self
getStyle
];
...
...
@@ -43,46 +44,34 @@
-
(
void
)
makeuiWith
:(
NSArray
*
)
topbgColor
With
:(
NSArray
*
)
bottombgColor
With
:(
NSArray
*
)
leftbtnbgColor
With
:(
NSArray
*
)
rightbtnbgColor
With
:(
NSArray
*
)
centerbtnColor
{
UIView
*
view
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
frame
.
size
.
width
,
40
)];
view
.
backgroundColor
=
[
UIColor
cyanColor
];
view
.
backgroundColor
=
[
self
colorWith
:
topbgColor
];
[
self
addSubview
:
view
];
self
.
leftBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
leftBtn
.
frame
=
CGRectMake
(
0
,
0
,
90
,
40
);
self
.
leftBtn
.
font
=
[
UIFont
fontWithName
:
_pickerFontFamily
size
:[
_pickerToolBarFontSize
integerValue
]];
self
.
leftBtn
.
contentHorizontalAlignment
=
UIControlContentHorizontalAlignmentLeft
;
[
self
.
leftBtn
setTitleEdgeInsets
:
UIEdgeInsetsMake
(
0
,
10
.
0
,
0
,
0
)];
[
self
.
leftBtn
setTitle
:
self
.
leftStr
forState
:
UIControlStateNormal
];
[
self
.
leftBtn
setFont
:[
UIFont
systemFontOfSize
:[
_pickerToolBarFontSize
integerValue
]]];
self
.
leftBtn
.
contentHorizontalAlignment
=
UIControlContentHorizontalAlignmentLeft
;
[
self
.
leftBtn
addTarget
:
self
action
:
@selector
(
cancleAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
leftBtn
setTitleColor
:[
self
colorWith
:
leftbtnbgColor
]
forState
:
UIControlStateNormal
];
[
self
.
leftBtn
addTarget
:
self
action
:
@selector
(
cancleAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
view
addSubview
:
self
.
leftBtn
];
view
.
backgroundColor
=
[
self
colorWith
:
topbgColor
];
self
.
rightBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
rightBtn
.
frame
=
CGRectMake
(
view
.
frame
.
size
.
width
-
90
,
0
,
90
,
40
);
self
.
rightBtn
.
font
=
[
UIFont
fontWithName
:
_pickerFontFamily
size
:[
_pickerToolBarFontSize
integerValue
]];
self
.
rightBtn
.
contentHorizontalAlignment
=
UIControlContentHorizontalAlignmentRight
;
[
self
.
rightBtn
setTitleEdgeInsets
:
UIEdgeInsetsMake
(
0
,
0
,
0
,
10
.
0
)];
[
self
.
rightBtn
setTitle
:
self
.
rightStr
forState
:
UIControlStateNormal
];
self
.
rightBtn
.
contentHorizontalAlignment
=
UIControlContentHorizontalAlignmentRight
;
[
self
.
rightBtn
setTitleColor
:[
self
colorWith
:
rightbtnbgColor
]
forState
:
UIControlStateNormal
];
[
view
addSubview
:
self
.
rightBtn
];
[
self
.
rightBtn
setFont
:[
UIFont
systemFontOfSize
:[
_pickerToolBarFontSize
integerValue
]]];
[
self
.
rightBtn
addTarget
:
self
action
:
@selector
(
cfirmAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
view
addSubview
:
self
.
rightBtn
];
UILabel
*
cenLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
90
,
5
,
SCREEN_WIDTH
-
180
,
30
)];
cenLabel
.
textAlignment
=
NSTextAlignmentCenter
;
[
cenLabel
setFont
:[
UIFont
systemFontOfSize
:[
_pickerToolBarFontSize
integerValue
]]];
cenLabel
.
text
=
self
.
centStr
;
cenLabel
.
textAlignment
=
NSTextAlignmentCenter
;
cenLabel
.
font
=
[
UIFont
fontWithName
:
_pickerFontFamily
size
:[
_pickerToolBarFontSize
integerValue
]];
[
cenLabel
setTextColor
:[
self
colorWith
:
centerbtnColor
]];
[
view
addSubview
:
cenLabel
];
self
.
pick
=
[[
UIPickerView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
40
,
self
.
frame
.
size
.
width
,
self
.
frame
.
size
.
height
-
40
)];
...
...
@@ -529,8 +518,9 @@
NSDictionary
*
dic
=
[
self
.
dataDry
objectAtIndex
:
i
];
NSArray
*
ary
=
[
dic
allKeys
];
[
self
.
provinceArray
addObject
:[
ary
firstObject
]];
if
([
ary
firstObject
])
{
[
self
.
provinceArray
addObject
:[
ary
firstObject
]];
}
}
NSDictionary
*
dic
=
[
self
.
dataDry
firstObject
];
...
...
@@ -951,8 +941,7 @@
if
(
lbl
==
nil
)
{
lbl
=
[[
UILabel
alloc
]
init
];
//在这里设置字体相关属性
lbl
.
font
=
[
UIFont
systemFontOfSize
:[
_pickerFontSize
integerValue
]];
lbl
.
font
=
[
UIFont
fontWithName
:
_pickerFontFamily
size
:[
_pickerFontSize
integerValue
]];
lbl
.
textColor
=
[
self
colorWith
:
_pickerFontColor
];
lbl
.
textAlignment
=
UITextAlignmentCenter
;
}
...
...
ios/RCTBEEPickerManager/RCTBEEPickerManager.m
View file @
6af175d6
...
...
@@ -54,6 +54,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
NSArray
*
weightArry
=
indic
[
@"wheelFlex"
];
NSString
*
pickerToolBarFontSize
=
[
NSString
stringWithFormat
:
@"%@"
,
indic
[
@"pickerToolBarFontSize"
]];
NSString
*
pickerFontSize
=
[
NSString
stringWithFormat
:
@"%@"
,
indic
[
@"pickerFontSize"
]];
NSString
*
pickerFontFamily
=
[
NSString
stringWithFormat
:
@"%@"
,
indic
[
@"pickerFontFamily"
]];
NSArray
*
pickerFontColor
=
indic
[
@"pickerFontColor"
];
NSString
*
pickerRowHeight
=
indic
[
@"pickerRowHeight"
];
id
pickerData
=
indic
[
@"pickerData"
];
...
...
@@ -79,7 +80,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
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
pickerRowHeight
:
pickerRowHeight
];
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
pickerFontFamily
:
pickerFontFamily
];
_pick
.
bolock
=^
(
NSDictionary
*
backinfoArry
){
...
...
@@ -121,7 +122,7 @@ RCT_EXPORT_METHOD(hide){
self
.
pick
.
hidden
=
YES
;
return
;
return
;
}
RCT_EXPORT_METHOD
(
select
:
(
NSArray
*
)
data
){
...
...
package.json
View file @
6af175d6
{
"name"
:
"react-native-picker"
,
"version"
:
"4.3.
6
"
,
"version"
:
"4.3.
7
"
,
"description"
:
"A Native Picker with high performance."
,
"main"
:
"index.js"
,
"types"
:
"index.d.ts"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment