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
bf32d5de
Commit
bf32d5de
authored
Dec 14, 2015
by
xwenliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
picker
parent
d27e9e0c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
0 deletions
+111
-0
index.js
index.js
+111
-0
No files found.
index.js
View file @
bf32d5de
'
use strict
'
;
import
React
,
{
StyleSheet
,
PropTypes
,
View
,
Text
,
Animated
,
Platform
,
Dimensions
}
from
'
react-native
'
;
import
PickerAndroid
from
'
react-native-picker-android
'
;
let
Picker
=
Platform
.
OS
===
'
ios
'
?
PickerIOS
:
PickerAndroid
;
let
PickerItem
=
Picker
.
Item
;
let
width
=
Dimensions
.
get
(
'
window
'
).
width
;
let
height
=
Dimensions
.
get
(
'
window
'
).
height
;
export
default
class
PickerAny
extends
React
.
Component
{
constructor
(
props
,
context
){
super
(
props
,
context
);
this
.
state
=
{
};
};
_prePressHandle
(
callback
){
this
.
picker
.
moveUp
();
};
_nextPressHandle
(
callback
){
this
.
picker
.
moveDown
();
};
render
(){
<
Animated
.
View
style
=
{[
styles
.
picker
,
{
bottom
:
this
.
state
.
slideAnim
}]}
>
<
View
style
=
{
styles
.
pickerToolbar
}
>
<
View
style
=
{
styles
.
pickerBtnView
}
>
<
Text
style
=
{
styles
.
pickerMoveBtn
}
onPress
=
{
this
.
_prePressHandle
}
>
上一个
<
/Text
>
<
Text
style
=
{
styles
.
pickerMoveBtn
}
onPress
=
{
this
.
_nextPressHandle
}
>
下一个
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
pickerFinishBtn
}
>
<
Text
style
=
{
styles
.
pickerFinishBtnText
}
onPress
=
{()
=>
{
this
.
setState
({
course
:
this
.
state
.
courseData
[
this
.
index
||
0
]})
this
.
_pickerToggle
();
}}
>
完成
<
/Text
>
<
/View
>
<
/View
>
<
Picker
ref
=
{(
picker
)
=>
{
this
.
picker
=
picker
}}
selectedValue
=
{
this
.
props
.
selectedValue
}
onValueChange
=
{(
index
)
=>
this
.
index
=
index
}
>
{
this
.
props
.
pickerData
.
map
((
value
,
index
)
=>
(
<
PickerAndroid
.
Item
key
=
{
index
}
value
=
{
value
}
label
=
{
value
}
/>
)
)}
<
/Picker
>
<
/Animated.View
>
};
};
let
styles
=
StyleSheet
.
create
({
picker
:
{
flex
:
1
,
position
:
'
absolute
'
,
bottom
:
0
,
left
:
0
,
backgroundColor
:
'
rgb(189, 192, 199)
'
,
width
:
width
,
height
:
height
/
3
,
overflow
:
'
hidden
'
,
},
pickerToolbar
:
{
height
:
30
,
width
:
width
,
backgroundColor
:
'
#e6e6e6
'
,
flexDirection
:
'
row
'
,
borderTopWidth
:
1
,
borderBottomWidth
:
1
,
borderColor
:
'
#c3c3c3
'
},
pickerBtnView
:
{
flex
:
1
,
flexDirection
:
'
row
'
,
justifyContent
:
'
flex-start
'
,
alignItems
:
'
center
'
,
paddingLeft
:
20
},
pickerMoveBtn
:
{
paddingLeft
:
20
,
color
:
'
#149be0
'
,
fontSize
:
16
,
},
pickerFinishBtn
:
{
flex
:
1
,
flexDirection
:
'
row
'
,
justifyContent
:
'
flex-end
'
,
alignItems
:
'
center
'
,
paddingRight
:
20
,
},
pickerFinishBtnText
:
{
fontSize
:
16
,
color
:
'
#149be0
'
}
});
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