Open hoanglam10499 opened 4 years ago
Solved Issues #69. Please merge
I think using a callback for the listenToOrientationChange
would be a better choice.
And you seem to be re-writing most of the file.
I guess it's your formatter.
so consider something like.
`
if (typeof callback === 'function' ){
const orientation = screenWidth < screenHeight ? 'portrait' : 'landscape';
callback(orientation);
};`
Lesser code and solves the problem for functional and class based components.
Try refactoring your code, and make changes only to the lines that concerns your PR.
@Cmion I didn't change all the files, it was a change of the format code. You can see the "File Changed".
I'm not a maintainer, contributor or anything. But It seems like your recent commit made those changes.
I also looks like the library needs some maintenance too
@Cmion It was a change of the format code ...
Some quick, hopefully constructive, feedback on this PR:
===
for the comparison operatorconst listenOrientationChange = ({classComponentThis = null, setStateHook = null}) => {
// . . .
if (classComponentThis) {
classComponentThis.setState(...);
} else if (setStateHook) {
setStateHook(...);
}
}
Thank you for your efforts on this! Really, really appreciated.
Solved Issues #69. Please merge