aesthetic-suite / framework

🎨 Aesthetic is an end-to-end multi-platform styling framework that offers a strict design system, robust atomic CSS-in-JS engine, a structural style sheet specification (SSS), a low-runtime solution, and much more!
https://aestheticsuite.dev
MIT License
203 stars 5 forks source link

Referencing the component inside the styler wrapper #28

Closed jacksenior closed 6 years ago

jacksenior commented 6 years ago
<Comp
  ref={ref => this.name = ref}
/>

The above used to give access to the functions and methods contained on that component. Now that component is wrapped in a styled component we are ferencing the styler. I've managed to pass refs through and reference specific dom nodes but can't get the original Component.

Pretty sure its accomplishable I just can't figure it out. any solution appreciated

jacksenior commented 6 years ago

Fixed by passing an innerRef prop and running in constructor of the child component.

    this.props.innerRef(this)
milesj commented 6 years ago

Glad you got something working. That being said, I should probably support this first-class, similar to how Redux connect() does. I'll leave this open for now.

milesj commented 6 years ago

Just added a wrappedRef prop to get the underlying component instance.