In this example, the verb-noun gyrraedd must take a soft mutation after the preposition i (iddyn) even though it doesn't directly follow the i. This is also the case when the preposition conjugates, e.g.
Aeth Efan i'r gwely ar ôl i ni gyrraedd adref.
Cofiais ar ôl iddo ddweud y stori eto.
The suffixes (endings) for the prepositions can be found by clicking here.
The table of mutations can be found by clicking here.