⚠️ This lesson is retired and might contain outdated information.

Override Default Transitions in React Native with StackNavigator's transitionConfig Object

Spencer Carli
InstructorSpencer Carli
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated a year ago

In this lesson you will learn how you can begin overriding the default transition options for React Navigation via the transitionConfig configuration object.

Instructor: [00:00] to start with, we've got a basic application that uses a StackNavigator to render a home screen and a detail screen, which we can go ahead and navigate between. Now by default, this is using React Navigation's default animation patterns, which on iOS are meant to mimic exactly the iOS navigation.

[00:17] If we want to go ahead and start overriding this as a second argument to our StackNavigator function, we can pass a configuration object to it. We can pass it a function on the key transition config. Inside of transition config, we can go ahead and return an object, at which point we can go ahead and use the key transition spec to pass an object to override the default transition.

[00:40] For example, we can override the duration and say it will take 3,000 seconds to make this transition. Also, after importing Easing and Animated from React Native, we can go ahead and override the Easing with, for example, Easing.out and then passing Easing.poly(4).

[01:04] If I reduce this down to 750 milliseconds, we can see that it's very slightly changing the animations that are happening. You can go ahead and specify the Animated timing type, or you could use Animated.spring there to go ahead and start customizing this transition...

egghead
egghead
~ 9 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today