Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picker组件选项选择的问题 #3518

Closed
1 task
river-hu opened this issue Jan 14, 2020 · 2 comments · May be fixed by react-component/m-picker#261
Closed
1 task

picker组件选项选择的问题 #3518

river-hu opened this issue Jan 14, 2020 · 2 comments · May be fixed by react-component/m-picker#261

Comments

@river-hu
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://github.com/supper1/antd-m.git

Steps to reproduce

import React ,{useState} from 'react';
import { Picker, List } from 'antd-mobile';
import 'antd-mobile/dist/antd-mobile.css';
const seasons = [
[
{
label: '2013',
value: '2013',
},
{
label: '2014',
value: '20141',
},
{
label: '2014',
value: '20142',
},
{
label: '2014',
value: '20143',
},
{
label: '2014',
value: '20144',
},
{
label: '2014',
value: '20145',
},
{
label: '2014',
value: '20146',
},
],
[
{
label: '春',
value: '春',
},
{
label: '夏',
value: '夏',
},
],
];
function App() {
const [value,setValue] = useState('')
const [value2,setValue2] = useState(0)
setInterval(()=>{ // 存在持续渲染数据的时候picker组件会有回弹
setValue2(value2 1)
},500)
return (


<Picker
data={seasons}
title="选择季节"
cascade={false}
extra="请选择(可选)"
value={value}
onChange={v => setValue(v )}
onOk={v => setValue( v )}
>
<List.Item arrow="horizontal">Multiple</List.Item>


);
}

export default App;

What is expected?

在组件重新渲染时,不影响组件的选择

What is actually happening?

页面重新渲染会导致选项回弹无法正常使用

Environment Info
antd 2.3.0
React react
System win10
Browser Chrome 79.0.3945.117
@lwbweb
Copy link

lwbweb commented Jan 2, 2021

一样的问题,触发条件:hooks组件、setInterval(比如页面有倒计时功能)、加入picker,在打开picker之前,先触发setInterval,再打开picker、选择就有问题了

@awmleer
Copy link
Member

awmleer commented Sep 23, 2021

v2 已经停止维护了,建议升级到 v5 吧

@awmleer awmleer closed this as completed Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants