Parenting generic weapon to Humanod breaks Humanoid's animation

I have a Humanoid and a gun with Generic rig type. The gun has no bones bit I created an animation in the animation window and set it up in the guns animator controller. When the gun rig type was none everything worked but I changed it to Generic to create the fire animation.

What’s the correct process for animating a weapon for use with mecanim?

I’m not a coder - so this might not be the best solution, but I would animate the gun in 3D package, then when you bring it into Unity parent it to an empty game object then move/parent the empty game object to the hand.
This technique might work as desired with the animation you have already created - try it. Parent the gun to an empty game object and then parent the game object to the hand.