Added onToggle hook (similar to onSelect). This will be triggered every time a branch is expanded or collapsed.