Ok, so Moonfire should be usable in Bear form. I would take the button off your bar, and replace with the one from your spell book, as I strongly suspect you’ve a macro that is shifting you out.
In short: Moonfire should not shift you out of bear.
As for your macros, please note that abilities that use the GCD can not be run as you have above. Modifiers are needed which will allow information on the status of your current form.
I’d look at something like this:
/cast [noform:1] Bear Form
/cast swipe
Or even:
/cast [noform:1] Bear Form; Swipe
With these examples, if you’re out of bear form, it will shift you in. On next press once on form, you will swipe.
If you are already in form, you will just swipe.
Also consider that your bars will change, depending of form being used.