Myocarditis is a condition where the heart muscle is inflamed and can be caused by viruses, bacteria, or other infections. It is possible that there is a genetic component to this condition, and I would recommend consulting with a genetic specialist or a pediatric cardiologist. They may be able to provide more information about potential genetic causes and what steps can be taken to prevent it in future pregnancies. It is important to seek medical attention and advice from a experienced healthcare professional.