react-native-orientation: Can't working on RN 0.42.0

I installed this with RN 0.42.0, and tried to lock the screen as portrait by Orientation.lockToPortrait(); in the componentDidMount function, but it seems didn’t lock my screen as portrait, does anyone has this problem?

  • I use iOS simulator
  • I did the react-native link after yarn add

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 25

Most upvoted comments

@wellyshen glad it worked out

Hi Guys, I fellow the updated instruction of README to install this library on RN 0.44.0, now it works 😃

npm install --save react-native-orientation will fail

npm install --save react-native-orientation@https://github.com/yamill/react-native-orientation.git succeeded

I don’t think the author has updated NPM

Using react native 0.44.0 on IOS running react-native link after installing the package works as expected

@wellyshen 0.43.4 ok, 0.44.0 hasn't tried yet

I use the Android, IOS temporarily unclear

@safweb89, I just use this library few days ago

did you face this error before ? constructor OrientationPackage in class OrientationPackage cannot be applied to given types; new OrientationPackage() ^ required: Activity found: no arguments