Because ripening is a kind of irreversible breakdown of many components. One example: pectine breakdown makes it softer, acid breakdown makes it less saur and more estery (acids made into fruity esters) etc.
It doesnt have any sunlight, fruit needs sunlight to ripen. Actually, not all fruit needs sunlight to ripen. One way packaging can affect the ripening of fruit is by trapping the ethylene gas produced by the fruit, causing rapid ripening.