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.

NavigationExperimental Modal Transition

See original GitHub issue

I’ve been experimenting NavigationExperimental with my team and we’ve run into a little transition problem. Most of the code is taken from the example, which is why more questions were brought. We expected the direction of the transition of the modal would pop out the same direction it was pushed in, but it doesn’t.

Here’s the gif with the occuring transition error:

Our code

// This is our root component, which is later rendered inside the <Provider /> and has the state and actions connected
const Root = ({navigationState, navigatePop}) => {

  const renderScene = ({scene}) => {
    const { route } = scene

        switch(route.key) {
        case 'First':
            return <First />
        case 'Second':
            return <Second />
      case 'Third':
            return <Third />
        case 'Modal':
            return <Modal />
        }
  };

  return (
            <NavigationCardStack
                navigationState={navigationState}
                onNavigateBack={navigatePop}
                style={styles.container}
                direction={navigationState.routes[navigationState.index].key === 'Modal' ? 'vertical' : 'horizontal' }
                renderOverlay={props => (
                    <NavigationHeader
                        {...props}
                        onNavigateBack={navigatePop}
                        renderTitleComponent={props => {
                            const title = props.scene.route.title
                            return <NavigationHeader.Title>{title}</NavigationHeader.Title>
                        }}
                    />
                )}
                renderScene={renderScene}
            />
        )
};

Project specification

  • Versions
    • react-native-cli: 1.0.0
    • react-native: 0.31.0
  • Current OS:
    • Mac
  • Tested on
    • Android & iOS

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ptomasrooscommented, Feb 13, 2017

@Hitabis Looks something like this

  _render = (transitionProps) => {
    const { router } = this.context;

    return transitionProps.scenes.map((scene, i) => {
      const sceneProps = {
        ...transitionProps,
        scene,
      };

      const route = router.getRouteByKey(sceneProps.scene.route.key);

      const style = [
        this._getStyle(sceneProps),
        route.type === 'popup' && styles.transparentNavigationCard,
      ];

      return (
        <NavigationCard
          {...sceneProps}
          style={style}
          panHandlers={this._getPanHandlers(sceneProps)}
          renderScene={this._renderScene}
          onNavigateBack={this._pop}
          key={sceneProps.scene.route.key}
        />
      );
    });
  }```
1reaction
ericvicenticommented, Oct 24, 2016

@hedgerwang, maybe we should consider removing the ‘direction’ prop. It is working as intended but is not meeting people’s needs.

Instead, I think we should consider introducing NavigationModalStack for vertical transitions, and NavigationCardStack can always be horizontal.

cc @skevy

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modal Transition - Build an Animated App with Rive and SwiftUI
This is a compilation of the SwiftUI live streams hosted by Meng. Over there he talks and teaches how to use design systems,...
Read more >
Learning Multi-Modal Navigation in Unstructured Environments
A robot that operates efficiently in a team with humans in an unstructured outdoor environment must translate commands into actions from a ...
Read more >
Navigation API - MDN Web Docs - Mozilla
Note: In this context "transition" refers to the transition between one history entry and another. It isn't related to CSS transitions.
Read more >
Modal Testing: A Practical Guide - Siemens Communities
This article explains some of the key steps involved in performing a modal test, from start to end. In an experimental modal, a...
Read more >
Better modals in React Native - Brains & Beards
I've been working recently with modal popups in React Native (again!) and realised it's a recurring ... Display with a navigation transition.
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