-
Notifications
You must be signed in to change notification settings - Fork 716
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
Render props #220
Comments
thanks @techniq! |
We could possibly remove const top = ...;
const left = ...;
<BoundingRects>
{({ rect, parentRect }) => (
<Tooltip
style={{
top: rect && parentRect && rect.right > parentRect.right ? (left - rect.width) : left,
left: rect && parentRect && rect.bottom > parentRect.bottom ? (top - rect.height) : top,
...rest
}}>
)}
</BoundingRects> though this still requires the user to do the right rect comparison, which isn't hard but is basically boilerplate. |
@williaster could const top = ...;
const left = ...;
<BoundingRects>
{({ rect, parentRect, getTop, getLeft }) => (
<Tooltip
style={{
top: getTop(left),
left: getLeft(top),
...rest
}}>
)}
</BoundingRects> |
Would be useful if all our shapes supported render props as well, similar to how area now does. This will be useful to better support react-spring (to allow using |
Creating a list of existing HOC components we should updated to have least have a render prop equivalent (feel free to add to the list)
<ScreenSize>
<BoundingRects>
<Tooltip>
The text was updated successfully, but these errors were encountered: