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

IOS Material3 ripple increases button size on click #4924

Closed
alaegin opened this issue Jun 4, 2024 · 3 comments · Fixed by JetBrains/compose-multiplatform-core#1385
Closed
Assignees
Labels

Comments

@alaegin
Copy link

alaegin commented Jun 4, 2024

Describe the bug
Hello!

I use ModalBottomSheet from Material3 with Material3 Button inside. When I click on the edge of the button it changes it's size for several frames causing the whole container to resize, then it returns to the original size. If the click is executed to the center of the button then nothing happens. This behavior is valid only for a few clicks and then it's becomes better.

This issue is only valid for iOS. Exact the same steps doesn't do anything unexpected on Android.

Affected platforms

  • iOS

Versions

  • Libraries:
    • Compose Multiplatform version: 1.6.11
  • Kotlin version: 2.0.0
  • Device (model or simulator for iOS issues): Iphone 13 and Iphone 14 Pro Max were tested.

To Reproduce
Steps to reproduce the behavior:

ModalBottomSheet(
    sheetState = bottomSheetState,
    onDismissRequest = { onDismissRequest() },
) {
    Column(
        modifier = Modifier.padding(top = 24.dp, bottom = 24.dp, start = 24.dp, end = 24.dp),
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {
        Button(
            modifier = Modifier
                .fillMaxWidth()
                .padding(top = 24.dp),
            onClick = onDeleteClick,
        ) {
            Text("delete")
        }

        Button(
            modifier = Modifier
                .fillMaxWidth()
                .padding(top = 8.dp),
            onClick = onCancelClick,
        ) {
            Text("cancel")
        }
    }
}

I tried to replace the Button with the same-size Box and add a clickable modifier and it works the same way. (bug repeats)

.clickable(
    onClick = onClick,
    indication = rememberRipple(),
    interactionSource = remember { MutableInteractionSource() },
)

But, if I add bounded = false to the ripple, the bug is gone.

.clickable(
    onClick = onClick,
    indication = rememberRipple(bounded = false),
    interactionSource = remember { MutableInteractionSource() },
)

Also, If I remove fillMaxWidth modifier from the button and make the width less than the available space then the issue is gone.

Expected behavior
Button doesn't change it's size when the ripple effect is being drawn.

Screenshots

RPReplay_Final1717503745.MP4
@alaegin alaegin added bug Something isn't working submitted labels Jun 4, 2024
@terrakok
Copy link
Collaborator

terrakok commented Jun 4, 2024

Reproduced

Screen.Recording.2024-06-04.at.17.10.42.mov

issues_4924 2.zip

@MatkovIvan
Copy link
Member

The current workaround is to disable platform layers via

ComposeUIViewController(
    configure = { platformLayers = false }
)

MatkovIvan added a commit to JetBrains/compose-multiplatform-core that referenced this issue Jun 5, 2024
Correct version of reverted change #1285

Fixes JetBrains/compose-multiplatform#4924

## Testing
Manually, see #1190

This should be tested by QA

## Release Notes

### Fixes - Multiple Platforms
- Fixed `Popup` jerking during ripple effect animation
@okushnikov
Copy link

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants