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.

No back animations on iOS, instant transitions only

See original GitHub issue

Workaround found:

The problem was I was using use_frameworks! in my Podfile. The exact line I had was use_frameworks! :linkage => :static This was because the new react-native-firebase libraries (15.x.x) required this (all react-native-firebase > 14.x.x). For some reason this also made back animations stopped working.

I fixed this by downgrading react-native-firebase to 14.11.1 and removing use_frameworks! from my Podfile. Then I deleted the pods folder and reinstalled. Everything now works.

Description

UPDATE:

  • To fully replicate you must copy over the Podfile

UDPATE:

  • Appears to have something to do with using an Animated.View SplashScreen component, using a regular View doesn’t interfere with the transitions

I updated to react native 0.69.1 and then I found that I no longer get back animations, the view in front disappears instantly.

  • I’ve tried using both useNavigation() and ({navigation}) in the screens arguments to trigger goBack(). There’s still no transition animation either way
  • Swiping the page off works fine
  • If I enable headerShown: true then using the native back button on iOS plays the animations as normal
  • I’ve downgraded back to react native 0.68 and I’ve still go the same issue

It’s the same issue as https://github.com/software-mansion/react-native-screens/issues/1356

Screenshots

https://user-images.githubusercontent.com/21344181/179496474-6fa6c511-49ea-443e-9be7-33a027597716.MP4

Steps To Reproduce

  1. Go back using goBack() (as opposed to a native back button).

Expected behavior

The transition should just play as normal

Actual behavior

There is no back animation when using goBack()

Reproduction

UPDATE: Reproduce this issue with the following code:

App.tsx

import * as React from 'react';
import {useEffect, useState} from 'react';
import {View, TouchableOpacity, Text} from 'react-native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {NavigationContainer} from '@react-navigation/native';
import Animated, {FadeOut} from 'react-native-reanimated';

const MainStack = createNativeStackNavigator();

function App() {
  const [userLoading, setUserLoading] = useState(true);

  useEffect(() => {
    setUserLoading(false);
  }, []);

  // Just show a splashscreen if either are loading
  if (userLoading) {
    return <SplashScreen />;
  }

  return (
    <NavigationContainer>
      <MainStack.Navigator>
        <MainStack.Screen name={'FirstScreen'} component={FirstScreen} />
        <MainStack.Screen name='SecondScreen' component={SecondScreen} />
      </MainStack.Navigator>
    </NavigationContainer>
  );
}

const FirstScreen = ({navigation}: any) => {
  return (
    <View style={{flex: 1, alignContent: 'center', justifyContent: 'center'}}>
      <TouchableOpacity
        style={{backgroundColor: 'cyan', padding: 20}}
        onPress={() => navigation.navigate('SecondScreen')}
      >
        <Text>Go forward</Text>
      </TouchableOpacity>
    </View>
  );
};

const SecondScreen = ({navigation}: any) => {
  return (
    <View style={{flex: 1, alignContent: 'center', justifyContent: 'center'}}>
      <TouchableOpacity
        style={{backgroundColor: 'magenta', padding: 20}}
        onPress={() => navigation.goBack()}
      >
        <Text>Go Back</Text>
      </TouchableOpacity>
    </View>
  );
};

const SplashScreen = () => {
  return (
    <Animated.View
      style={{
        backgroundColor: 'black',
        flex: 1,
      }}
      exiting={FadeOut}
    />
  );
};

export default App;

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
use_frameworks! :linkage => :static

target 'flashingscreens' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'flashingscreensTests' do
    inherit! :complete
    # Pods for testing
  end

 post_install do |installer|

    # https://github.com/facebook/react-native/issues/32451
    installer.pods_project.targets.each do |target|
      if target.name == 'RCT-Folly'
        target.build_configurations.each do |config|
          config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
        end
      end
    end
    
end 
end

Platform

  • iOS
  • Android
  • Web
  • Windows
  • tvOS

Architecture

  • Paper
  • Fabric

Workflow

  • Managed workflow
  • Bare workflow

Package versions

@react-navigation/native”: “^6.0.11”, “@react-navigation/native-stack”: “^6.7.0”,

package version
react-native 0.69.1
@react-navigation/native 6.0.11
@react-navigation/native-stack 6.7.0
react-native-screens 3.13.1
react-native-safe-area-context 4.3.1
react-native-gesture-handler 2.4.2
react-native-reanimated 2.9.1

I have tried earlier versions of react, react native, reanimated, native-stack

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
kkafarcommented, Dec 6, 2022

I’ll try to look into it

4reactions
austin43commented, Nov 4, 2022

This issue is effectively blocking people who use react-native-firebase from upgrading to >= rnfb@15 and subsequently >= rn@0.69. As the firebase-ios-sdk is not planning to remove use_frameworks, the only way forward for folks in this situation is to resolve why use_frameworks causes a break in animations. Can this be re-opened @kkafar?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reduce screen motion on your iPhone, iPad, or iPod touch
Screen transitions and effects use the dissolve effect instead of zoom or slide effects. Parallax effect where your wallpaper, apps, and alerts ...
Read more >
iOS Transition Animations: The proper way to do it
Now we can implement the necessary method to provide our animation object. Before that though, a quick, simplified look at what is going...
Read more >
Animations & Transitions - iOS Dev Scout - YouTube
Speaker: Sudeep Agarwal (@sudeeeeeep)Produced by Engineers.SGHelp us caption & translate this video!http://amara.org/v/WChk/
Read more >
Create advanced animations with smart animate
You can select Smart animate from the list of transitions, when building a prototype. You can also apply Smart animate with other transitions...
Read more >
How to add and remove views with a transition
By default, SwiftUI uses a fade animation to insert or remove views, but you can change that if you want by attaching a...
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