We calculate the nuclear induced breakup of Be11 and B8 using a more realistic treatment of the diffraction and stripping processes than in previous work. The breakup is treated in the eikonal approximation with a profile function calculated from a realistic optical potential at low energies and from free nucleon-nucleon cross sections at high energies. This treatment gives a good description of measured breakup cross sections, as well as the longitudinal momentum distribution of the core-like fragments, which is narrower than predicted in the transparent limit. The real part of the potential is found to be significant and enhances the diffractive breakup at low energies.