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 {
2525 /** 显示几行, 默认 3 */
2626 lines ?: number ;
2727 /** 指定需要显示的 key, 默认使用 data 的 label 属性 */
28- key ?: string ;
28+ rowKey ?: string ;
2929 /** 需要渲染的数据 */
3030 data ?: Array < PickerData > ;
3131 /** item 容器样式 */
@@ -53,7 +53,7 @@ export interface PickerProps {
5353const Picker = ( props : PickerProps ) => {
5454 const {
5555 lines = 3 ,
56- key = 'label' ,
56+ rowKey = 'label' ,
5757 data = new Array < PickerData > ( ) ,
5858 containerStyle = { } ,
5959 textStyle = { } ,
@@ -203,11 +203,11 @@ const Picker = (props: PickerProps) => {
203203 location ( ItemHeights ! [ index ] , index ) ;
204204 } }
205205 >
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 )
208208 ) : (
209209 < 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 >
211211 </ View >
212212 ) }
213213 </ Pressable >
You can’t perform that action at this time.
0 commit comments