Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs & Custom Transition #3155

Closed
ev3nst opened this issue Aug 3, 2018 · 2 comments
Closed

Tabs & Custom Transition #3155

ev3nst opened this issue Aug 3, 2018 · 2 comments

Comments

@ev3nst
Copy link

ev3nst commented Aug 3, 2018

is it possible to implement custom transition for tabs other than swipe. for example Fade In or Zoom In

Example

// Fade In Transition
export function fadeIn(layout, position, scene) {
    const {
        index
    } = scene;
    const opacity = position.interpolate({
        inputRange: [index - 1, index],
        outputRange: [0, 1],
    });
    return {
        opacity
    };
}

// This only works when Actions is called between other tabs
<Scene
    key="root"
    hideNavBar
    transitionConfig={() => ({
        screenInterpolator: (props) =>
            { return this.determineTransition(props) }
    })}

    <Tabs
        key="main"
        transition="fadeIn"

Version

Tell us which versions you are using:

  • react-native-router-flux v4
  • react-native v0.55.4
@ev3nst ev3nst changed the title Tabs Custom Transition Tabs & Custom Transition Aug 3, 2018
@ibraheeamm
Copy link

Custom transition can be achieved by writing your own or using Animations defined in
CardStackStyleInterpolator from react-navigation library as used in the Sample Project.
Refer to these issues to know how to write custom animations:
#2628
This one is in react-navigation repo but it has really good example for writing custom animation
react-navigation-issue1490
also you must use transitionConfig in all scenes to apply the transition

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

@ibraheamkh Great answer, thanks! Closing this ticket

@aksonov aksonov closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants