Skip to content

Commit

Permalink
fix(DatePicker2): should pass inputProps to trigger function to suppo…
Browse files Browse the repository at this point in the history
…rt custom range picker trigger
  • Loading branch information
eternalsky committed Mar 20, 2024
1 parent 881cad8 commit 2bdb937
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions components/date-picker2/__tests__/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,14 @@ describe('Picker', () => {
wrapper = mount(<DatePicker state="loading" />);
assert(wrapper.find('.next-icon-loading').length === 1);
});

// fix https://github.com/alibaba-fusion/next/issues/4767
it('should pass inputProps to trigger', () => {
mount(<DatePicker trigger={(inputProps) => {
assert(typeof inputProps.onInputTypeChange === 'function');
return <div>test</div>
}} />);
})
});
});

Expand Down
2 changes: 1 addition & 1 deletion components/date-picker2/picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class Picker extends React.Component {
inputProps.hasClear = false;
}

const triggerNode = renderNode(trigger, <DateInput {...inputProps} />);
const triggerNode = renderNode(trigger, <DateInput {...inputProps} />, inputProps);

// 日期
const panelProps = {
Expand Down

0 comments on commit 2bdb937

Please sign in to comment.