A
A
Artur Zagorsky2019-10-10 11:19:31
React
Artur Zagorsky, 2019-10-10 11:19:31

React-native-router-flux: Cannot update during an existing state transition, what's wrong?

Hello! Help deal with the problem. Need to show modal using react-native-router-flux, but warning: "Cannot update during an existing state transition" is thrown. The desired Scene is displayed for a second, and then this warning appears and the scene disappears. If I change the scene prop 'type' to "replace", then everything works, but then I can't do Actions.pop() inside that scene (as far as I understand, due to the fact that the stack is replaced by this scene). Here is the App structure, the last Scene:

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>
    );
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Zagorsky, 2019-10-10
@artedza

Understood) The last scene refers to the About component. It has a button with the onPress prop in the render, there was a call to goBack(). Removed brackets - took off)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question