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
cb143329
Commit
cb143329
authored
Dec 29, 2015
by
Zuxuan Liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加取消按钮和pickerTitle属性
parent
b60ed592
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
index.js
index.js
+30
-2
No files found.
index.js
View file @
cb143329
...
@@ -22,7 +22,10 @@ export default class PickerAny extends React.Component {
...
@@ -22,7 +22,10 @@ export default class PickerAny extends React.Component {
static
propTypes
=
{
static
propTypes
=
{
pickerBtnText
:
PropTypes
.
string
,
pickerBtnText
:
PropTypes
.
string
,
pickerCancelBtnText
:
PropTypes
.
string
,
pickerBtnStyle
:
PropTypes
.
any
,
pickerBtnStyle
:
PropTypes
.
any
,
pickerTitle
:
PropTypes
.
string
,
pickerTitleStyle
:
PropTypes
.
any
,
pickerToolBarStyle
:
PropTypes
.
any
,
pickerToolBarStyle
:
PropTypes
.
any
,
pickerItemStyle
:
PropTypes
.
any
,
pickerItemStyle
:
PropTypes
.
any
,
pickerHeight
:
PropTypes
.
number
,
pickerHeight
:
PropTypes
.
number
,
...
@@ -34,6 +37,7 @@ export default class PickerAny extends React.Component {
...
@@ -34,6 +37,7 @@ export default class PickerAny extends React.Component {
static
defaultProps
=
{
static
defaultProps
=
{
pickerBtnText
:
'
完成
'
,
pickerBtnText
:
'
完成
'
,
pickerCancelBtnText
:
'
取消
'
,
pickerHeight
:
250
,
pickerHeight
:
250
,
showDuration
:
300
,
showDuration
:
300
,
onPickerDone
:
()
=>
{}
onPickerDone
:
()
=>
{}
...
@@ -56,7 +60,10 @@ export default class PickerAny extends React.Component {
...
@@ -56,7 +60,10 @@ export default class PickerAny extends React.Component {
//the pickedValue must looks like [wheelone's, wheeltwo's, ...]
//the pickedValue must looks like [wheelone's, wheeltwo's, ...]
//this.state.selectedValue may be the result of the first pickerWheel
//this.state.selectedValue may be the result of the first pickerWheel
let
pickerBtnText
=
props
.
pickerBtnText
;
let
pickerBtnText
=
props
.
pickerBtnText
;
let
pickerCancelBtnText
=
props
.
pickerCancelBtnText
;
let
pickerBtnStyle
=
props
.
pickerBtnStyle
;
let
pickerBtnStyle
=
props
.
pickerBtnStyle
;
let
pickerTitle
=
props
.
pickerTitle
;
let
pickerTitleStyle
=
props
.
pickerTitleStyle
;
let
pickerToolBarStyle
=
props
.
pickerToolBarStyle
;
let
pickerToolBarStyle
=
props
.
pickerToolBarStyle
;
let
pickerItemStyle
=
props
.
pickerItemStyle
;
let
pickerItemStyle
=
props
.
pickerItemStyle
;
let
pickerHeight
=
props
.
pickerHeight
;
let
pickerHeight
=
props
.
pickerHeight
;
...
@@ -97,7 +104,10 @@ export default class PickerAny extends React.Component {
...
@@ -97,7 +104,10 @@ export default class PickerAny extends React.Component {
this
.
pickerStyle
=
pickerStyle
;
this
.
pickerStyle
=
pickerStyle
;
return
{
return
{
pickerBtnText
,
pickerBtnText
,
pickerCancelBtnText
,
pickerBtnStyle
,
pickerBtnStyle
,
pickerTitle
,
pickerTitleStyle
,
pickerToolBarStyle
,
pickerToolBarStyle
,
pickerItemStyle
,
pickerItemStyle
,
pickerHeight
,
pickerHeight
,
...
@@ -413,14 +423,20 @@ export default class PickerAny extends React.Component {
...
@@ -413,14 +423,20 @@ export default class PickerAny extends React.Component {
<Text style={styles.pickerMoveBtn} onPress={this._nextPressHandle.bind(this)}>下一个</Text>
<Text style={styles.pickerMoveBtn} onPress={this._nextPressHandle.bind(this)}>下一个</Text>
</View>
</View>
);*/
);*/
let
pickerBtn
=
null
;
//
let pickerBtn = null;
return
(
return
(
<
Animated
.
View
style
=
{[
styles
.
picker
,
{
<
Animated
.
View
style
=
{[
styles
.
picker
,
{
height
:
this
.
state
.
pickerHeight
,
height
:
this
.
state
.
pickerHeight
,
bottom
:
this
.
state
.
slideAnim
bottom
:
this
.
state
.
slideAnim
}]}
>
}]}
>
<
View
style
=
{[
styles
.
pickerToolbar
,
this
.
state
.
pickerToolBarStyle
]}
>
<
View
style
=
{[
styles
.
pickerToolbar
,
this
.
state
.
pickerToolBarStyle
]}
>
{
pickerBtn
}
<
View
style
=
{
styles
.
pickerCancelBtn
}
>
<
Text
style
=
{[
styles
.
pickerFinishBtnText
,
this
.
state
.
pickerBtnStyle
]}
onPress
=
{()
=>
{
this
.
toggle
()}}
>
{
this
.
state
.
pickerCancelBtnText
}
<
/Text
>
<
/View
>
<
Text
style
=
{[
styles
.
pickerTitle
,
this
.
state
.
pickerTitleStyle
]}
numberOfLines
=
{
1
}
>
{
this
.
state
.
pickerTitle
}
<
/Text
>
<
View
style
=
{
styles
.
pickerFinishBtn
}
>
<
View
style
=
{
styles
.
pickerFinishBtn
}
>
<
Text
style
=
{[
styles
.
pickerFinishBtnText
,
this
.
state
.
pickerBtnStyle
]}
<
Text
style
=
{[
styles
.
pickerFinishBtnText
,
this
.
state
.
pickerBtnStyle
]}
onPress
=
{
this
.
_pickerFinish
.
bind
(
this
)}
>
{
this
.
state
.
pickerBtnText
}
<
/Text
>
onPress
=
{
this
.
_pickerFinish
.
bind
(
this
)}
>
{
this
.
state
.
pickerBtnText
}
<
/Text
>
...
@@ -470,6 +486,18 @@ let styles = StyleSheet.create({
...
@@ -470,6 +486,18 @@ let styles = StyleSheet.create({
fontSize
:
16
,
fontSize
:
16
,
marginLeft
:
20
marginLeft
:
20
},
},
pickerCancelBtn
:
{
flex
:
1
,
flexDirection
:
'
row
'
,
justifyContent
:
'
flex-start
'
,
alignItems
:
'
center
'
,
marginLeft
:
20
},
pickerTitle
:
{
flex
:
5
,
color
:
'
black
'
,
textAlign
:
'
center
'
},
pickerFinishBtn
:
{
pickerFinishBtn
:
{
flex
:
1
,
flex
:
1
,
flexDirection
:
'
row
'
,
flexDirection
:
'
row
'
,
...
...
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