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.

iOS - Landscape to portrait rotation briefly shows removed screen on pop

See original GitHub issue

Description

If we are in landscape mode, pop a screen, and immediately rotate to portrait, the popped screen will still show for half a second ( I assume while it is being unmounted).

Screenshots

https://user-images.githubusercontent.com/48869228/142239454-fc6913a9-a973-4335-bfa4-39c61c10fd95.mov

mov file most likely won’t play in the browser and needs to be downloaded.

Steps To Reproduce

  1. Switch to landscape
  2. Push a screen
  3. Pop the screen and immediately rotate to portrait
  4. Observe

Expected behavior

Previous screen should not be visible.

Actual behavior

Popped screen is visible for half a second.

Reproduction

This is the animation config I’m using, which may or not be related. I will try to reproduce with the sample app when I get a chance.

const animationConfig = {
  animation: 'spring',
  config: {
    stiffness: 1200,
    damping: 200,
    mass: 3,
    overshootClamping: true,
    restDisplacementThreshold: 0.1,
    restSpeedThreshold: 0.1,
    useNativeDriver: true,
  },
};

const {multiply} = Animated;
const animationInterp = ({current, next, inverted, layouts: {screen}}) => {
  const translateFocused = multiply(
    current.progress.interpolate({
      inputRange: [0, 1],
      outputRange: [screen.width, 0],
      extrapolate: 'clamp',
    }),
    inverted,
  );

  const translateUnfocused = next
    ? multiply(
        next.progress.interpolate({
          inputRange: [0, 1],
          outputRange: [0, screen.width * -0.8],
          extrapolate: 'clamp',
        }),
        inverted,
      )
    : 0;

  const overlayOpacity = current.progress.interpolate({
    inputRange: [0, 1],
    outputRange: [0, 0.1],
    extrapolate: 'clamp',
  });

  const shadowOpacity = current.progress.interpolate({
    inputRange: [0, 1],
    outputRange: [0, 0.3],
    extrapolate: 'clamp',
  });

  return {
    cardStyle: {
      transform: [
        // Translation for the animation of the current card
        {translateX: translateFocused},
        // Translation for the animation of the card on top of this
        {translateX: translateUnfocused},
      ],
    },
    overlayStyle: {opacity: overlayOpacity},
    shadowStyle: {shadowOpacity},
  };
};

Platform

  • iOS
  • Android
  • Web
  • Windows
  • tvOS

Workflow

  • Managed workflow
  • Bare workflow

Package versions

package version
react-native 0.65.1
@react-navigation/native 5.9.4
@react-navigation/native-stack 5.14.9
react-native-screens 3.9.0
react-native-safe-area-context 3.3.2
react-native-gesture-handler 1.10.3
react-native-reanimated 1.13.2
expo -

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
cristianoccazinspcommented, Dec 6, 2021

We still can’t upgrade to the native navigators as we have some very customized headers, and also we use the same transition animations for iOS and Android (the native android one is pretty bad for our app at least). But yes, we would like to go that route eventually.

0reactions
shelzTimesignaturecommented, Dec 11, 2021

things like navigation should’ve been handled by react native team. its been 3 years now we still facing the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rotate the screen on your iPhone or iPod touch - Apple Support
Swipe down from the top-right corner of your screen to open Control Center. Tap the Portrait Orientation Lock button to make sure that...
Read more >
How to force view controller orientation in iOS 8?
When video is playing, if it's a landscape then allow the screen to rotate landscape right and landscape left. If it's a portrait...
Read more >
22 Essential iOS Settings to Help Boost Your iPhone's ... - CNET
To customize the features you'd like to access on the lock screen, launch the Settings menu, tap Face ID & Passcode and enter...
Read more >
How to Rotate a Laptop or PC Screen: Flip Your Display on Its ...
Next, click on the “Rotation” pop-up menu and select the amount of desired rotation. Select “Confirm” in the window that appears. You can...
Read more >
How to rotate your monitor and use it vertically in macOS
You don't always have to keep a display in a landscape orientation. Here's how you can turn a second screen into a vertical...
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