Sciarid Fly (fungus gnats) are tiny flies, 2mm (1/10th inch) in length and black. They move about on the surface of the compost and if disturbed, fly up. The slender larvae are white with black heads; they may feed on root hairs and reduce the vigour of plants.
They can be more problematic in modern peat-free composts. This is because peat-free composts often contain organic matter, such as wood fibres and green waste, which provide a food source for the larvae of these flies.

Typically, the adults thrive on damp compost (another reason not to over-water!) and decaying matter and usually pose no threat to your plants, although they can appear a bit unsightly indoors.
Bright yellow sticky fly traps effectively attract and catch these pesky insects. They're simple to use and ideal for trapping annoying gnats.
Yellow Sticky Traps