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

item not showing when item is dragging #288

Open
jae1jeong opened this issue Oct 23, 2024 · 0 comments
Open

item not showing when item is dragging #288

jae1jeong opened this issue Oct 23, 2024 · 0 comments

Comments

@jae1jeong
Copy link

jae1jeong commented Oct 23, 2024

description: dragging item is not showing. I tried to change item color but not showing when item is dragging.
I think it worked until before I changed my compose version.
reorderable version :0.9.6
related version:
composeOptions {
kotlinCompilerExtensionVersion '1.5.10'
kotlinCompilerVersion '1.9.22'
}
implementation platform('androidx.compose:compose-bom:2023.03.00')
implementation 'androidx.compose.ui:ui-tooling:1.5.0'

code: 
    val reorderState = rememberReorderableLazyListState(onMove = { from, to ->
        viewModel.onChangeSortProduct(from.index, to.index)
    }, canDragOver = { from, to -> from.index > 0 && to.index > 0 })   
   LazyColumn(
                    state = reorderState.listState,
                    modifier = Modifier
                        .reorderable(reorderState)
                        .detectReorderAfterLongPress(reorderState)

                ) {

                    items(
                        viewModel.productList,
                        key = { item -> item.productUiModel?.id ?: -1 }) { item ->
                        ReorderableItem(
                            reorderState,
                            key = item.productUiModel?.id ?: -1
                        ) { isDragging ->
                            val elevation by animateDpAsState(
                                if (isDragging) 16.dp else 0.dp,
                                label = ""
                            )
                            if (item.isHeader) {
                                ProductSettingsSection(
                                    title = stringResource(id = R.string.kcatalog_title),
                                    initialTitleKeyword = state.title,
                                    onTitleKeywordChange = {
                                        viewModel.onTitleChanged(it)
                                    },
                                    priceShowList = priceShowList,
                                    initialPriceShowItem = priceShowList.find { it.id == state.isPriceShow }
                                        ?: priceShowList.get(0),
                                    onPriceShowSelected = {
                                        viewModel.onPriceShowSelected(it.id)
                                    },
                                    expireDateList = expireDateList,
                                    initialExpireDateItem = expireDateList.find { it.id == state.selectedExpireDate }
                                        ?: expireDateList.get(0),
                                    onExpireDateSelected = {
                                        viewModel.onExpireDateSelected(it.id)
                                    }
                                )
                            } else {
                                OneRowProductItem(
                                    modifier = Modifier
                                        .fillMaxWidth()
                                        .padding(vertical = 10.dp)
                                        .shadow(elevation)
                                        .background(MaterialTheme.colorScheme.surface),
                                    image = item.productUiModel?.imageUrl ?: "",
                                    title = item.productUiModel?.name ?: "",
                                    price = item.productUiModel?._price ?: 0,
                                    onMoreClick = {
                                        item.productUiModel?.id?.let {
                                            showBottomSheet(it)
                                        }
                                    },
                                )
                            }

                        }
                    }
                }
                
Screen_recording_20241023_165635.webm
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