Avoid creating an instance of every view while searching for the correct view (#11722)

Change-Id: Ifab9aa0021bde58280fd75370e5df46fb5efa7a7