Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'transitionConfig' is removed in favor of the new animation APIs

I am working with a react native application, and it shows a warning in the console

import {createStackNavigator} from 'react-navigation-stack';
import {fromRight} from 'react-navigation-transitions';
const ApplyNowNav = createStackNavigator(
  {
    Home,
    Profile,
  },
  {
    headerMode: 'none',
    transitionConfig: () => fromRight(),
  }
);

WARN Deprecation in 'createStackNavigator':

transitionConfig' is removed in favor of the new animation APIs

Is there any solution to fix this issue?

like image 875
Shijin TR Avatar asked Jan 06 '20 11:01

Shijin TR


2 Answers

You need to update your code to use to use the new Animation API: https://reactnavigation.org/docs/en/stack-navigator.html#animations

From the code you posted, you can change it to the following instead to have a slide from right animation:

import { createStackNavigator, TransitionPresets } from 'react-navigation-stack';

const ApplyNowNav = createStackNavigator(
  {
    Home,
    Profile,
  },
  {
    headerMode: 'none',
    defaultNavigationOptions: {
      ...TransitionPresets.SlideFromRightIOS,
    },
  }
);
like image 125
satya164 Avatar answered Nov 09 '22 03:11

satya164


  1. Update react-navigation and use creatStackNavigator component instead of StackNavigator.
  2. Check current methods and syntax, there is a lot of changes compare to previous syntax.

Works for me when I updated the code

like image 1
chandru Avatar answered Nov 09 '22 03:11

chandru