-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
feat(transfer): add renderCustom
props
#1664
Conversation
By analyzing the blame information on this pull request, we identified @waywardmonkeys, @afc163 and @benjycui to be potential reviewers |
Maybe this will be better: // return item.content should be backward-compatible.
render(item) {
return {
label: <div className="custom-item" style={{ color: 'red' }}>{item.content} - {item.description}</div>, // for displayed item
value: item.content, // for title and filter matching
};
} |
I'm okay with either way but it's up to you, so I've updated the PR, thoughts? @afc163 |
let renderedText; | ||
let renderedEl; | ||
|
||
if (typeof renderResult === 'object') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof <div></div>
will be object
too.
Oops, missed that, a more solid check added. |
rebase 一下,回头放到 1.1 上。 |
done |
Please inform me of when you're ready to merge and I will rebase upstream one more time :P |
Sorry for being late, please rebase and I will merge this PR |
done |
👍 👍 |
对,文档要对应更新下。 |
感觉增加一个 demo 就好了 |
First of all, thanks for your contribution! :-)
Please makes sure these boxes are checked before submitting your PR, thank you!
npm run lint
and fix those errors before submitting in order to keep consistent code style.Add custom render support for
Transfer
component, for implementing features like this:When you want to render custom element in
Transfer
while still have the filter support, you can pass bothrender
andrenderCustom
props.render
will be used when rendering title or matching filtersrenderCustom
will be used for rendering thetransfer item
I believe this change is backward-compatible.