andylamax
12/20/2020, 3:53 AMRComponent and you override methods with arguments that are called from react directly (i.e. componentDidUpdate(prevProps,prevState,snapshot) or componentWillReceiveProps(nextProps) ), generated javascript code always throws a ClassCastException.
Lets take a look at componentWillReceiveProps(next) . The IR Compiler generates javascript code similar to this
PaginatedGridComp.prototype.componentWillReceiveProps = function (nextProps) {
return this.componentWillReceiveProps_17(nextProps instanceof Props_19 ? nextProps : THROW_CCE());
};
Since react creates nextProps internally, the check nextProps instanceof Props_19 always fails. Hence it throws CCE
Is there a work around to this problem?
IR Compiler BackendMarc Knaup
12/20/2020, 3:29 PMProps must be external.andylamax
12/20/2020, 5:03 PM@JsExport didn't solve the issue at all.
However, my use case need a class for my PropsMarc Knaup
12/20/2020, 5:05 PMkotlin-react. You’ll have to wrap your class props in another RProps interface that’s external.
My library does that automatically and thus supports regular classes als Props. But it intentionally only supports functional components: https://github.com/fluidsonic/fluid-react