Propagate styles in composable asset #835
Conversation
| androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" } | ||
| androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" } | ||
| androidx-test-espresso = { module = "androidx.test.espresso:espresso-intents", version = "3.3.0" } | ||
| androidx-test-espresso = { module = "androidx.test.espresso:espresso-intents", version = "3.6.1" } |
There was a problem hiding this comment.
Upgrade espresso as we were getting a java reflection issue with using composeTestRule in our tests
| artifact("androidx.compose.ui:ui-test-junit4"), | ||
| artifact("androidx.compose.ui:ui-test-manifest"), |
There was a problem hiding this comment.
Needed for compose tests
|
@justin-medeiros you may want to figure out signed commits before you add any more |
| artifact("androidx.test.espresso:espresso-intents"), | ||
| artifact("androidx.test.ext:junit-ktx"), | ||
| artifact("androidx.compose.ui:ui-test-junit4"), | ||
| artifact("com.google.guava:guava"), |
There was a problem hiding this comment.
Had to add this dependency as we were getting this error when upgrading espresso: Didn't find class "com.google.common.util.concurrent.ListenableFuture"
| ) { | ||
| val assetTag = tag ?: asset.id | ||
| val containerModifier = Modifier.testTag(assetTag) then modifier | ||
| assetContext.withContext(LocalContext.current).withTag(assetTag).build().run { |
There was a problem hiding this comment.
would it be possible to pass style in here to the assetContext and drop the style arg in composeAndroidView entirely?
There was a problem hiding this comment.
Made a change to try it. Can I get a canary to test?
There was a problem hiding this comment.
i don't think this is sufficient, what about nested composables inside AndroidViews, they lose the textstyle, right?
5ec8126 to
4e6010c
Compare
|
/canary |
c5f5c02 to
ff9f919
Compare
Summary
styles were lost — only textStyle was propagated via LocalTextStyle. This means a
Compose → Compose → XML view chain would not apply ContextThemeWrapper to the leaf
XML view.
of
RenderableAsset.compose(), so intermediate Compose layers carry the styledcontext through to any eventual composeAndroidView call.
This PR also:
flow, Compose→Compose nesting, LocalTextStyle propagation, and 3-level
Compose→Compose→XML style propagation with ContextThemeWrapper assertion.
with createComposeRule().
Change Type (required)
Indicate the type of change your pull request is:
patchminormajorN/ADoes your PR have any documentation updates?