File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export interface PickerProps {
25
25
/** 显示几行, 默认 3 */
26
26
lines ?: number ;
27
27
/** 指定需要显示的 key, 默认使用 data 的 label 属性 */
28
- key ?: string ;
28
+ rowKey ?: string ;
29
29
/** 需要渲染的数据 */
30
30
data ?: Array < PickerData > ;
31
31
/** item 容器样式 */
@@ -53,7 +53,7 @@ export interface PickerProps {
53
53
const Picker = ( props : PickerProps ) => {
54
54
const {
55
55
lines = 3 ,
56
- key = 'label' ,
56
+ rowKey = 'label' ,
57
57
data = new Array < PickerData > ( ) ,
58
58
containerStyle = { } ,
59
59
textStyle = { } ,
@@ -203,11 +203,11 @@ const Picker = (props: PickerProps) => {
203
203
location ( ItemHeights ! [ index ] , index ) ;
204
204
} }
205
205
>
206
- { React . isValidElement ( item . render ?.( item [ key ] , item , index ) ) ? (
207
- item . render ?.( item [ key ] , item , index )
206
+ { React . isValidElement ( item . render ?.( item [ rowKey ] , item , index ) ) ? (
207
+ item . render ?.( item [ rowKey ] , item , index )
208
208
) : (
209
209
< View style = { style . containerUn } >
210
- < Text style = { current === index ? style . textAc : style . textUn } > { item [ key ] } </ Text >
210
+ < Text style = { current === index ? style . textAc : style . textUn } > { item [ rowKey ] } </ Text >
211
211
</ View >
212
212
) }
213
213
</ Pressable >
You can’t perform that action at this time.
0 commit comments