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

EpoxyInterop using @EpoxyModelClass #1356

Open
wildhanstrdy opened this issue Jun 5, 2023 · 0 comments
Open

EpoxyInterop using @EpoxyModelClass #1356

wildhanstrdy opened this issue Jun 5, 2023 · 0 comments

Comments

@wildhanstrdy
Copy link

wildhanstrdy commented Jun 5, 2023

Hi, I try to use EpoxyInterop using a class that is annotated with @EpoxyModelClass. For example

@EpoxyModelClass(layout = R.layout.my_epoxy_layout)
abstrac class MyEpoxyClass: EpoxyModelWithHolder<MyViewHolder>(){
......
}

My XML layout

<androidx.cardview.widget.CardView>
    <LinearLayout>
    .........
    </LinearLayout>
</androidx.cardview.widget.CardView>

Then in my composable

@Composable
fun MainView(){
EpoxyInterop<MyEpoxyClassModel_>{
...
}

}

Then it throws a run time exception like this

java.lang.ClassCastException: androidx.cardview.widget.CardView cannot be cast to com.example.homefragment.models.MyViewHolder
                                                                                                    	ata com.example.homefragment.models.MyEpoxyClass.bind(MyEpoxyClass.kt:18)
                                                                                                    	at com.example.compose.MainScreen$MyEpoxyClass$3$invoke$lambda$1$$inlined$EpoxyInterop$2.invoke(ComposeInterop.kt:105)
                                                                                                    	at com.example.compose.MainScreen$MyEpoxyClass$3$invoke$lambda$1$$inlined$EpoxyInterop$2.invoke(ComposeInterop.kt:96)

It works perfectly if I use @ModelView instead of @EpoxyModelClass. Is there any way to use the @EpoxyModelClass in EpoxyInterop<>?. Thanks

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

1 participant