Auto layout misbehaving in variants

I have a component with several variants, all using auto layout to fill the space they are placed in. When testing the variants by switching them from within design mode, auto layout works as expected:

but when the variants are switched from prototype mode, auto layout stops working properly:

As displayed on the image above, the main component container expands to fit the parent width but its contents don’t. This despite them behaving as expected when the variants are set from within design mode as is shown on the top image.
How do I fix this?