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

DefaultHandle should allow children #274

Open
timkelty opened this issue Jan 20, 2020 · 2 comments
Open

DefaultHandle should allow children #274

timkelty opened this issue Jan 20, 2020 · 2 comments

Comments

@timkelty
Copy link

timkelty commented Jan 20, 2020

I wanted to display the handle value, positioned below the handle.

The easiest way to do this seemed to be pass my own handle that rendered children with the label. eg:

const Handle = ({buttonOffset = 0, ...handleProps}) => {
  const value = handleProps['aria-valuenow'];

  return (
    <DefaultHandle {...handleProps}>
      <span
        style={{
          position: 'absolute',
          top: 30,
          left: 0,
          right: 0,
        }}
       >
        {value}
      </span>
    </DefaultHandle>
  );
};

Works great, except I get a propType warning, because DefaultHandle is expecting exact props:

Warning: Failed prop type: DefaultHandle: unknown props found: children

Seems like children could safely be added to it's allowed props?

@ljharb
Copy link
Collaborator

ljharb commented Jan 20, 2020

What if you wrap the DefaultHandle with a div instead?

@timkelty
Copy link
Author

@ljharb definitely could, but I was trying to piggyback off the already positioned DefaultHandle, as I want to display the label right below the handles.

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

No branches or pull requests

2 participants