bug: [modal] enterAnimation causes modal not rendered properly
See original GitHub issuePrerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
Current Behavior
when giving param enterAnimation, the component attached will not be rendered.
a simple animation builder for instance below:
enterAnimation(baseEl) {
return createAnimation()
.addElement(baseEl)
.duration(250)
.fromTo('opacity', '0', '1');
}
However, with a custom leaveAnimation but without modifying enterAnimation, the modal can be rendered normally.
Expected Behavior
Component should be rendered when giving custom animations.
Steps to Reproduce
- use modal controller
- giving a simple animation as above to param
enterAnimation - present the modal
- the modal shows but without content
Code Reproduction URL
No response
Ionic Info
No response
Additional Information
We are using Angular 13.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Custom animation for bootstrap modal not working on closing ...
I find that a display:none property is added inline at the parent div on the time of closing the modal. Does it is...
Read more >ion-modal: Ionic Mobile App Custom Modal API Component
ion-modal is a dialog that appears on top of mobile app content, and must be dismissed before interaction resumes. Learn more about custom...
Read more >Create a Custom Modal Page Transition Animation in Ionic
In this tutorial, we walk through how to create a custom page transition animation for modals in Ionic.
Read more >Modal - OutSystems 11 Documentation
Blank - The animation goes from a small size to its rendered size (Entities.EnterAnimation.EnterScale). This is the default. Entities.
Read more >Modal Animations - CodePen
Most of the time these slide in or fade in - just playing with other instantiation animations. All animations are class-driven, and are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@sean-perkins Thanks Sean, the additional configurations from your example solved the problem. I had initially also an animation for the modal wrapper, but it did not work. I played around with your configurations and found that without
beforeStylesor.shadowRoot, it will not work, which did work with previous version Ionic 5. Perhaps Ionic 6 makes these two configurations mandatory for the modal component.@forOneWhoHasThisIssue So to make it work, it needs:
.beforeStyles()or.keyframes().shadowRootafterbaseElThanks again, I’ll close the issue accordingly.
Animating the modal element is more complicated than just a single animation. If we take inspiration from the existing animations that ship with Ionic, we can see that we need to additionally animate the modal wrapper.
For example:
<video src="https://user-images.githubusercontent.com/13732623/148156704-1f94e6c0-c2f8-474d-b5e0-67b1971f0d3e.mp4"></video>
Let me know if this resolves your issue.