Add onenter and onleave callback