The flux is incorporated into the underfill, thus becoming one compatible material which is cured above the melting point of solder.
There is room within the encased solder for expansion at the reflow temperature.