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
2c9531fd
Commit
2c9531fd
authored
Sep 20, 2016
by
xwenliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event bug
parent
15671885
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
109 deletions
+66
-109
README.md
README.md
+57
-94
example/PickerTest/index.js
example/PickerTest/index.js
+6
-9
index.js
index.js
+3
-6
No files found.
README.md
View file @
2c9531fd
...
...
@@ -20,11 +20,11 @@ A Native Picker with high performance
-
<b>
pickerConfirmBtnText
</b>
string, 确认按钮文字
-
<b>
pickerCancelBtnText
</b>
string, 取消按钮文字
-
<b>
pickerTitleText
</b>
string, 标题文字
-
<b>
pickerConfirmBtnColor
</b>
[
'255', '66', '00', 0.5
], 确认按钮字体颜色
-
<b>
pickerCancelBtnColor
</b>
[
'255', '66', '00', 0.5
], 取消按钮字体颜色
-
<b>
pickerTitleColor
</b>
[
'255', '66', '00', 0.5
], 标题字体颜色
-
<b>
pickerToolBarBg
</b>
[
'255', '66', '00', 0.5
], 工具栏背景颜色
-
<b>
pickerBg
</b>
[
'255', '66', '00', 0.5
], picker背景颜色
-
<b>
pickerConfirmBtnColor
</b>
[
1, 186, 245, 1
], 确认按钮字体颜色
-
<b>
pickerCancelBtnColor
</b>
[
1, 186, 245, 1
], 取消按钮字体颜色
-
<b>
pickerTitleColor
</b>
[
20, 20, 20, 1
], 标题字体颜色
-
<b>
pickerToolBarBg
</b>
[
232, 232, 232, 1
], 工具栏背景颜色
-
<b>
pickerBg
</b>
[
196, 199, 206, 1
], picker背景颜色
-
<b>
pickerData
</b>
数组或对象,picker数据
-
<b>
selectedValue
</b>
string,默认选中数据
-
<b>
onPickerConfirm
</b>
function,确认按钮回调
...
...
@@ -113,12 +113,10 @@ A Native Picker with high performance
```
javascript
pickerData
=
[
{
value
:
'
a
'
,
child
:
[
1
,
2
,
3
,
4
]
a
:
[
1
,
2
,
3
,
4
]
},
{
value
:
'
b
'
,
child
:
[
5
,
6
,
7
,
8
]
b
:
[
5
,
6
,
7
,
8
]
},
...
];
...
...
@@ -130,79 +128,44 @@ A Native Picker with high performance
```
javascript
pickerData
=
[
{
value
:
'
a
'
,
child
:
[
a
:
[
{
value
:
'
a1
'
,
child
:
[
1
,
2
,
3
,
4
]
a1
:
[
1
,
2
,
3
,
4
]
},
{
value
:
'
a2
'
,
child
:
[
5
,
6
,
7
,
8
]
a2
:
[
5
,
6
,
7
,
8
]
},
{
value
:
'
a3
'
,
child
:
[
9
,
10
,
11
,
12
]
a3
:
[
9
,
10
,
11
,
12
]
}
]
},
{
value
:
'
b
'
,
child
:
[
b
:
[
{
value
:
'
b1
'
,
child
:
[
11
,
22
,
33
,
44
]
b1
:
[
11
,
22
,
33
,
44
]
},
{
value
:
'
b2
'
,
child
:
[
55
,
66
,
77
,
88
]
b2
:
[
55
,
66
,
77
,
88
]
},
{
value
:
'
b3
'
,
child
:
[
99
,
1010
,
1111
,
1212
]
b3
:
[
99
,
1010
,
1111
,
1212
]
}
]
},
{
value
:
'
c
'
,
child
:
[
c
:
[
{
value
:
'
c1
'
,
child
:
[
'
a
'
,
'
b
'
,
'
c
'
]
c1
:
[
'
a
'
,
'
b
'
,
'
c
'
]
},
{
value
:
'
c2
'
,
child
:
[
'
aa
'
,
'
bb
'
,
'
cc
'
]
c2
:
[
'
aa
'
,
'
bb
'
,
'
cc
'
]
},
{
value
:
'
c3
'
,
child
:
[
'
aaa
'
,
'
bbb
'
,
'
ccc
'
]
c3
:
[
'
aaa
'
,
'
bbb
'
,
'
ccc
'
]
}
]
}
]
//以前两轮
{
a
:
[
1
,
2
,
3
,
4
],
b
:
[
5
,
6
,
7
,
8
],
...
}
//以前三轮
{
a
:
{
a1
:
[
1
,
2
,
3
,
4
],
a2
:
[
5
,
6
,
7
,
8
],
a3
:
[
9
,
10
,
11
,
12
]
},
b
:
{
b1
:
[
1
,
2
,
3
,
4
],
b2
:
[
5
,
6
,
7
,
8
],
b3
:
[
9
,
10
,
12
,
12
]
}
...
};
selectedValue
=
[
'
a
'
,
'
a1
'
,
1
];
]
```
\ No newline at end of file
example/PickerTest/index.js
View file @
2c9531fd
...
...
@@ -75,16 +75,13 @@ export default class PickerTest extends Component {
pickerData
:
createDateData
(),
selectedValue
:
[
'
2015年
'
,
'
12月
'
,
'
12日
'
],
onPickerConfirm
:
pickedValue
=>
{
alert
(
JSON
.
stringify
(
pickedValue
));
console
.
log
(
pickedValue
);
console
.
log
(
'
date
'
,
pickedValue
);
},
onPickerCancel
:
pickedValue
=>
{
alert
(
JSON
.
stringify
(
pickedValue
));
console
.
log
(
pickedValue
);
console
.
log
(
'
date
'
,
pickedValue
);
},
onPickerSelect
:
pickedValue
=>
{
alert
(
JSON
.
stringify
(
pickedValue
));
console
.
log
(
pickedValue
);
console
.
log
(
'
date
'
,
pickedValue
);
}
});
Picker
.
show
();
...
...
@@ -96,13 +93,13 @@ export default class PickerTest extends Component {
pickerData
:
data
,
selectedValue
:
[
'
北京
'
,
'
北京
'
,
'
朝阳区
'
],
onPickerConfirm
:
pickedValue
=>
{
console
.
log
(
pickedValue
);
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerCancel
:
pickedValue
=>
{
console
.
log
(
pickedValue
);
console
.
log
(
'
area
'
,
pickedValue
);
},
onPickerSelect
:
pickedValue
=>
{
console
.
log
(
pickedValue
);
console
.
log
(
'
area
'
,
pickedValue
);
}
});
Picker
.
show
();
...
...
index.js
View file @
2c9531fd
...
...
@@ -33,12 +33,9 @@ export default {
};
Picker
.
_init
(
opt
);
if
(
this
.
inited
){
return
;
}
this
.
inited
=
true
;
NativeAppEventEmitter
.
addListener
(
'
pickerEvent
'
,
event
=>
{
//there are no `removeListener` for NativeAppEventEmitter & DeviceEventEmitter
this
.
listener
&&
this
.
listener
.
remove
();
this
.
listener
=
NativeAppEventEmitter
.
addListener
(
'
pickerEvent
'
,
event
=>
{
if
(
ios
){
fnConf
[
event
[
'
type
'
]](
event
[
'
selectedValue
'
]);
}
...
...
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