I think that terroist attacks in the uk such as London bombings may have led to Islamaphobia and general xenophobia which may have fuelled Brexit.
Mind you...ive been told that Usa and uk foreign policy might have encouraged terroism. Many terroists were not from the eu anyway.