react-native-orientation: Event doesn't fire in Android

Somehow, the Orientation.addOrientationListener event doesn’t trigger in Android for me. I’ve got a splashpage activity, so my configuration is slightly different than usual. What piece of code from the installation is responsible for making the event work? Or where can I look to get it working?

It works on IOS btw.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 14
  • Comments: 21

Most upvoted comments

As a workaround, I just figured that I can also get the orientation with the Dimensions API. Works just fine under android.

Dimensions.addEventListener('change', ({ window: { width, height } }) => {
    const orientation = width > height ? 'LANDSCAPE' : 'PORTRAIT';
}