Search code examples
react-nativereact-native-navigationreact-native-router-flux

Cannot update during an existing state transition with react-native-router-flux


I need to show a modal using RNRF, but I get this warning (the modal is showing for a moment and then disapears with warning).

If I set the Scene's type prop to "replace" then everything works, but I can’t do Actions.pop() in that Scene (the last one)

const App = () => {
    return (
        <Provider store={store}>
            <Router
                backAndroidHandler={() => {
                    goBack();
                    return true;
                }}
            >
                <Modal>
                    <Stack key="root" hideNavBar={true}>
                        <Scene
                            key={ROUTES.LOGIN}
                            type="push"
                            duration={1}
                            component={Login}
                            duration={1}
                            initial={true}
                        />
                        <Scene
                            key={ROUTES.TRANSACTION_SUMMARY}
                            type="push"
                            duration={1}
                            component={TransactionSummary}
                            duration={1}
                        />
                        <Scene
                            key={ROUTES.PHOTO_DIALOGUE}
                            type="push"
                            duration={1}
                            component={PhotoDialogue}
                            duration={1}
                        />
                    </Stack>
                    <Scene modal key={ROUTES.ABOUT} type="push" component={About} hideNavBar />
                </Modal>
            </Router>
        </Provider>
    );
};

Solution

  • The last scene refers to the About component. It has a button with the onPress prop in the render method, there was a call goBack(). Works good without the brackets