question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

On iOS, orientation changes don't animate in a way that "looks native"

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 8.4.0 Yarn: 1.0.1 npm: 5.4.1 Watchman: 4.5.0 Xcode: Xcode 8.3.3 Build version 8E3004b Android Studio: 2.3 AI-162.3934792

Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: 0.48.3 => 0.48.3

Steps to Reproduce

  1. Create a react native app w/ react native init
  2. Run it on an iOS device or the iOS simulator
  3. (If on a simulator) Turn on slow animations (CMD+T) so the issue will be more obvious.
  4. Rotate the device a few times to landscape and portrait
  5. Observe that immediately after the orientation changes, the view is resized to the dimensions of the new orientation, and THEN the rotation animation begins. The view’s contents and dimensions are not smoothly resized while the view is being rotated.

Expected Behavior

In a regular native iOS app, when the orientation of the device changes, the view’s contents and dimensions smoothly resize while the view is also rotated at the same time.

Here is a animated gif. This is a simple native app written in swift, see how the view resizes and rotates smoothly (at the same time) on orientation changes:

native_rotation

Actual Behavior

On orientation changes, the view’s dimensions and contents are resized once at the very beginning of the change, and then the rotation animation happens.

Here is another animated git. This is a simple RN app, with a red border applied to the view so you can see how the view’s dimensions are immediately changed (not smoothly animated).

rn_rotation

Reproducible Demo

Sadly I can’t seem to get the expo app to handle rotations so I guess having a Snack wouldn’t be useful.

But you can see if yourself pretty easily if you:

  1. Use react-native init to create a new app
  2. Edit index.ios.js and add to the container’s styles (line ~40):
    borderColor: 'red',
    borderWidth: 10,
  1. Then run it, turn on slow animations in the simulator (CMD+T), and change the orientation a few times.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:23
  • Comments:29 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
mtkoponecommented, Jan 14, 2019

This issue is becoming a blocker for us for using react-native. Also applies to Android. I would love to see it fixed, and can help if necessary.

5reactions
acollazomayercommented, Oct 19, 2018

Is this going to be solved. I am making a video player app and I like to open the player in landscape mode. And when I force the app to show in landcape. The animation is horrible. ezgif com-optimize

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable orientation change rotation animation - Stack Overflow
In iOS8 you can disable rotation animations by disabling CALayer animations in your view controller's implementation of viewWillTransitionToSize .
Read more >
iOS 16 unexpected rotation behaviour - Apple Developer
While on iOS 15 or earlier, the app remains at Landscape and only rotates to Portrait when physical device's orientation changes.
Read more >
How does iPhone orientation change animation work? - Quora
For regular applications using the UIKit framework, the orientation animation is automatic. The application nominates (usually in the application properties ...
Read more >
Animations - React Native
Not everything you can do with Animated is currently supported by the native driver. The main limitation is that you can only animate...
Read more >
Detecting device orientation - Web APIs | MDN
All you need to do in order to begin receiving orientation change is to listen to the deviceorientation event:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found