Questions tagged [composable]
160 questions
4
votes
1 answer
Disable swipe gesture in child component in Android Jetpack Compose
As mentioned by the title, I want to disable the swipe gestures ExposedDropdownMenuBox in a Composable.
The reason is sometimes, the swipe triggers both Drawer's swipe to open and the ExposedDropdownMenuBox. Specifically, when you swipe on the…

T D Nguyen
- 7,054
- 4
- 51
- 71
4
votes
1 answer
Composable to bitmap without displaying it
When using classic Views it is easy to obtain a bitmap from a view without displaying it. I create the view class through a LayoutInflater, and then, since it hasn't been attached to a view, I measure it first.
I have the following extension…

Massimo
- 3,436
- 4
- 40
- 68
4
votes
2 answers
Get data from network or database on entry/load of a Jetpack Compose based screen in Android
I am new to Jetpack Compose and Kotlin, but I am trying to develop a mobile app using recently stable Jetpack Compose v1.0.0.0
I am using the NavController for navigation and my screens are made using composable functions.
Because my screen itself…

Pawan Pillai
- 1,955
- 5
- 37
- 64
3
votes
2 answers
On vue 3 v-if not working for ref value returned from composable
I created a composable with a reactive boolean. For some reason, the reactive boolean only works with .value in the template v-if. It doesn't automatically unwraps it inside the template.
But if I use a boolean ref directly on the vue component, it…

Artur Carvalho
- 6,901
- 10
- 76
- 105
3
votes
2 answers
Setting background image to compose Column
I want to set background of a column as image instead of color.
We set the background color as this
Column(modifier = Modifier.background(Colors.Blue) )
so instead of this, I want to use an image to set as background.
I tried setting it using…

Sudarshan Bhatt
- 105
- 1
- 6
3
votes
2 answers
Vue3 composable with render
Is it possible to create a composable function that would use render function so it can display something?
Example:
import { h } from 'vue'
export function useErrorHandling() {
return {
render() {
return h('div', { class: 'bar',…

BT101
- 3,666
- 10
- 41
- 90
3
votes
2 answers
How to use a custom composable as parameter type in another custom composable?
Is there a way to use a custom composable as a parameter type in another custom composable? Trying this only throws an unresolved reference compiler error. However, using build-in composables provided by Jetpack Compose as parameters like an…

Raj Narayanan
- 2,443
- 4
- 24
- 43
3
votes
2 answers
How to assert next started activity for a composable test?
I have a composable with a button that launches one of the native activities (Google Settings).
To test this before compose (using Robolectric) I would do something like this:
My test:
@Test
fun `MyFragment - when button clicked - starts activity`()…

Alix
- 2,630
- 30
- 72
3
votes
1 answer
How to mock vue composable functions with jest
I'm using vue2 with composition Api, vuex and apollo client to request a graphql API and I have problems when mocking composable functions with jest
// store-service.ts
export function apolloQueryService(): {
// do some graphql stuff
return…

Haifeng
- 31
- 1
- 2
3
votes
1 answer
How to manually import extension functions when using Jetpack Compose 1.0.0-alpha11?
I have a List- that I want to be displayed using Jetpack Compose. In version "1.0.0-alpha10", this code:
@Composable
fun ItemsScreen(items: List
- ) {
item?.let {
LazyColumn {
items(
items = items
…

Joan P.
- 2,368
- 6
- 30
- 63
3
votes
2 answers
Is there any way I can see samples from libraries' source code?
There is that @sample thing in docstrings from source code, like @sample androidx.compose.foundation.samples.PlaceholderBasicTextFieldSample. I was wondering how can I — if there is a way — see them, see this PlaceholderBasicTextFieldSample. Was…

Alexander
- 75
- 2
- 7
2
votes
1 answer
Why does reactivity break for only one variable in this CodeSandbox example?
Can somebody explain to me why reactivity breaks for number in this example:
https://codesandbox.io/s/vue-3-reactivity-issue-4rto59?file=/public/index.html
I have 2 composables (useNumber.js and useRandomNumber.js) which I both spread in the return…

Tom De Smet
- 123
- 4
2
votes
2 answers
Android JetPack Compose - Understanding @Composable scopes
I'm kinda pulling my hair out about this for a while now, I simply can't grasp the concept no matter how many tutorials i watch and code snippets I read..
I simply want to put a marker image on top of another image where i tap it.
class MainActivity…

Felix
- 101
- 6
2
votes
1 answer
How to import AndroidViewBinding in jetpack compose
I'm trying to use some fragments within jetpack compose but I can not import AndroidViewBinding from (androidx.compose.ui.viewinterop) and it is always appearing as an unresolved name
how to import it ??

Karrar
- 1,273
- 3
- 14
- 30
2
votes
1 answer
Can a VUE 3 composable contain more than a single exported function?
I am trying to re-write some functions as VUE Composables and it looks to me like only one exported function is available for a single 'composable.ts' file.
Is that true, or is there a way to export multiple functions from a single composable?

Norm Strassner
- 225
- 3
- 11