34
Views
1
Comments
Solved
[Screen Orientation Plugin] ResolveOrientation Bug
Question
screen-orientation-plugin
Mobile icon
Forge asset by Experts
Application Type
Mobile

I think there is a bug in the github project for seting the orientation. 

The function resolveOrientation  is checking if the OrientationLockType has a property called 'orientation', but in reallity it should be checking for the value of orientation. E.g:portrait, landscape etc..

function resolveOrientation (orientation, resolve, reject) {

    if (!Object.prototype.hasOwnProperty.call(OrientationLockType, 'orientation')) { //this should be without the quotes

        var err = new Error();

        err.name = 'NotSupportedError';

        reject(err); // "cannot change orientation");

    } else {

        screenOrientation.setOrientation(orientation);

        resolve('Orientation set'); // orientation change successful

    }

}

2019-12-01 23-50-25
Pedro Neto
Champion
Solution

This fix has now been applied to the github project, so the master branch is ready to be used again.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.