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

Problem passing children and modifying them #115

Closed
boazrymland opened this issue May 11, 2019 · 1 comment
Closed

Problem passing children and modifying them #115

boazrymland opened this issue May 11, 2019 · 1 comment
Labels

Comments

@boazrymland
Copy link

We have a React based library, which contains a 'button group toggle' component - a wrapper to a group of Button(s) components (handled to it as children), which modifies them lightly (after checking that they are of the right type) to add a click event handler and attaching an 'active' prop based on the wrapper state.

In React, the code works fine.

However, in Angular using angular-react, it doesn't work as expected: first, the children of the wrapper component are not the buttons themselves but rather the ReactContent element. Next, the even if taking the ReactContent children (this.props.children[0].props['children-to-append']) they are the buttons but their type is not the same type as seen by the code in when we use the library in React directly: the angular type instead of the React type. This causes React to shout when we attempt to modify the children (as mentioned above).

This is how we render the children in the wrapper component:

<ButtonGroupToggle
      #reactNode
      [fill]="fill"
      [minimal]="minimal"
      [large]="large"
      [vertical]="vertical"
      [defaultActive]="defaultActive"
      (onActiveChange)="handleActiveChange($event)">
      <ReactContent>
        <ng-content></ng-content>
      </ReactContent>
</ButtonGroupToggle>

I suspect this is a usage issue more than a bug... .
Any help will be appreciated. TIA!

@stale
Copy link

stale bot commented Jul 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 10, 2019
@stale stale bot closed this as completed Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant