Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

.send(.presentCustomAlert, animation: .none) method does not work when present / dismiss fullScreenCover #3017

Closed
2 of 3 tasks
JongHoooon opened this issue Apr 28, 2024 · 1 comment

Comments

@JongHoooon
Copy link

JongHoooon commented Apr 28, 2024

Description

I made custom alert. It presented by fullScreenCover. I want to present / dismiss it without animation.

when present

Reduce<State, Action> { state, action in
  switch action {

...

    case .someThingHappend:
      return .send(.presentAlert, animation: .none)      //  <-- I want to present without animation

...

    case .presentAlert:
      state.destination = .customAlert(.init(
          title: "alert title",
          message: "alert message"
      ))
      return .none

when dismiss

/* custom alert view */

...

  confirmButton() {
    store.send(.delegate(.confirm), animation: .none)    //  <-- I want to dismiss without animation
  }

...



/* cusomt alert reducer */

enum Action {
    case delegate(Delegate)
    @CasePathable
    enum Delegate: Equatable {
        case confirm
   }
}



/* parent view */

case .destination(.presented(.customAlert(.delegate(.confirm)))):
  state.destination = nil
  return .none

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

I want to present / dismiss full screen cover without animation

Actual behavior

I want to present / dismiss full screen cover with animation

Steps to reproduce

No response

The Composable Architecture version information

1.9.3

Destination operating system

iOS 17

Xcode version information

15.3

Swift Compiler version information

1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
@JongHoooon JongHoooon added the bug Something isn't working due to a bug in the library. label Apr 28, 2024
@stephencelis
Copy link
Member

Hi @JongHoooon! The animation parameter in TCA is simply a wrapper around withAnimation, so the behavior you're seeing is how vanilla SwiftUI behaves, and not a bug with TCA. As such I'm going to convert this to a discussion, but I think you should first try to present/dismiss the full-screen cover without animation in vanilla SwiftUI and that should inform how to do so in TCA.

I believe you can use a Transaction that has disablesAnimation property set to true, but I haven't tried it so I'm not 100% sure of the vanilla solution 😄

@stephencelis stephencelis removed the bug Something isn't working due to a bug in the library. label Apr 28, 2024
@pointfreeco pointfreeco locked and limited conversation to collaborators Apr 28, 2024
@stephencelis stephencelis converted this issue into discussion #3018 Apr 28, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants