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
cf30fbc6
Commit
cf30fbc6
authored
Dec 20, 2016
by
xwenliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix when keyboard show and hide then picker disappear on ios #102
parent
3a9d4388
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
91 deletions
+86
-91
example/PickerTest/index.android.js
example/PickerTest/index.android.js
+1
-8
example/PickerTest/index.ios.js
example/PickerTest/index.ios.js
+1
-8
example/PickerTest/index.js
example/PickerTest/index.js
+80
-71
ios/RCTBEEPickerManager/RCTBEEPickerManager.m
ios/RCTBEEPickerManager/RCTBEEPickerManager.m
+3
-3
package.json
package.json
+1
-1
No files found.
example/PickerTest/index.android.js
View file @
cf30fbc6
/**
* react-native-picker example for android
*/
import
{
AppRegistry
}
from
'
react-native
'
;
import
PickerTest
from
'
./index.js
'
;
AppRegistry
.
registerComponent
(
'
PickerTest
'
,
()
=>
PickerTest
);
\ No newline at end of file
import
'
./index.js
'
;
\ No newline at end of file
example/PickerTest/index.ios.js
View file @
cf30fbc6
/**
* react-native-picker example for ios
*/
import
{
AppRegistry
}
from
'
react-native
'
;
import
PickerTest
from
'
./index.js
'
;
AppRegistry
.
registerComponent
(
'
PickerTest
'
,
()
=>
PickerTest
);
import
'
./index.js
'
;
\ No newline at end of file
example/PickerTest/index.js
View file @
cf30fbc6
...
...
@@ -4,15 +4,24 @@
import
React
,
{
Component
}
from
'
react
'
;
import
{
AppRegistry
,
View
,
Text
,
TextInput
,
TouchableOpacity
,
Dimensions
}
from
'
react-native
'
;
import
Picker
from
'
react-native-picker
'
;
import
area
from
'
./area.json
'
;
function
createDateData
(){
class
PickerTest
extends
Component
{
constructor
(
props
,
context
)
{
super
(
props
,
context
);
}
_createDateData
()
{
let
date
=
[];
for
(
let
i
=
1950
;
i
<
2050
;
i
++
){
let
month
=
[];
...
...
@@ -46,11 +55,9 @@ function createDateData(){
date
.
push
(
_date
);
}
return
date
;
};
}
function
createAreaData
(
callback
){
fetch
(
'
https://raw.githubusercontent.com/beefe/react-native-picker/master/example/PickerTest/area.json
'
).
then
(
res
=>
{
res
.
json
().
then
(
area
=>
{
_createAreaData
()
{
let
data
=
[];
let
len
=
area
.
length
;
for
(
let
i
=
0
;
i
<
len
;
i
++
){
...
...
@@ -65,22 +72,12 @@ function createAreaData(callback){
_data
[
area
[
i
][
'
name
'
]]
=
city
;
data
.
push
(
_data
);
}
callback
(
data
);
});
},
err
=>
{
console
.
log
(
err
);
});
};
export
default
class
PickerTest
extends
Component
{
constructor
(
props
,
context
)
{
super
(
props
,
context
);
return
data
;
}
_showDatePicker
()
{
Picker
.
init
({
pickerData
:
createDateData
(),
pickerData
:
this
.
_
createDateData
(),
selectedValue
:
[
'
2015年
'
,
'
12月
'
,
'
12日
'
],
onPickerConfirm
:
pickedValue
=>
{
console
.
log
(
'
date
'
,
pickedValue
);
...
...
@@ -96,9 +93,8 @@ export default class PickerTest extends Component {
}
_showAreaPicker
()
{
createAreaData
(
data
=>
{
Picker
.
init
({
pickerData
:
data
,
pickerData
:
this
.
_createAreaData
()
,
selectedValue
:
[
'
河北
'
,
'
唐山
'
,
'
古冶区
'
],
onPickerConfirm
:
pickedValue
=>
{
console
.
log
(
'
area
'
,
pickedValue
);
...
...
@@ -111,7 +107,6 @@ export default class PickerTest extends Component {
}
});
Picker
.
show
();
});
}
_toggle
()
{
...
...
@@ -139,7 +134,21 @@ export default class PickerTest extends Component {
<
TouchableOpacity
style
=
{{
marginTop
:
10
,
marginLeft
:
20
}}
onPress
=
{
this
.
_isPickerShow
.
bind
(
this
)}
>
<
Text
>
isPickerShow
<
/Text
>
<
/TouchableOpacity
>
<
TextInput
placeholder
=
"
test picker with input
"
style
=
{{
height
:
40
,
borderColor
:
'
gray
'
,
borderWidth
:
1
,
marginLeft
:
20
,
marginRight
:
20
,
marginTop
:
10
,
padding
:
5
}}
/
>
<
/View
>
);
}
};
AppRegistry
.
registerComponent
(
'
PickerTest
'
,
()
=>
PickerTest
);
ios/RCTBEEPickerManager/RCTBEEPickerManager.m
View file @
cf30fbc6
...
...
@@ -14,7 +14,7 @@
@property
(
nonatomic
,
strong
)
BzwPicker
*
pick
;
@property
(
nonatomic
,
assign
)
float
height
;
@property
(
nonatomic
,
strong
)
UIWindow
*
window
;
@property
(
nonatomic
,
weak
)
UIWindow
*
window
;
@end
...
...
@@ -56,7 +56,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
}];
if
([[
UIDevice
currentDevice
].
systemVersion
doubleValue
]
>=
9
.
0
)
{
if
([[
UIDevice
currentDevice
].
systemVersion
doubleValue
]
>=
9
.
0
)
{
self
.
height
=
250
;
}
else
{
self
.
height
=
220
;
...
...
package.json
View file @
cf30fbc6
{
"name"
:
"react-native-picker"
,
"version"
:
"4.0.1
0
"
,
"version"
:
"4.0.1
1
"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
...
...
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