SwiftUI: Losing animation when passing actions into a subview.

I have created the main view of my app and there is a button that will display a pop-up view doing some user input tasks. I would like the background dim view to fade in and fade out while the pop-up view is using scale animation in transition. The animation works pretty well while showing the view, but it does not work when it disappears.

Following is my code that is relative to this problem. There is a button in the main view that will toggle isAddViewShown to display the pop-up view, and there are two buttons that will close it. So I passed the action into the pop-up view as shown, but it did not work.

I'm pretty new to SwiftUI so I'm not sure whether that is what I'm supposed to do. Is there any way to let the animation work as designed?

public struct SMMainView: View {

    @State private var isAddViewShown: Bool = false
    
    public var body: some View {
        ZStack {
            
            /*
             Some other views
             */
            
            // This is actually a dim view using opacity animation in transition
            if isAddViewShown {
                Color.black.opacity(0.5)
            }
            
            // This is a customized pop-up view using scale animation in transition
            if isAddViewShown {
                SMAddView(onCreate: { name, description in
                    /*
                     do some extra operations with name and description
                     */
                    withAnimation(.easeInOut(duration: 0.25)) {
                        isAddViewShown.toggle()
                    }
                },
                          onClose: {
                    withAnimation(.easeInOut(duration: 0.25)) {
                        isAddViewShown.toggle()
                    }
                })
                .transition(.scale)
            }
        }
    }
    
}

To avoid misunderstanding, the following is basically what I put for the pop-up view.

    struct SMAddView: View {
    
    @State private var name: String = "Title"
    
    @State private var description: String = "Please Enter description."
    
    private var createAction: (String, String) -> Void
    
    private var closeAction: () -> Void
    
    var body: some View {
        VStack {
            TextField("", text: $name)
            
            TextEditor(text: $description)
            
            Button(action: {
                createAction(name, description)
                name = "Title"
                description = "Please enter description."
            }) {
                Text("Create")
            }
            Button(action: {
                closeAction()
                name = "Title"
                description = "Please enter description."
            }) {
                Image(systemName: "xmark.circle")
            }
        }
    }
    
    init(onCreate create: @escaping (String, String) -> Void, onClose close: @escaping () -> Void) {
        createAction = create
        closeAction = close
    }
    
}