refactor setVisibilityChangeFn