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
39c9044d
Commit
39c9044d
authored
Dec 29, 2015
by
Zuxuan Liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加点击取消按钮时的触发函数
parent
cb143329
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
index.js
index.js
+12
-3
No files found.
index.js
View file @
39c9044d
...
@@ -32,7 +32,8 @@ export default class PickerAny extends React.Component {
...
@@ -32,7 +32,8 @@ export default class PickerAny extends React.Component {
showDuration
:
PropTypes
.
number
,
showDuration
:
PropTypes
.
number
,
pickerData
:
PropTypes
.
any
.
isRequired
,
pickerData
:
PropTypes
.
any
.
isRequired
,
selectedValue
:
PropTypes
.
any
.
isRequired
,
selectedValue
:
PropTypes
.
any
.
isRequired
,
onPickerDone
:
PropTypes
.
func
onPickerDone
:
PropTypes
.
func
,
onPickerCancel
:
PropTypes
.
func
}
}
static
defaultProps
=
{
static
defaultProps
=
{
...
@@ -40,7 +41,8 @@ export default class PickerAny extends React.Component {
...
@@ -40,7 +41,8 @@ export default class PickerAny extends React.Component {
pickerCancelBtnText
:
'
取消
'
,
pickerCancelBtnText
:
'
取消
'
,
pickerHeight
:
250
,
pickerHeight
:
250
,
showDuration
:
300
,
showDuration
:
300
,
onPickerDone
:
()
=>
{}
onPickerDone
:
()
=>
{},
onPickerCancel
:
()
=>
{}
}
}
constructor
(
props
,
context
){
constructor
(
props
,
context
){
...
@@ -71,6 +73,7 @@ export default class PickerAny extends React.Component {
...
@@ -71,6 +73,7 @@ export default class PickerAny extends React.Component {
let
pickerData
=
props
.
pickerData
;
let
pickerData
=
props
.
pickerData
;
let
selectedValue
=
props
.
selectedValue
;
let
selectedValue
=
props
.
selectedValue
;
let
onPickerDone
=
props
.
onPickerDone
;
let
onPickerDone
=
props
.
onPickerDone
;
let
onPickerCancel
=
props
.
onPickerCancel
;
let
pickerStyle
=
pickerData
.
constructor
===
Array
?
'
parallel
'
:
'
cascade
'
;
let
pickerStyle
=
pickerData
.
constructor
===
Array
?
'
parallel
'
:
'
cascade
'
;
let
firstWheelData
;
let
firstWheelData
;
...
@@ -115,6 +118,7 @@ export default class PickerAny extends React.Component {
...
@@ -115,6 +118,7 @@ export default class PickerAny extends React.Component {
pickerData
,
pickerData
,
selectedValue
,
selectedValue
,
onPickerDone
,
onPickerDone
,
onPickerCancel
,
//list of first wheel data
//list of first wheel data
firstWheelData
,
firstWheelData
,
//first wheel selected value
//first wheel selected value
...
@@ -187,6 +191,11 @@ export default class PickerAny extends React.Component {
...
@@ -187,6 +191,11 @@ export default class PickerAny extends React.Component {
this
.
pickerWheel
.
moveDown
();
this
.
pickerWheel
.
moveDown
();
}
}
_pickerCancel
()
{
this
.
_toggle
();
this
.
state
.
onPickerCancel
();
}
_pickerFinish
(){
_pickerFinish
(){
this
.
_toggle
();
this
.
_toggle
();
this
.
state
.
onPickerDone
(
this
.
pickedValue
);
this
.
state
.
onPickerDone
(
this
.
pickedValue
);
...
@@ -432,7 +441,7 @@ export default class PickerAny extends React.Component {
...
@@ -432,7 +441,7 @@ export default class PickerAny extends React.Component {
<
View
style
=
{[
styles
.
pickerToolbar
,
this
.
state
.
pickerToolBarStyle
]}
>
<
View
style
=
{[
styles
.
pickerToolbar
,
this
.
state
.
pickerToolBarStyle
]}
>
<
View
style
=
{
styles
.
pickerCancelBtn
}
>
<
View
style
=
{
styles
.
pickerCancelBtn
}
>
<
Text
style
=
{[
styles
.
pickerFinishBtnText
,
this
.
state
.
pickerBtnStyle
]}
<
Text
style
=
{[
styles
.
pickerFinishBtnText
,
this
.
state
.
pickerBtnStyle
]}
onPress
=
{
()
=>
{
this
.
toggle
()}
}
>
{
this
.
state
.
pickerCancelBtnText
}
<
/Text
>
onPress
=
{
this
.
_pickerCancel
.
bind
(
this
)
}
>
{
this
.
state
.
pickerCancelBtnText
}
<
/Text
>
<
/View
>
<
/View
>
<
Text
style
=
{[
styles
.
pickerTitle
,
this
.
state
.
pickerTitleStyle
]}
numberOfLines
=
{
1
}
>
<
Text
style
=
{[
styles
.
pickerTitle
,
this
.
state
.
pickerTitleStyle
]}
numberOfLines
=
{
1
}
>
{
this
.
state
.
pickerTitle
}
{
this
.
state
.
pickerTitle
}
...
...
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