Skip to content

Commit

Permalink
Merge pull request #871 from thundersdata-frontend/rn-issue
Browse files Browse the repository at this point in the history
fix: 修复picker组件多列时值互相干扰的问题
  • Loading branch information
chj-damon authored May 27, 2024
2 parents d3746cc + f559e98 commit 8239f66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-windows-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@td-design/react-native-picker': patch
---

fix: 修复picker组件多列时值互相干扰的问题
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ export default function useNormalPicker({
return () => sub.remove();
}, [visible]);

const handleChange = (val: ItemValue) => {
const handleChange = (val: ItemValue, index: number) => {
let draft = selectedValue ? [...selectedValue] : undefined;
if (!draft) {
draft = [val];
} else {
draft[index] = val;
}
if (displayType === 'view') {
onChange?.([val]);
onChange?.(draft);
}
selectValue([val]);
selectValue(draft);
};

const handleClose = () => {
Expand Down

0 comments on commit 8239f66

Please sign in to comment.