subroh0508 / kotlin-material-ui

[UNMAINTAINED] Kotlin Wrapper Library of Material-UI
MIT License
74 stars 24 forks source link

[add]Add withStyles function that returns a RClass #12

Closed oxc closed 4 years ago

oxc commented 4 years ago

Creating a new RClass in each invocation can prevent reconciliation of such components. Extract a separate method that returns the styled class, so it can be stored for recurring usage.

oxc commented 4 years ago

I've extracted another function that takes an RClass<P> and returns a RClass<P>. The withStyles type definition calls this TypeInjector.

I had to use klazz.rClass instead of klazz.js, requiring the type parameter to be RComponent instead of Component. In theory this is a breaking change, but should not have any effects in practice. Given the 0.x.x status of the library, I find this change acceptable.

Please let me know if this is ok, or if you want to go back to the previous version.

subroh0508 commented 4 years ago

Please let me know if this is ok, or if you want to go back to the previous version.

@oxc This is OK, no problem at all. Thanks for the awesome Pull Request!