TP-75372 | Abhinav | added disable click support in customClickable (#568)

This commit is contained in:
Abhinav Gupta
2024-09-20 18:07:17 +05:30
committed by GitHub
parent d218da1e6c
commit 30feb6c389
2 changed files with 3 additions and 2 deletions

View File

@@ -58,7 +58,7 @@ open class BaseProperty(
var animate: Animate? = null,
var transformOrigin: TransFormOrigin? = null,
var propertyAnimator: List<PropertyAnimator?>? = null,
val disableClick: Boolean? = false
var disableClick: Boolean? = false
) : Parcelable {
open fun copyNonNullFrom(property: BaseProperty?) {
property?.width?.let { width = it }
@@ -87,6 +87,7 @@ open class BaseProperty(
property?.animate?.let { animate = it }
property?.propertyAnimator?.let { propertyAnimator = it }
property?.transformOrigin?.let { transformOrigin = it }
property?.disableClick?.let { disableClick = it }
}
fun getPropertyId() = layoutId + PROPERTY_SUFFIX

View File

@@ -326,7 +326,7 @@ fun Modifier.customClickable(
actions: List<UiTronAction?>? = null,
property: BaseProperty? = null
): Modifier = composed {
if (!actions.isNullOrEmpty()) {
if (!actions.isNullOrEmpty() && property?.disableClick.orFalse().not()) {
if (property?.debounceTime != null && property.debounceTime.orZero() > 0) {
val coroutineScope = rememberCoroutineScope()
val clickEvents by remember { mutableStateOf(MutableSharedFlow<Unit>()) }