RN-NavigationExperimental-Redux-Example icon indicating copy to clipboard operation
RN-NavigationExperimental-Redux-Example copied to clipboard

RenderScene called twice

Open yeswanth opened this issue 9 years ago • 2 comments

I placed a console.log in renderScene method in AppContainer.js (and did not modify any of the other code). For every page that is added to the navigation, the method is called twice. Is it a bug? How do I avoid renderScene method to be called second time?

 _renderScene({scene}) {
        // Here renderscene is printed twice for every route 
        console.log('renderscene');
        const { route } = scene

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

I'm facing similar issue with pure RN NavigationExperimental implementation in my own project.

yeswanth avatar Nov 02 '16 16:11 yeswanth

That's a good question, I'm not quite sure on that one. It looks like it pauses a bit between renders, which makes me wonder if there is a state change that is occurring with NavigationTransitioner after the animation completes that is causing a rerender.

Haven't had a chance to look into it too much, but anyone else seeing this or know more about it?

jlyman avatar Nov 10 '16 18:11 jlyman

Looks like under the debug mode, the transition is bit late and triggering the _renderScene() twice before the first trigger is executed. It is not occurring while debug mode is off.

symmetriccurve avatar Nov 20 '16 03:11 symmetriccurve