Open sanginovs opened 2 years ago
there is no compose specific support in the mocking. if you have a mocked fragment that uses composables within its view I think it should work fine, but overall it only works with Fragments still
@elihart any plans/timeline to add compose specific support (embed in a single activity) in the near future?
I couldn't get it to work on my Activity which uses composable. Seems like the mocking library won't work if i don't have any fragments in my activity.
for reference, here's my setup. It's a single activity which uses Compose:
class MyActivty: MockableMavericksView {
private val viewModel: XYZViewModel by activityViewModel()
...
override fun provideMocks() = mockSingleViewModel(
viewModelReference = MyActivity::viewModel,
defaultState = MyState(...),
defaultArgs = null) { }
...
@ExperimentalComposeUiApi
@ExperimentalFoundationApi
override fun onCreate(savedInstanceState: Bundle?) {
registerMockPrinter()
setContent {
MyComposableView()
}
}
}
This is related to https://github.com/airbnb/mavericks/issues/544 - right now the MavericksView interface is required.
In the coming months we will be working on compose specific support, but not timeline to promise for now
thanks again @elihart. looking forward to it
Hi @elihart First of all, thanks a lot for open sourcing these mocking libraries. I am trying to setup mavericks-mocking and mavericks-launcher in our codebase and was wondering if mavericks-mocking support composable views?