The film is The Village (2004). Children in a secluded village are told creatures in the woods kill night wanderers. In truth, the creatures are imaginary, and the children actually have a rare inherited condition causing extreme sunlight sensitivity.